Fix missing migrated event...

This commit is contained in:
Paulo Veiga
2011-08-05 01:34:51 -03:00
parent 36e44c13ca
commit b15ff84a94
7 changed files with 39 additions and 27 deletions

View File

@@ -94,8 +94,14 @@ mindplot.ActionDispatcher = new Class({
changeFontWeightToTopic : function(topicsIds) {
throw "method must be implemented.";
},
changeTextOnTopic : function(topicsIds, text) {
throw "method must be implemented.";
},
shrinkBranch : function(topicsIds, collapse)
{
throw "method must be implemented.";
}
});

View File

@@ -201,8 +201,11 @@ mindplot.DragPivot = new Class({
// Connected to Rect ...
var connectRect = this._connectRect;
var targetSize = targetTopic.getSize();
var width = targetSize.width;
var height = targetSize.height;
// Add 4 pixel in order to keep create a rect bigger than the topic.
var width = targetSize.width + 4;
var height = targetSize.height + 4;
connectRect.setSize(width, height);
var targetPosition = targetTopic.getPosition();

View File

@@ -71,7 +71,8 @@ mindplot.DragTopicPositioner = new Class({
// Finally, connect nodes ...
if (!dragTopic.isConnected()) {
var centalTopic = topics[0];
if ($defined(mainTopicToMainTopicConnection)) {
if ($defined(mainTopicToMainTopicConnection))
{
dragTopic.connectTo(mainTopicToMainTopicConnection);
} else if (Math.abs(dragTopic.getPosition().x - centalTopic.getPosition().x) <= mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) {
dragTopic.connectTo(centalTopic);
@@ -82,7 +83,6 @@ mindplot.DragTopicPositioner = new Class({
_lookUpForMainTopicToMainTopicConnection : function(dragTopic) {
var topics = this._topics;
var result = null;
var clouserDistance = -1;
var draggedNode = dragTopic.getDraggedTopic();
var distance = null;

View File

@@ -220,6 +220,18 @@ mindplot.LocalActionDispatcher = new Class({
this.execute(command);
},
shrinkBranch : function(topicsIds, collapse) {
$assert(topicsIds, "topicsIds can not be null");
var commandFunc = function(topic, isShrink) {
topic.setChildrenShrinked(isShrink);
return !isShrink;
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, collapse);
this.execute(command);
},
execute:function(command) {
this._actionRunner.execute(command);
}

View File

@@ -26,18 +26,11 @@ mindplot.ShirinkConnector = new Class({
elipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH);
elipse.addEventListener('click', function(event) {
var model = topic.getModel();
var isShrink = !model.areChildrenShrinked();
var collapse = !model.areChildrenShrinked();
var actionRunner = mindplot.DesignerActionRunner.getInstance();
var topicId = topic.getId();
var commandFunc = function(topic, isShrink) {
topic.setChildrenShrinked(isShrink);
return !isShrink;
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, isShrink, [topicId]);
actionRunner.execute(command);
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
actionDispatcher.shrinkBranch([topicId],collapse);
var e = new Event(event).stop();
e.preventDefault();