From 99146de711ad1c5187c0ca7a5f5cb41078d4ff4b Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sat, 21 Jan 2012 15:47:21 -0300 Subject: [PATCH] Fix double line issue. --- mindplot/src/main/javascript/ConnectionLine.js | 10 +++++----- mindplot/src/main/javascript/Topic.js | 14 +++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/mindplot/src/main/javascript/ConnectionLine.js b/mindplot/src/main/javascript/ConnectionLine.js index 58121212..b4f2f3a4 100644 --- a/mindplot/src/main/javascript/ConnectionLine.js +++ b/mindplot/src/main/javascript/ConnectionLine.js @@ -25,7 +25,6 @@ mindplot.ConnectionLine = new Class({ this._targetTopic = targetNode; this._sourceTopic = sourceNode; - var strokeColor = mindplot.ConnectionLine.getStrokeColor(); var line; var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode); if (targetNode.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) { @@ -34,16 +33,18 @@ mindplot.ConnectionLine = new Class({ line.setSrcControlPoint(ctrlPoints[0]); line.setDestControlPoint(ctrlPoints[1]); } - line.setStroke(1, 'solid', strokeColor); } else { line = this._createLine(lineType, mindplot.ConnectionLine.SIMPLE_CURVED); if (line.getType() == "CurvedLine") { line.setSrcControlPoint(ctrlPoints[0]); line.setDestControlPoint(ctrlPoints[1]); } - line.setStroke(1, 'solid', strokeColor); } - line.setFill(mindplot.ConnectionLine.getStrokeColor()); + // Set line styles ... + var strokeColor = mindplot.ConnectionLine.getStrokeColor(); + line.setStroke(1, 'solid', strokeColor, 1); + line.setFill(strokeColor, 1); + this._line2d = line; }, @@ -141,7 +142,6 @@ mindplot.ConnectionLine = new Class({ }, setStroke : function(color, style, opacity) { - var line2d = this._line2d; this._line2d.setStroke(null, null, color, opacity); }, diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js index ec553d14..47589b0d 100644 --- a/mindplot/src/main/javascript/Topic.js +++ b/mindplot/src/main/javascript/Topic.js @@ -981,7 +981,8 @@ mindplot.Topic = new Class({ size = {width:Math.ceil(size.width),height: Math.ceil(size.height)}; var oldSize = this.getSize(); - if (oldSize.width != size.width || oldSize.height != size.height || force) { + var hasSizeChanged = oldSize.width != size.width || oldSize.height != size.height; + if (hasSizeChanged || force) { mindplot.NodeGraph.prototype.setSize.call(this, size); var outerShape = this.getOuterShape(); @@ -993,7 +994,9 @@ mindplot.Topic = new Class({ // Update the figure position(ej: central topic must be centered) and children position. this._updatePositionOnChangeSize(oldSize, size); - mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent, {node:this.getModel(),size:size}); + if (hasSizeChanged) { + mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent, {node:this.getModel(),size:size}); + } } }, @@ -1094,13 +1097,6 @@ mindplot.Topic = new Class({ var connector = targetTopic.getShrinkConnector(); connector.setVisibility(true); - // Create a connection line ... - var outgoingLine = new mindplot.ConnectionLine(this, targetTopic); - if ($defined(isVisible)) - outgoingLine.setVisibility(isVisible); - this._outgoingLine = outgoingLine; - workspace.appendChild(outgoingLine); - // Redraw line ... outgoingLine.redraw();