Free positioning working ...

This commit is contained in:
Paulo Veiga 2012-01-18 01:32:55 -03:00
parent f0eb293211
commit 2e49219fb9
3 changed files with 12 additions and 6 deletions

View File

@ -46,7 +46,7 @@ mindplot.DragTopic = new Class({
// Update visual position. // Update visual position.
this._elem2d.setPosition(cx, cy); this._elem2d.setPosition(cx, cy);
if (this.isConnected()) { if (this.isConnected() && !this.isFreeLayoutOn()) {
var parent = this.getConnectedToTopic(); var parent = this.getConnectedToTopic();
var predict = designer._eventBussDispatcher._layoutManager.predict(parent.getId(), this.getPosition()); var predict = designer._eventBussDispatcher._layoutManager.predict(parent.getId(), this.getPosition());
if (this._order != predict.order) { if (this._order != predict.order) {
@ -59,7 +59,12 @@ mindplot.DragTopic = new Class({
}, },
updateFreeLayout: function(event) { updateFreeLayout: function(event) {
this._isFreeLayoutEnabled = (event.meta && Browser.Platform.mac) || (event.control && !Browser.Platform.mac); var isFreeEnabled = (event.meta && Browser.Platform.mac) || (event.control && !Browser.Platform.mac);
if (this.isFreeLayoutOn() != isFreeEnabled) {
var dragPivot = this._getDragPivot();
dragPivot.setVisibility(!isFreeEnabled);
this._isFreeLayoutEnabled = isFreeEnabled;
}
}, },
getInnerShape : function() { getInnerShape : function() {

View File

@ -74,8 +74,9 @@ mindplot.StandaloneActionDispatcher = new Class({
}; };
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicId, position); var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicId, position);
this._actionRunner.execute(command); this.execute(command);
}, },
moveControlPoint: function(ctrlPoint, point) { moveControlPoint: function(ctrlPoint, point) {
var command = new mindplot.commands.MoveControlPointCommand(ctrlPoint, point); var command = new mindplot.commands.MoveControlPointCommand(ctrlPoint, point);
this.execute(command); this.execute(command);
@ -104,7 +105,7 @@ mindplot.StandaloneActionDispatcher = new Class({
return result; return result;
}; };
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds); var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
this._actionRunner.execute(command); this.execute(command);
}, },
@ -118,7 +119,7 @@ mindplot.StandaloneActionDispatcher = new Class({
}; };
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text); var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text);
this._actionRunner.execute(command); this.execute(command);
}, },
changeFontFamilyToTopic: function(topicIds, fontFamily) { changeFontFamilyToTopic: function(topicIds, fontFamily) {

View File

@ -65,7 +65,7 @@ mindplot.layout.EventBusDispatcher = new Class({
}, },
_nodeAdded: function(node) { _nodeAdded: function(node) {
// Centra topic must not be added twice ... // Central topic must not be added twice ...
if (node.getId() != 0) { if (node.getId() != 0) {
this._layoutManager.addNode(node.getId(), {width:10,height:10}, node.getPosition()); this._layoutManager.addNode(node.getId(), {width:10,height:10}, node.getPosition());
this._layoutManager.updateShrinkState(node.getId(), node.areChildrenShrunken()); this._layoutManager.updateShrinkState(node.getId(), node.areChildrenShrunken());