mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
Reverted unstable changes from db74c63943
This commit is contained in:
parent
e98d7f8147
commit
c7dcf9faf8
@ -133,19 +133,29 @@ mindplot.Designer = new Class({
|
|||||||
if (!dragTopic.isFreeLayoutOn(event)) {
|
if (!dragTopic.isFreeLayoutOn(event)) {
|
||||||
// The node is being drag. Is the connection still valid ?
|
// The node is being drag. Is the connection still valid ?
|
||||||
dragConnector.checkConnection(dragTopic);
|
dragConnector.checkConnection(dragTopic);
|
||||||
|
|
||||||
if (!dragTopic.isVisible() && dragTopic.isConnected()) {
|
|
||||||
dragTopic.setVisibility(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dragger.addEvent('enddragging', function(event, dragTopic) {
|
dragger.addEvent('enddragging', function(event, dragTopic) {
|
||||||
|
// Enable all mouse events.
|
||||||
for (var i = 0; i < topics.length; i++) {
|
for (var i = 0; i < topics.length; i++) {
|
||||||
topics[i].setMouseEventsEnabled(true);
|
topics[i].setMouseEventsEnabled(true);
|
||||||
}
|
}
|
||||||
|
// Topic must be positioned in the real board postion.
|
||||||
|
if (dragTopic._isInTheWorkspace) {
|
||||||
|
var draggedTopic = dragTopic.getDraggedTopic();
|
||||||
|
|
||||||
|
// Hide topic during draw ...
|
||||||
|
draggedTopic.setBranchVisibility(false);
|
||||||
|
var parentNode = draggedTopic.getParent();
|
||||||
dragTopic.applyChanges(workspace);
|
dragTopic.applyChanges(workspace);
|
||||||
|
|
||||||
|
// Make all node visible ...
|
||||||
|
draggedTopic.setVisibility(true);
|
||||||
|
if (parentNode != null) {
|
||||||
|
parentNode.setBranchVisibility(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return dragger;
|
return dragger;
|
||||||
|
@ -37,7 +37,7 @@ mindplot.DragManager = new Class({
|
|||||||
// Set initial position.
|
// Set initial position.
|
||||||
var dragNode = node.createDragNode();
|
var dragNode = node.createDragNode();
|
||||||
var mousePos = screen.getWorkspaceMousePosition(event);
|
var mousePos = screen.getWorkspaceMousePosition(event);
|
||||||
// dragNode.setPosition(mousePos.x, mousePos.y);
|
dragNode.setPosition(mousePos.x, mousePos.y);
|
||||||
|
|
||||||
// Register mouse move listener ...
|
// Register mouse move listener ...
|
||||||
var mouseMoveListener = dragManager._buildMouseMoveListener(workspace, dragNode, dragManager);
|
var mouseMoveListener = dragManager._buildMouseMoveListener(workspace, dragNode, dragManager);
|
||||||
|
@ -20,17 +20,13 @@ mindplot.DragPivot = new Class({
|
|||||||
initialize:function() {
|
initialize:function() {
|
||||||
this._position = new core.Point();
|
this._position = new core.Point();
|
||||||
this._size = mindplot.DragTopic.PIVOT_SIZE;
|
this._size = mindplot.DragTopic.PIVOT_SIZE;
|
||||||
|
this._line = null;
|
||||||
|
|
||||||
this._straightLine = this._buildStraightLine();
|
this._straightLine = this._buildStraightLine();
|
||||||
this._curvedLine = this._buildCurvedLine();
|
this._curvedLine = this._buildCurvedLine();
|
||||||
this._dragPivot = this._buildRect();
|
this._dragPivot = this._buildRect();
|
||||||
this._connectRect = this._buildRect();
|
this._connectRect = this._buildRect();
|
||||||
this._targetTopic = null;
|
this._targetTopic = null;
|
||||||
this._isVisible = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
isVisible:function() {
|
|
||||||
return this._isVisible;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getTargetTopic : function() {
|
getTargetTopic : function() {
|
||||||
@ -69,7 +65,7 @@ mindplot.DragPivot = new Class({
|
|||||||
// Calculate pivot connection point ...
|
// Calculate pivot connection point ...
|
||||||
var size = this._size;
|
var size = this._size;
|
||||||
var targetPosition = targetTopic.getPosition();
|
var targetPosition = targetTopic.getPosition();
|
||||||
var line = this._getConnectionLine();
|
var line = this._line;
|
||||||
|
|
||||||
// Update Line position.
|
// Update Line position.
|
||||||
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, position);
|
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, position);
|
||||||
@ -81,10 +77,14 @@ mindplot.DragPivot = new Class({
|
|||||||
var cy = position.y - (parseInt(size.height) / 2);
|
var cy = position.y - (parseInt(size.height) / 2);
|
||||||
pivotRect.setPosition(cx, cy);
|
pivotRect.setPosition(cx, cy);
|
||||||
|
|
||||||
|
// Display elements if it's required...
|
||||||
|
if (!pivotRect.isVisible()) {
|
||||||
// Make line visible only when the position has been already changed.
|
// Make line visible only when the position has been already changed.
|
||||||
// This solve several strange effects ;)
|
// This solve several strange effects ;)
|
||||||
var targetPoint = targetTopic.workoutIncomingConnectionPoint(pivotPoint);
|
var targetPoint = targetTopic.workoutIncomingConnectionPoint(pivotPoint);
|
||||||
line.setTo(targetPoint.x, targetPoint.y);
|
line.setTo(targetPoint.x, targetPoint.y);
|
||||||
|
this.setVisibility(true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setPosition : function(point) {
|
setPosition : function(point) {
|
||||||
@ -114,34 +114,14 @@ mindplot.DragPivot = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setVisibility : function(value) {
|
setVisibility : function(value) {
|
||||||
if (this.isVisible() != value) {
|
|
||||||
|
|
||||||
var pivotRect = this._getPivotRect();
|
var pivotRect = this._getPivotRect();
|
||||||
pivotRect.setVisibility(value);
|
pivotRect.setVisibility(value);
|
||||||
|
|
||||||
var connectRect = this._connectRect;
|
var connectRect = this._connectRect;
|
||||||
connectRect.setVisibility(value);
|
connectRect.setVisibility(value);
|
||||||
|
if (this._line) {
|
||||||
var line = this._getConnectionLine();
|
this._line.setVisibility(value);
|
||||||
if (line) {
|
|
||||||
line.setVisibility(value);
|
|
||||||
}
|
}
|
||||||
this._isVisible = value;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// If the node is connected, validate that there is a line connecting both...
|
|
||||||
_getConnectionLine : function() {
|
|
||||||
var result = null;
|
|
||||||
var parentTopic = this._targetTopic;
|
|
||||||
if (parentTopic) {
|
|
||||||
if (parentTopic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
|
||||||
result = this._straightLine;
|
|
||||||
} else {
|
|
||||||
result = this._curvedLine;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addToWorkspace : function(workspace) {
|
addToWorkspace : function(workspace) {
|
||||||
@ -193,7 +173,14 @@ mindplot.DragPivot = new Class({
|
|||||||
$assert(targetTopic, 'parent can not be null');
|
$assert(targetTopic, 'parent can not be null');
|
||||||
|
|
||||||
this._position = position;
|
this._position = position;
|
||||||
|
|
||||||
this._targetTopic = targetTopic;
|
this._targetTopic = targetTopic;
|
||||||
|
if (targetTopic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
|
this._line = this._straightLine;
|
||||||
|
} else {
|
||||||
|
this._line = this._curvedLine;
|
||||||
|
}
|
||||||
|
this._line.setVisibility(true);
|
||||||
|
|
||||||
// Connected to Rect ...
|
// Connected to Rect ...
|
||||||
var connectRect = this._connectRect;
|
var connectRect = this._connectRect;
|
||||||
@ -224,5 +211,6 @@ mindplot.DragPivot = new Class({
|
|||||||
|
|
||||||
this.setVisibility(false);
|
this.setVisibility(false);
|
||||||
this._targetTopic = null;
|
this._targetTopic = null;
|
||||||
|
this._line = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -67,16 +67,6 @@ mindplot.DragTopic = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setVisibility:function(value) {
|
|
||||||
var dragPivot = this._getDragPivot();
|
|
||||||
dragPivot.setVisibility(value);
|
|
||||||
},
|
|
||||||
|
|
||||||
isVisible:function() {
|
|
||||||
var dragPivot = this._getDragPivot();
|
|
||||||
return dragPivot.isVisible();
|
|
||||||
},
|
|
||||||
|
|
||||||
getInnerShape : function() {
|
getInnerShape : function() {
|
||||||
return this._elem2d;
|
return this._elem2d;
|
||||||
},
|
},
|
||||||
@ -120,7 +110,6 @@ mindplot.DragTopic = new Class({
|
|||||||
var dragPivot = this._getDragPivot();
|
var dragPivot = this._getDragPivot();
|
||||||
var position = predict.position;
|
var position = predict.position;
|
||||||
dragPivot.connectTo(parent, position);
|
dragPivot.connectTo(parent, position);
|
||||||
dragPivot.setVisibility(true);
|
|
||||||
|
|
||||||
this.setOrder(predict.order);
|
this.setOrder(predict.order);
|
||||||
},
|
},
|
||||||
|
@ -1163,7 +1163,6 @@ mindplot.Topic = new Class({
|
|||||||
var targetTopic = this.getOutgoingConnectedTopic();
|
var targetTopic = this.getOutgoingConnectedTopic();
|
||||||
if ($defined(targetTopic)) {
|
if ($defined(targetTopic)) {
|
||||||
result.connectTo(targetTopic);
|
result.connectTo(targetTopic);
|
||||||
result.setVisibility(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a drag node is create for it, let's hide the editor.
|
// If a drag node is create for it, let's hide the editor.
|
||||||
|
Loading…
Reference in New Issue
Block a user