mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 07:44:56 +01:00
Add a sibling below (not opposite) for first-level nodes
This commit is contained in:
parent
eb6aac4a5e
commit
071192fcba
@ -300,7 +300,7 @@ mindplot.Designer = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
createChildForSelectedNode : function() {
|
createChildForSelectedNode : function() {
|
||||||
|
console.log("createChildForSelectedNode"); //TODO(gb): Remove trace!!!
|
||||||
var nodes = this.getModel().filterSelectedTopics();
|
var nodes = this.getModel().filterSelectedTopics();
|
||||||
if (nodes.length <= 0) {
|
if (nodes.length <= 0) {
|
||||||
// If there are more than one node selected,
|
// If there are more than one node selected,
|
||||||
@ -369,8 +369,8 @@ mindplot.Designer = new Class({
|
|||||||
createSiblingForSelectedNode : function() {
|
createSiblingForSelectedNode : function() {
|
||||||
var nodes = this.getModel().filterSelectedTopics();
|
var nodes = this.getModel().filterSelectedTopics();
|
||||||
if (nodes.length <= 0) {
|
if (nodes.length <= 0) {
|
||||||
// If there are more than one node selected,
|
// If there are no nodes selected,
|
||||||
$notify('Could not create a topic. Only one node must be selected.');
|
$notify('Could not create a topic. At least one node must be selected.');
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -388,6 +388,13 @@ mindplot.Designer = new Class({
|
|||||||
} else {
|
} else {
|
||||||
var parentTopic = topic.getOutgoingConnectedTopic();
|
var parentTopic = topic.getOutgoingConnectedTopic();
|
||||||
var siblingModel = this._createSiblingModel(topic);
|
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();
|
var parentTopicId = parentTopic.getId();
|
||||||
|
|
||||||
this._actionDispatcher.addTopic(siblingModel, parentTopicId, true);
|
this._actionDispatcher.addTopic(siblingModel, parentTopicId, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user