-Fix Uncaught RangeError: Maximum call stack size exceeded, line:114

This commit is contained in:
Paulo Gustavo Veiga 2012-09-02 19:52:37 -03:00
parent 04a221799a
commit ca37d3f384
2 changed files with 127 additions and 109 deletions

View File

@ -57,8 +57,13 @@ mindplot.DragConnector = new Class({
// - Exclude dragged topic // - Exclude dragged topic
// - Exclude dragTopic pivot // - Exclude dragTopic pivot
// - Nodes that are collapsed // - Nodes that are collapsed
// - It's not part of the branch dragged itself
topics = topics.filter(function (topic) { topics = topics.filter(function (topic) {
return draggedNode != topic && topic != draggedNode && !topic.areChildrenShrunken() && !topic.isCollapsed(); var result = draggedNode != topic;
result = result && topic != draggedNode;
result = result && !topic.areChildrenShrunken() && !topic.isCollapsed();
result = result && !draggedNode.isChildTopic(topic);
return result;
}); });
// Filter all the nodes that are outside the vertical boundary: // Filter all the nodes that are outside the vertical boundary:

View File

@ -669,7 +669,6 @@ mindplot.Topic = new Class({
showNoteEditor:function () { showNoteEditor:function () {
var topicId = this.getId(); var topicId = this.getId();
var model = this.getModel(); var model = this.getModel();
var editorModel = { var editorModel = {
@ -1198,8 +1197,22 @@ mindplot.Topic = new Class({
result = result.concat(innerChilds); result = result.concat(innerChilds);
} }
return result; return result;
} },
isChildTopic:function (childTopic) {
var result = (this.getId() == childTopic.getId());
if (!result) {
var children = this.getChildren();
for (var i = 0; i < children.length; i++) {
var parent = children[i];
result = parent.isChildTopic(childTopic);
if (result) {
break;
}
}
}
return result;
}
}); });