mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-29 17:04:59 +01:00
- Fix undo of multiple nodes.
This commit is contained in:
parent
acd149bfc9
commit
0dafb4b31b
@ -76,20 +76,30 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
|
|
||||||
undoExecute:function (commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
|
|
||||||
var parent = commandContext.findTopics(this._parentTopicIds);
|
// Add all the topics ...
|
||||||
|
this._deletedTopicModels.each(function (model) {
|
||||||
|
commandContext.createTopic(model);
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
// Do they need to be connected ?
|
||||||
this._deletedTopicModels.each(function (model, index) {
|
this._deletedTopicModels.each(function (model, index) {
|
||||||
var topic = commandContext.createTopic(model);
|
var topicModel = this._deletedTopicModels[index];
|
||||||
|
var topics = commandContext.findTopics(topicModel.getId());
|
||||||
|
|
||||||
// Was the topic connected?
|
var parentId = this._parentTopicIds[index];
|
||||||
var parentTopic = parent[index];
|
if (parentId) {
|
||||||
if (parentTopic != null) {
|
var parentTopics = commandContext.findTopics(parentId);
|
||||||
commandContext.connect(topic, parentTopic);
|
commandContext.connect(topics[0], parentTopics[0]);
|
||||||
topic.setOnFocus(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
||||||
|
// Focus on last recovered topic ..
|
||||||
|
var firstTopic = this._deletedTopicModels[0];
|
||||||
|
var topic = commandContext.findTopics(firstTopic.getId())[0];
|
||||||
|
topic.setOnFocus(true);
|
||||||
|
|
||||||
|
// Add rebuild relationships ...
|
||||||
this._deletedRelModel.each(function (model) {
|
this._deletedRelModel.each(function (model) {
|
||||||
commandContext.addRelationship(model);
|
commandContext.addRelationship(model);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
Loading…
Reference in New Issue
Block a user