mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 23:44:54 +01:00
Integrate free positioning predict on drag.
This commit is contained in:
parent
d8e05d7ce0
commit
b9638b4c99
@ -137,7 +137,6 @@ mindplot.Designer = new Class({
|
||||
if (!dragTopic.isVisible() && dragTopic.isConnected()) {
|
||||
dragTopic.setVisibility(true);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -34,26 +34,31 @@ mindplot.DragTopic = new Class({
|
||||
},
|
||||
|
||||
setPosition : function(x, y) {
|
||||
this._position.setValue(x, y);
|
||||
// Update drag shadow position ....
|
||||
var position = {x:x,y:y};
|
||||
if (this.isFreeLayoutOn() && this.isConnected()) {
|
||||
var _layoutManager = designer._eventBussDispatcher._layoutManager;
|
||||
var par = this.getConnectedToTopic();
|
||||
position = _layoutManager.predict(par.getId(), position, true).position;
|
||||
}
|
||||
this._position.setValue(position.x, position.y);
|
||||
|
||||
// Elements are positioned in the center.
|
||||
// All topic element must be positioned based on the innerShape.
|
||||
var draggedNode = this._draggedNode;
|
||||
var size = draggedNode.getSize();
|
||||
|
||||
var cx = Math.ceil(x - (size.width / 2));
|
||||
var cy = Math.ceil(y - (size.height / 2));
|
||||
|
||||
// Update visual position.
|
||||
var cx = Math.ceil(position.x - (size.width / 2));
|
||||
var cy = Math.ceil(position.y - (size.height / 2));
|
||||
this._elem2d.setPosition(cx, cy);
|
||||
|
||||
// In case is not free, pivot must be draw ...
|
||||
if (this.isConnected() && !this.isFreeLayoutOn()) {
|
||||
var parent = this.getConnectedToTopic();
|
||||
var predict = designer._eventBussDispatcher._layoutManager.predict(parent.getId(), this.getPosition());
|
||||
if (this._order != predict.order) {
|
||||
var dragPivot = this._getDragPivot();
|
||||
var position = predict.position;
|
||||
dragPivot.connectTo(parent, position);
|
||||
var pivotPosition = predict.position;
|
||||
dragPivot.connectTo(parent, pivotPosition);
|
||||
this.setOrder(predict.order);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user