mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-29 09:04:54 +01:00
- Fix pivot issues.
This commit is contained in:
parent
e5beb4f034
commit
039b5d8c8a
@ -91,10 +91,13 @@ mindplot.Designer = new Class({
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
// Create nodes on double click...
|
// Create nodes on double click...
|
||||||
screenManager.addEvent('dblclick', function() {
|
screenManager.addEvent('dblclick', function(event) {
|
||||||
if (workspace.isWorkspaceEventsEnabled()) {
|
if (workspace.isWorkspaceEventsEnabled()) {
|
||||||
|
|
||||||
|
var mousePos = screenManager.getWorkspaceMousePosition(event);
|
||||||
|
|
||||||
var centralTopic = this.getModel().getCentralTopic();
|
var centralTopic = this.getModel().getCentralTopic();
|
||||||
var model = this._createChildModel(centralTopic);
|
var model = this._createChildModel(centralTopic, mousePos);
|
||||||
this._actionDispatcher.addTopic(model, centralTopic.getId());
|
this._actionDispatcher.addTopic(model, centralTopic.getId());
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
@ -326,7 +329,7 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_createChildModel : function(topic) {
|
_createChildModel : function(topic, mousePos) {
|
||||||
// Create a new node ...
|
// Create a new node ...
|
||||||
var model = topic.getModel();
|
var model = topic.getModel();
|
||||||
var mindmap = model.getMindmap();
|
var mindmap = model.getMindmap();
|
||||||
@ -334,8 +337,9 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
// Create a new node ...
|
// Create a new node ...
|
||||||
var layoutManager = this._eventBussDispatcher.getLayoutManager();
|
var layoutManager = this._eventBussDispatcher.getLayoutManager();
|
||||||
var result = layoutManager.predict(topic.getId());
|
var result = layoutManager.predict(topic.getId(), mousePos);
|
||||||
childModel.setOrder(result.order);
|
childModel.setOrder(result.order);
|
||||||
|
console.log(result.order);
|
||||||
|
|
||||||
var position = result.position;
|
var position = result.position;
|
||||||
childModel.setPosition(position.x, position.y);
|
childModel.setPosition(position.x, position.y);
|
||||||
|
@ -119,7 +119,9 @@ mindplot.DragPivot = new Class({
|
|||||||
|
|
||||||
var connectRect = this._connectRect;
|
var connectRect = this._connectRect;
|
||||||
connectRect.setVisibility(value);
|
connectRect.setVisibility(value);
|
||||||
this._line.setVisibility(value);
|
if (this._line) {
|
||||||
|
this._line.setVisibility(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addToWorkspace : function(workspace) {
|
addToWorkspace : function(workspace) {
|
||||||
@ -178,6 +180,7 @@ mindplot.DragPivot = new Class({
|
|||||||
} else {
|
} else {
|
||||||
this._line = this._curvedLine;
|
this._line = this._curvedLine;
|
||||||
}
|
}
|
||||||
|
this._line.setVisibility(true);
|
||||||
|
|
||||||
// Connected to Rect ...
|
// Connected to Rect ...
|
||||||
var connectRect = this._connectRect;
|
var connectRect = this._connectRect;
|
||||||
|
@ -59,7 +59,7 @@ mindplot.layout.LayoutManager = new Class({
|
|||||||
|
|
||||||
var node = this._treeSet.find(id);
|
var node = this._treeSet.find(id);
|
||||||
node.setFree(true);
|
node.setFree(true);
|
||||||
node.setFreeDisplacement({x:position.x - node.getPosition().x, y:position.y-node.getPosition().y});
|
node.setFreeDisplacement({x:position.x - node.getPosition().x, y:position.y - node.getPosition().y});
|
||||||
},
|
},
|
||||||
|
|
||||||
connectNode: function(parentId, childId, order) {
|
connectNode: function(parentId, childId, order) {
|
||||||
|
Loading…
Reference in New Issue
Block a user