From 2e49219fb9374f8d49599ebd20659cfe373b4696 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Wed, 18 Jan 2012 01:32:55 -0300 Subject: [PATCH] Free positioning working ... --- mindplot/src/main/javascript/DragTopic.js | 9 +++++++-- .../src/main/javascript/StandaloneActionDispatcher.js | 7 ++++--- .../src/main/javascript/layout/EventBusDispatcher.js | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mindplot/src/main/javascript/DragTopic.js b/mindplot/src/main/javascript/DragTopic.js index da1b08fa..25363c3b 100644 --- a/mindplot/src/main/javascript/DragTopic.js +++ b/mindplot/src/main/javascript/DragTopic.js @@ -46,7 +46,7 @@ mindplot.DragTopic = new Class({ // Update visual position. this._elem2d.setPosition(cx, cy); - if (this.isConnected()) { + if (this.isConnected() && !this.isFreeLayoutOn()) { var parent = this.getConnectedToTopic(); var predict = designer._eventBussDispatcher._layoutManager.predict(parent.getId(), this.getPosition()); if (this._order != predict.order) { @@ -59,7 +59,12 @@ mindplot.DragTopic = new Class({ }, 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() { diff --git a/mindplot/src/main/javascript/StandaloneActionDispatcher.js b/mindplot/src/main/javascript/StandaloneActionDispatcher.js index 08737bd8..ed9d1403 100644 --- a/mindplot/src/main/javascript/StandaloneActionDispatcher.js +++ b/mindplot/src/main/javascript/StandaloneActionDispatcher.js @@ -74,8 +74,9 @@ mindplot.StandaloneActionDispatcher = new Class({ }; var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicId, position); - this._actionRunner.execute(command); + this.execute(command); }, + moveControlPoint: function(ctrlPoint, point) { var command = new mindplot.commands.MoveControlPointCommand(ctrlPoint, point); this.execute(command); @@ -104,7 +105,7 @@ mindplot.StandaloneActionDispatcher = new Class({ return result; }; 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); - this._actionRunner.execute(command); + this.execute(command); }, changeFontFamilyToTopic: function(topicIds, fontFamily) { diff --git a/mindplot/src/main/javascript/layout/EventBusDispatcher.js b/mindplot/src/main/javascript/layout/EventBusDispatcher.js index 87ebe1e9..0e50c98b 100644 --- a/mindplot/src/main/javascript/layout/EventBusDispatcher.js +++ b/mindplot/src/main/javascript/layout/EventBusDispatcher.js @@ -65,7 +65,7 @@ mindplot.layout.EventBusDispatcher = new Class({ }, _nodeAdded: function(node) { - // Centra topic must not be added twice ... + // Central topic must not be added twice ... if (node.getId() != 0) { this._layoutManager.addNode(node.getId(), {width:10,height:10}, node.getPosition()); this._layoutManager.updateShrinkState(node.getId(), node.areChildrenShrunken());