- Fix pivot issues.

This commit is contained in:
Paulo Veiga 2012-01-17 00:51:13 -03:00
parent e5beb4f034
commit 039b5d8c8a
3 changed files with 13 additions and 6 deletions

View File

@ -91,10 +91,13 @@ mindplot.Designer = new Class({
}.bind(this));
// Create nodes on double click...
screenManager.addEvent('dblclick', function() {
screenManager.addEvent('dblclick', function(event) {
if (workspace.isWorkspaceEventsEnabled()) {
var mousePos = screenManager.getWorkspaceMousePosition(event);
var centralTopic = this.getModel().getCentralTopic();
var model = this._createChildModel(centralTopic);
var model = this._createChildModel(centralTopic, mousePos);
this._actionDispatcher.addTopic(model, centralTopic.getId());
}
}.bind(this));
@ -326,7 +329,7 @@ mindplot.Designer = new Class({
},
_createChildModel : function(topic) {
_createChildModel : function(topic, mousePos) {
// Create a new node ...
var model = topic.getModel();
var mindmap = model.getMindmap();
@ -334,8 +337,9 @@ mindplot.Designer = new Class({
// Create a new node ...
var layoutManager = this._eventBussDispatcher.getLayoutManager();
var result = layoutManager.predict(topic.getId());
var result = layoutManager.predict(topic.getId(), mousePos);
childModel.setOrder(result.order);
console.log(result.order);
var position = result.position;
childModel.setPosition(position.x, position.y);

View File

@ -119,7 +119,9 @@ mindplot.DragPivot = new Class({
var connectRect = this._connectRect;
connectRect.setVisibility(value);
this._line.setVisibility(value);
if (this._line) {
this._line.setVisibility(value);
}
},
addToWorkspace : function(workspace) {
@ -178,6 +180,7 @@ mindplot.DragPivot = new Class({
} else {
this._line = this._curvedLine;
}
this._line.setVisibility(true);
// Connected to Rect ...
var connectRect = this._connectRect;

View File

@ -59,7 +59,7 @@ mindplot.layout.LayoutManager = new Class({
var node = this._treeSet.find(id);
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) {