Fix double line issue.

This commit is contained in:
Paulo Veiga 2012-01-21 15:47:21 -03:00
parent 6ed1c1a0b0
commit 99146de711
2 changed files with 10 additions and 14 deletions

View File

@ -25,7 +25,6 @@ mindplot.ConnectionLine = new Class({
this._targetTopic = targetNode; this._targetTopic = targetNode;
this._sourceTopic = sourceNode; this._sourceTopic = sourceNode;
var strokeColor = mindplot.ConnectionLine.getStrokeColor();
var line; var line;
var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode); var ctrlPoints = this._getCtrlPoints(sourceNode, targetNode);
if (targetNode.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) { if (targetNode.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
@ -34,16 +33,18 @@ mindplot.ConnectionLine = new Class({
line.setSrcControlPoint(ctrlPoints[0]); line.setSrcControlPoint(ctrlPoints[0]);
line.setDestControlPoint(ctrlPoints[1]); line.setDestControlPoint(ctrlPoints[1]);
} }
line.setStroke(1, 'solid', strokeColor);
} else { } else {
line = this._createLine(lineType, mindplot.ConnectionLine.SIMPLE_CURVED); line = this._createLine(lineType, mindplot.ConnectionLine.SIMPLE_CURVED);
if (line.getType() == "CurvedLine") { if (line.getType() == "CurvedLine") {
line.setSrcControlPoint(ctrlPoints[0]); line.setSrcControlPoint(ctrlPoints[0]);
line.setDestControlPoint(ctrlPoints[1]); 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; this._line2d = line;
}, },
@ -141,7 +142,6 @@ mindplot.ConnectionLine = new Class({
}, },
setStroke : function(color, style, opacity) { setStroke : function(color, style, opacity) {
var line2d = this._line2d;
this._line2d.setStroke(null, null, color, opacity); this._line2d.setStroke(null, null, color, opacity);
}, },

View File

@ -981,7 +981,8 @@ mindplot.Topic = new Class({
size = {width:Math.ceil(size.width),height: Math.ceil(size.height)}; size = {width:Math.ceil(size.width),height: Math.ceil(size.height)};
var oldSize = this.getSize(); 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); mindplot.NodeGraph.prototype.setSize.call(this, size);
var outerShape = this.getOuterShape(); var outerShape = this.getOuterShape();
@ -993,8 +994,10 @@ mindplot.Topic = new Class({
// Update the figure position(ej: central topic must be centered) and children position. // Update the figure position(ej: central topic must be centered) and children position.
this._updatePositionOnChangeSize(oldSize, size); this._updatePositionOnChangeSize(oldSize, size);
if (hasSizeChanged) {
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent, {node:this.getModel(),size:size}); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent, {node:this.getModel(),size:size});
} }
}
}, },
_updatePositionOnChangeSize : function(oldSize, newSize) { _updatePositionOnChangeSize : function(oldSize, newSize) {
@ -1094,13 +1097,6 @@ mindplot.Topic = new Class({
var connector = targetTopic.getShrinkConnector(); var connector = targetTopic.getShrinkConnector();
connector.setVisibility(true); 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 ... // Redraw line ...
outgoingLine.redraw(); outgoingLine.redraw();