From 071192fcba3b92a8f2e97dbd08b18b12ab7e7306 Mon Sep 17 00:00:00 2001 From: Gonzalo Bellver Date: Wed, 14 Mar 2012 17:47:59 -0300 Subject: [PATCH] Add a sibling below (not opposite) for first-level nodes --- mindplot/src/main/javascript/Designer.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index b1bb69f4..1c5ffe9a 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -300,7 +300,7 @@ mindplot.Designer = new Class({ }, createChildForSelectedNode : function() { - + console.log("createChildForSelectedNode"); //TODO(gb): Remove trace!!! var nodes = this.getModel().filterSelectedTopics(); if (nodes.length <= 0) { // If there are more than one node selected, @@ -369,8 +369,8 @@ mindplot.Designer = new Class({ createSiblingForSelectedNode : function() { var nodes = this.getModel().filterSelectedTopics(); if (nodes.length <= 0) { - // If there are more than one node selected, - $notify('Could not create a topic. Only one node must be selected.'); + // If there are no nodes selected, + $notify('Could not create a topic. At least one node must be selected.'); return; } @@ -388,6 +388,13 @@ mindplot.Designer = new Class({ } else { var parentTopic = topic.getOutgoingConnectedTopic(); var siblingModel = this._createSiblingModel(topic); + + // Hack: if parent is central topic, add node below not on opposite side. + // This should be done in the layout + if (parentTopic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) { + siblingModel.setOrder(topic.getOrder() + 2); + } + var parentTopicId = parentTopic.getId(); this._actionDispatcher.addTopic(siblingModel, parentTopicId, true);