mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 20:03:48 +01:00
replacing old .each mootools' method by _.each
This commit is contained in:
parent
a0e3c74921
commit
2ab488bfa6
@ -129,7 +129,7 @@ mindplot.Designer = new Class({
|
|||||||
screenManager.addEvent('update', function () {
|
screenManager.addEvent('update', function () {
|
||||||
// Topic must be set to his original state. All editors must be closed.
|
// Topic must be set to his original state. All editors must be closed.
|
||||||
var topics = this.getModel().getTopics();
|
var topics = this.getModel().getTopics();
|
||||||
topics.each(function (object) {
|
_.each(topics, function(object){
|
||||||
object.closeEditors();
|
object.closeEditors();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -309,13 +309,13 @@ mindplot.Designer = new Class({
|
|||||||
onObjectFocusEvent:function (currentObject, event) {
|
onObjectFocusEvent:function (currentObject, event) {
|
||||||
// Close node editors ..
|
// Close node editors ..
|
||||||
var topics = this.getModel().getTopics();
|
var topics = this.getModel().getTopics();
|
||||||
topics.each(function (topic) {
|
_.each(topics, function(topic) {
|
||||||
topic.closeEditors();
|
topic.closeEditors();
|
||||||
});
|
});
|
||||||
|
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var objects = model.getEntities();
|
var objects = model.getEntities();
|
||||||
objects.each(function (object) {
|
_.each(objects, function(object) {
|
||||||
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
||||||
if (!$defined(event) || (!event.control && !event.meta)) {
|
if (!$defined(event) || (!event.control && !event.meta)) {
|
||||||
if (object.isOnFocus() && object != currentObject) {
|
if (object.isOnFocus() && object != currentObject) {
|
||||||
@ -329,14 +329,14 @@ mindplot.Designer = new Class({
|
|||||||
selectAll:function () {
|
selectAll:function () {
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var objects = model.getEntities();
|
var objects = model.getEntities();
|
||||||
objects.each(function (object) {
|
_.each(objects, function(object) {
|
||||||
object.setOnFocus(true);
|
object.setOnFocus(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deselectAll:function () {
|
deselectAll:function () {
|
||||||
var objects = this.getModel().getEntities();
|
var objects = this.getModel().getEntities();
|
||||||
objects.each(function (object) {
|
_.each(objects, function (object) {
|
||||||
object.setOnFocus(false);
|
object.setOnFocus(false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -26,7 +26,7 @@ mindplot.Events = new Class({
|
|||||||
var events = this.$events[type];
|
var events = this.$events[type];
|
||||||
if (!events) return this;
|
if (!events) return this;
|
||||||
args = Array.from(args);
|
args = Array.from(args);
|
||||||
events.each(function(fn){
|
_.each(events, function(fn){
|
||||||
if (delay) fn.delay(delay, this, args);
|
if (delay) fn.delay(delay, this, args);
|
||||||
else fn.apply(this, args);
|
else fn.apply(this, args);
|
||||||
}, this);
|
}, this);
|
||||||
|
@ -72,7 +72,7 @@ mindplot.IconGroup = new Class({
|
|||||||
|
|
||||||
_findIconFromModel:function (iconModel) {
|
_findIconFromModel:function (iconModel) {
|
||||||
var result = null;
|
var result = null;
|
||||||
this._icons.each(function (icon) {
|
_.each(this._icons, function (icon) {
|
||||||
var elModel = icon.getModel();
|
var elModel = icon.getModel();
|
||||||
if (elModel.getId() == iconModel.getId()) {
|
if (elModel.getId() == iconModel.getId()) {
|
||||||
result = icon;
|
result = icon;
|
||||||
@ -103,7 +103,7 @@ mindplot.IconGroup = new Class({
|
|||||||
this._resize(this._icons.length);
|
this._resize(this._icons.length);
|
||||||
|
|
||||||
// Add all again ...
|
// Add all again ...
|
||||||
this._icons.each(function (elem, i) {
|
_.each(this._icons, function (elem, i) {
|
||||||
this._positionIcon(elem, i);
|
this._positionIcon(elem, i);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
@ -126,7 +126,7 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
|
|
||||||
var lines = textElem.value.split('\n');
|
var lines = textElem.value.split('\n');
|
||||||
var maxLineLength = 1;
|
var maxLineLength = 1;
|
||||||
lines.each(function (line) {
|
_.each(lines, function (line) {
|
||||||
if (maxLineLength < line.length)
|
if (maxLineLength < line.length)
|
||||||
maxLineLength = line.length;
|
maxLineLength = line.length;
|
||||||
});
|
});
|
||||||
|
@ -65,7 +65,7 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
// Register focus events on all topics ...
|
// Register focus events on all topics ...
|
||||||
var model = this._designer.getModel();
|
var model = this._designer.getModel();
|
||||||
var topics = model.getTopics();
|
var topics = model.getTopics();
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
topic.addEvent('ontfocus', this._onTopicClick);
|
topic.addEvent('ontfocus', this._onTopicClick);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
|
|
||||||
var model = this._designer.getModel();
|
var model = this._designer.getModel();
|
||||||
var topics = model.getTopics();
|
var topics = model.getTopics();
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
topic.removeEvent('ontfocus', this._onTopicClick);
|
topic.removeEvent('ontfocus', this._onTopicClick);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ mindplot.ScreenManager = new Class({
|
|||||||
|
|
||||||
fireEvent : function(type, event) {
|
fireEvent : function(type, event) {
|
||||||
if (type == 'click') {
|
if (type == 'click') {
|
||||||
this._clickEvents.each(function(listener) {
|
_.each(this._clickEvents, function(listener) {
|
||||||
listener(type, event);
|
listener(type, event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ mindplot.Topic = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_setRelationshipLinesVisibility:function (value) {
|
_setRelationshipLinesVisibility:function (value) {
|
||||||
this._relationships.each(function (relationship) {
|
_.each(this._relationships, function (relationship) {
|
||||||
var sourceTopic = relationship.getSourceTopic();
|
var sourceTopic = relationship.getSourceTopic();
|
||||||
var targetTopic = relationship.getTargetTopic();
|
var targetTopic = relationship.getTargetTopic();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ mindplot.commands.AddTopicCommand = new Class({
|
|||||||
|
|
||||||
execute:function (commandContext) {
|
execute:function (commandContext) {
|
||||||
|
|
||||||
this._models.each(function (model, index) {
|
_.each(this._models, function (model, index) {
|
||||||
|
|
||||||
// Add a new topic ...
|
// Add a new topic ...
|
||||||
var topic = commandContext.createTopic(model);
|
var topic = commandContext.createTopic(model);
|
||||||
@ -59,12 +59,12 @@ mindplot.commands.AddTopicCommand = new Class({
|
|||||||
undoExecute:function (commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
// Delete disconnected the nodes. Create a copy of the topics ...
|
// Delete disconnected the nodes. Create a copy of the topics ...
|
||||||
var clonedModel = [];
|
var clonedModel = [];
|
||||||
this._models.each(function (model) {
|
_.each(this._models, function (model) {
|
||||||
clonedModel.push(model.clone());
|
clonedModel.push(model.clone());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Finally, remove the nodes ...
|
// Finally, remove the nodes ...
|
||||||
this._models.each(function (model) {
|
_.each(this._models, function (model) {
|
||||||
|
|
||||||
var topicId = model.getId();
|
var topicId = model.getId();
|
||||||
var topic = commandContext.findTopics(topicId)[0];
|
var topic = commandContext.findTopics(topicId)[0];
|
||||||
|
@ -35,7 +35,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
var topics = this._filterChildren(this._topicIds, commandContext);
|
var topics = this._filterChildren(this._topicIds, commandContext);
|
||||||
|
|
||||||
if (topics.length > 0) {
|
if (topics.length > 0) {
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
// In case that it's editing text node, force close without update ...
|
// In case that it's editing text node, force close without update ...
|
||||||
topic.closeEditors();
|
topic.closeEditors();
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
return rel.getModel().clone();
|
return rel.getModel().clone();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
relationships.each(function (relationship) {
|
_.each(relationships, function (relationship) {
|
||||||
commandContext.deleteRelationship(relationship);
|
commandContext.deleteRelationship(relationship);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
|
|
||||||
var rels = commandContext.findRelationships(this._relIds);
|
var rels = commandContext.findRelationships(this._relIds);
|
||||||
if (rels.length > 0) {
|
if (rels.length > 0) {
|
||||||
rels.each(function (rel) {
|
_.each(rels, function (rel) {
|
||||||
this._deletedRelModel.push(rel.getModel().clone());
|
this._deletedRelModel.push(rel.getModel().clone());
|
||||||
commandContext.deleteRelationship(rel);
|
commandContext.deleteRelationship(rel);
|
||||||
}, this);
|
}, this);
|
||||||
@ -79,12 +79,12 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
undoExecute:function (commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
|
|
||||||
// Add all the topics ...
|
// Add all the topics ...
|
||||||
this._deletedTopicModels.each(function (model) {
|
_.each(this._deletedTopicModels, function (model) {
|
||||||
commandContext.createTopic(model);
|
commandContext.createTopic(model);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// Do they need to be connected ?
|
// Do they need to be connected ?
|
||||||
this._deletedTopicModels.each(function (topicModel, index) {
|
_.each(this._deletedTopicModels, function (topicModel, index) {
|
||||||
var topics = commandContext.findTopics(topicModel.getId());
|
var topics = commandContext.findTopics(topicModel.getId());
|
||||||
|
|
||||||
var parentId = this._parentTopicIds[index];
|
var parentId = this._parentTopicIds[index];
|
||||||
@ -95,12 +95,12 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// Add rebuild relationships ...
|
// Add rebuild relationships ...
|
||||||
this._deletedRelModel.each(function (model) {
|
_.each(this._deletedRelModel, function (model) {
|
||||||
commandContext.addRelationship(model);
|
commandContext.addRelationship(model);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
// Finally display the topics ...
|
// Finally display the topics ...
|
||||||
this._deletedTopicModels.each(function (topicModel) {
|
_.each(this._deletedTopicModels, function (topicModel) {
|
||||||
var topics = commandContext.findTopics(topicModel.getId());
|
var topics = commandContext.findTopics(topicModel.getId());
|
||||||
topics[0].setBranchVisibility(true);
|
topics[0].setBranchVisibility(true);
|
||||||
}, this);
|
}, this);
|
||||||
@ -121,7 +121,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
var topics = commandContext.findTopics(topicIds);
|
var topics = commandContext.findTopics(topicIds);
|
||||||
|
|
||||||
var result = [];
|
var result = [];
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
var parent = topic.getParent();
|
var parent = topic.getParent();
|
||||||
var found = false;
|
var found = false;
|
||||||
while (parent != null && !found) {
|
while (parent != null && !found) {
|
||||||
|
@ -46,7 +46,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (topics != null) {
|
if (topics != null) {
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
var oldValue = this._commandFunc(topic, this._value);
|
var oldValue = this._commandFunc(topic, this._value);
|
||||||
this._oldValues.push(oldValue);
|
this._oldValues.push(oldValue);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
@ -62,7 +62,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
undoExecute:function (commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
if (this.applied) {
|
if (this.applied) {
|
||||||
var topics = commandContext.findTopics(this._topicsId);
|
var topics = commandContext.findTopics(this._topicsId);
|
||||||
topics.each(function (topic, index) {
|
_.each(topics, function (topic, index) {
|
||||||
this._commandFunc(topic, this._oldValues[index]);
|
this._commandFunc(topic, this._oldValues[index]);
|
||||||
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -38,7 +38,7 @@ mindplot.layout.AbstractBasicSorter = new Class({
|
|||||||
result = height;
|
result = height;
|
||||||
} else {
|
} else {
|
||||||
var childrenHeight = 0;
|
var childrenHeight = 0;
|
||||||
children.each(function(child) {
|
_.each(children, function(child) {
|
||||||
childrenHeight += this._computeChildrenHeight(treeSet, child, heightCache);
|
childrenHeight += this._computeChildrenHeight(treeSet, child, heightCache);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ mindplot.layout.BalancedSorter = new Class({
|
|||||||
var result = null;
|
var result = null;
|
||||||
var last = children.getLast();
|
var last = children.getLast();
|
||||||
position = position || {x:last.getPosition().x, y:last.getPosition().y + 1};
|
position = position || {x:last.getPosition().x, y:last.getPosition().y + 1};
|
||||||
children.each(function (child, index) {
|
_.each(children, function (child, index) {
|
||||||
var cpos = child.getPosition();
|
var cpos = child.getPosition();
|
||||||
if (position.y > cpos.y) {
|
if (position.y > cpos.y) {
|
||||||
yOffset = child == last ?
|
yOffset = child == last ?
|
||||||
@ -129,7 +129,7 @@ mindplot.layout.BalancedSorter = new Class({
|
|||||||
// Filter nodes on one side..
|
// Filter nodes on one side..
|
||||||
var children = this._getChildrenForOrder(parent, treeSet, node.getOrder());
|
var children = this._getChildrenForOrder(parent, treeSet, node.getOrder());
|
||||||
|
|
||||||
children.each(function (child, index) {
|
_.each(children, function (child, index) {
|
||||||
if (child.getOrder() > node.getOrder()) {
|
if (child.getOrder() > node.getOrder()) {
|
||||||
child.setOrder(child.getOrder() - 2);
|
child.setOrder(child.getOrder() - 2);
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ mindplot.layout.BalancedSorter = new Class({
|
|||||||
var totalPHeight = 0;
|
var totalPHeight = 0;
|
||||||
var totalNHeight = 0;
|
var totalNHeight = 0;
|
||||||
|
|
||||||
heights.each(function (elem) {
|
_.each(heights, function (elem) {
|
||||||
if (elem.order % 2 == 0) {
|
if (elem.order % 2 == 0) {
|
||||||
totalPHeight += elem.height;
|
totalPHeight += elem.height;
|
||||||
} else {
|
} else {
|
||||||
|
@ -145,7 +145,7 @@ mindplot.layout.LayoutManager = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_flushEvents: function() {
|
_flushEvents: function() {
|
||||||
this._events.each(function(event) {
|
_.each(this._events, function(event) {
|
||||||
this.fireEvent('change', event);
|
this.fireEvent('change', event);
|
||||||
}, this);
|
}, this);
|
||||||
this._events = [];
|
this._events = [];
|
||||||
@ -155,7 +155,7 @@ mindplot.layout.LayoutManager = new Class({
|
|||||||
if (!nodes)
|
if (!nodes)
|
||||||
nodes = this._treeSet.getTreeRoots();
|
nodes = this._treeSet.getTreeRoots();
|
||||||
|
|
||||||
nodes.each(function(node) {
|
_.each(nodes, function(node) {
|
||||||
if (node.hasOrderChanged() || node.hasPositionChanged()) {
|
if (node.hasOrderChanged() || node.hasPositionChanged()) {
|
||||||
|
|
||||||
// Find or create a event ...
|
// Find or create a event ...
|
||||||
|
@ -70,7 +70,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
|
|
||||||
layout:function () {
|
layout:function () {
|
||||||
var roots = this._treeSet.getTreeRoots();
|
var roots = this._treeSet.getTreeRoots();
|
||||||
roots.each(function (node) {
|
_.each(roots, function (node) {
|
||||||
|
|
||||||
// Calculate all node heights ...
|
// Calculate all node heights ...
|
||||||
var sorter = node.getSorter();
|
var sorter = node.getSorter();
|
||||||
@ -108,7 +108,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
var offsetById = sorter.computeOffsets(this._treeSet, node);
|
var offsetById = sorter.computeOffsets(this._treeSet, node);
|
||||||
var parentPosition = node.getPosition();
|
var parentPosition = node.getPosition();
|
||||||
|
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
var offset = offsetById[child.getId()];
|
var offset = offsetById[child.getId()];
|
||||||
|
|
||||||
var childFreeDisplacement = child.getFreeDisplacement();
|
var childFreeDisplacement = child.getFreeDisplacement();
|
||||||
@ -133,7 +133,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Continue reordering the children nodes ...
|
// Continue reordering the children nodes ...
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
this._layoutChildren(child, heightById);
|
this._layoutChildren(child, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
@ -183,7 +183,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
this._shiftBranches(node, heightById);
|
this._shiftBranches(node, heightById);
|
||||||
}
|
}
|
||||||
|
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
this._fixOverlapping(child, heightById);
|
this._fixOverlapping(child, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
@ -193,7 +193,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
|
|
||||||
var siblingsToShift = this._treeSet.getSiblingsInVerticalDirection(node, node.getFreeDisplacement().y);
|
var siblingsToShift = this._treeSet.getSiblingsInVerticalDirection(node, node.getFreeDisplacement().y);
|
||||||
var last = node;
|
var last = node;
|
||||||
siblingsToShift.each(function (sibling) {
|
_.each(siblingsToShift, function (sibling) {
|
||||||
var overlappingOccurs = shiftedBranches.some(function (shiftedBranch) {
|
var overlappingOccurs = shiftedBranches.some(function (shiftedBranch) {
|
||||||
return this._branchesOverlap(shiftedBranch, sibling, heightById);
|
return this._branchesOverlap(shiftedBranch, sibling, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
@ -209,7 +209,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
return !shiftedBranches.contains(branch);
|
return !shiftedBranches.contains(branch);
|
||||||
});
|
});
|
||||||
|
|
||||||
branchesToShift.each(function (branch) {
|
_.each(branchesToShift, function (branch) {
|
||||||
var bAmount = node.getFreeDisplacement().y;
|
var bAmount = node.getFreeDisplacement().y;
|
||||||
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
|
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
|
||||||
shiftedBranches.push(branch);
|
shiftedBranches.push(branch);
|
||||||
|
@ -240,7 +240,7 @@ mindplot.layout.RootedTreeSet = new Class({
|
|||||||
var yOffset = oldPos.y - position.y;
|
var yOffset = oldPos.y - position.y;
|
||||||
|
|
||||||
var children = this.getChildren(node);
|
var children = this.getChildren(node);
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
this.shiftBranchPosition(child, xOffset, yOffset);
|
this.shiftBranchPosition(child, xOffset, yOffset);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ mindplot.layout.RootedTreeSet = new Class({
|
|||||||
node.setPosition({x:position.x + xOffset, y:position.y + yOffset});
|
node.setPosition({x:position.x + xOffset, y:position.y + yOffset});
|
||||||
|
|
||||||
var children = this.getChildren(node);
|
var children = this.getChildren(node);
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
this.shiftBranchPosition(child, xOffset, yOffset);
|
this.shiftBranchPosition(child, xOffset, yOffset);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
@ -168,7 +168,7 @@ mindplot.layout.SymmetricSorter = new Class({
|
|||||||
|
|
||||||
// Compute the center of the branch ...
|
// Compute the center of the branch ...
|
||||||
var totalHeight = 0;
|
var totalHeight = 0;
|
||||||
heights.each(function (elem) {
|
_.each(heights, function (elem) {
|
||||||
totalHeight += elem.height;
|
totalHeight += elem.height;
|
||||||
});
|
});
|
||||||
var ysum = totalHeight / 2;
|
var ysum = totalHeight / 2;
|
||||||
|
@ -135,7 +135,7 @@ mindplot.model.IMindmap = new Class({
|
|||||||
|
|
||||||
// Then the rest of the branches ...
|
// Then the rest of the branches ...
|
||||||
var sbranchs = source.getBranches();
|
var sbranchs = source.getBranches();
|
||||||
sbranchs.each(function(snode) {
|
_.each(sbranchs, function(snode) {
|
||||||
var tnode = target.createNode(snode.getType(), snode.getId());
|
var tnode = target.createNode(snode.getType(), snode.getId());
|
||||||
snode.copyTo(tnode);
|
snode.copyTo(tnode);
|
||||||
target.addBranch(tnode);
|
target.addBranch(tnode);
|
||||||
|
@ -213,7 +213,7 @@ mindplot.model.INodeModel = new Class({
|
|||||||
var source = this;
|
var source = this;
|
||||||
// Copy properties ...
|
// Copy properties ...
|
||||||
var keys = source.getPropertiesKeys();
|
var keys = source.getPropertiesKeys();
|
||||||
keys.each(function(key) {
|
_.each(keys, function(key) {
|
||||||
var value = source.getProperty(key);
|
var value = source.getProperty(key);
|
||||||
target.putProperty(key, value);
|
target.putProperty(key, value);
|
||||||
});
|
});
|
||||||
@ -222,7 +222,7 @@ mindplot.model.INodeModel = new Class({
|
|||||||
var children = this.getChildren();
|
var children = this.getChildren();
|
||||||
var tmindmap = target.getMindmap();
|
var tmindmap = target.getMindmap();
|
||||||
|
|
||||||
children.each(function(snode) {
|
_.each(function(children, snode) {
|
||||||
var tnode = tmindmap.createNode(snode.getType(), snode.getId());
|
var tnode = tmindmap.createNode(snode.getType(), snode.getId());
|
||||||
snode.copyTo(tnode);
|
snode.copyTo(tnode);
|
||||||
target.append(tnode);
|
target.append(tnode);
|
||||||
@ -278,10 +278,10 @@ mindplot.model.INodeModel = new Class({
|
|||||||
var children = this.getChildren();
|
var children = this.getChildren();
|
||||||
if (children.length > 0) {
|
if (children.length > 0) {
|
||||||
result = result + ", children: {(size:" + children.length;
|
result = result + ", children: {(size:" + children.length;
|
||||||
children.each(function(node) {
|
_.each(children, function(node) {
|
||||||
result = result + "=> (";
|
result = result + "=> (";
|
||||||
var keys = node.getPropertiesKeys();
|
var keys = node.getPropertiesKeys();
|
||||||
keys.each(function(key) {
|
_.each(keys, function(key) {
|
||||||
var value = node.getProperty(key);
|
var value = node.getProperty(key);
|
||||||
result = result + key + ":" + value + ",";
|
result = result + key + ":" + value + ",";
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,7 @@ mindplot.persistence.Beta2PelaMigrator = new Class({
|
|||||||
|
|
||||||
// Beta does not set position on second level nodes ...
|
// Beta does not set position on second level nodes ...
|
||||||
var branches = mindmap.getBranches();
|
var branches = mindmap.getBranches();
|
||||||
branches.each(function (model) {
|
_.each(branches, function (model) {
|
||||||
this._fixPosition(model);
|
this._fixPosition(model);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ mindplot.persistence.Beta2PelaMigrator = new Class({
|
|||||||
_fixPosition:function (parentModel) {
|
_fixPosition:function (parentModel) {
|
||||||
var parentPos = parentModel.getPosition();
|
var parentPos = parentModel.getPosition();
|
||||||
var isRight = parentPos.x > 0;
|
var isRight = parentPos.x > 0;
|
||||||
parentModel.getChildren().each(function (child) {
|
_.each(parentModel.getChildren(), function (child) {
|
||||||
if (!child.getPosition()) {
|
if (!child.getPosition()) {
|
||||||
child.setPosition(parentPos.x + (50 * isRight ? 1 : -1), parentPos.y);
|
child.setPosition(parentPos.x + (50 * isRight ? 1 : -1), parentPos.y);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ mindplot.util.FadeEffect = new Class({
|
|||||||
|
|
||||||
|
|
||||||
this.addEvent('complete', function() {
|
this.addEvent('complete', function() {
|
||||||
this._element.each(function(elem) {
|
_.each(this._element, function(elem) {
|
||||||
if(elem){
|
if(elem){
|
||||||
elem.setVisibility(isVisible);
|
elem.setVisibility(isVisible);
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ mindplot.util.FadeEffect = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
set: function(now) {
|
set: function(now) {
|
||||||
this._element.each(function(elem) {
|
_.each(this._element, function(elem) {
|
||||||
if(elem){
|
if(elem){
|
||||||
elem.setOpacity(now);
|
elem.setOpacity(now);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ mindplot.widget.ColorPalettePanel = new Class({
|
|||||||
// Register on toolbar elements ...
|
// Register on toolbar elements ...
|
||||||
var colorCells = content.find('div[class=palette-colorswatch]');
|
var colorCells = content.find('div[class=palette-colorswatch]');
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
colorCells.each(function (elem) {
|
_.each(colorCells, function (elem) {
|
||||||
$(elem).on('click', function () {
|
$(elem).on('click', function () {
|
||||||
var color = elem.css("background-color");
|
var color = elem.css("background-color");
|
||||||
model.setValue(color);
|
model.setValue(color);
|
||||||
@ -80,7 +80,7 @@ mindplot.widget.ColorPalettePanel = new Class({
|
|||||||
|
|
||||||
// Clear selected cell based on the color ...
|
// Clear selected cell based on the color ...
|
||||||
var tdCells = panelElem.find("td[class='palette-cell palette-cell-selected']");
|
var tdCells = panelElem.find("td[class='palette-cell palette-cell-selected']");
|
||||||
tdCells.each(function (elem) {
|
_.each(tdCells, function (elem) {
|
||||||
elem.className = 'palette-cell';
|
elem.className = 'palette-cell';
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ mindplot.widget.ColorPalettePanel = new Class({
|
|||||||
var colorCells = panelElem.find('div[class=palette-colorswatch]');
|
var colorCells = panelElem.find('div[class=palette-colorswatch]');
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var modelValue = model.getValue();
|
var modelValue = model.getValue();
|
||||||
colorCells.each(function (elem) {
|
_.each(colorCells, function (elem) {
|
||||||
var color = elem.css("background-color");
|
var color = elem.css("background-color");
|
||||||
if (modelValue != null && modelValue[0] == 'r') {
|
if (modelValue != null && modelValue[0] == 'r') {
|
||||||
modelValue = modelValue.rgbToHex();
|
modelValue = modelValue.rgbToHex();
|
||||||
|
@ -35,7 +35,7 @@ mindplot.widget.IMenu = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
clear:function () {
|
clear:function () {
|
||||||
this._toolbarElems.each(function (item) {
|
_.each(this._toolbarElems, function (item) {
|
||||||
item.hide();
|
item.hide();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@ mindplot.widget.ListToolbarPanel = new Class({
|
|||||||
var panelElem = this.getPanelElem();
|
var panelElem = this.getPanelElem();
|
||||||
var menuElems = panelElem.getElements('div');
|
var menuElems = panelElem.getElements('div');
|
||||||
var value = this.getModel().getValue();
|
var value = this.getModel().getValue();
|
||||||
menuElems.each(function (elem) {
|
_.each(menuElems, function (elem) {
|
||||||
var elemValue = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
|
var elemValue = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
|
||||||
$assert(elemValue, "elemValue can not be null");
|
$assert(elemValue, "elemValue can not be null");
|
||||||
if (elemValue == value)
|
if (elemValue == value)
|
||||||
|
@ -452,7 +452,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
_registerEvents: function (designer) {
|
_registerEvents: function (designer) {
|
||||||
|
|
||||||
// Register on close events ...
|
// Register on close events ...
|
||||||
this._toolbarElems.each(function (elem) {
|
_.each(this._toolbarElems, function (elem) {
|
||||||
elem.addEvent('show', function () {
|
elem.addEvent('show', function () {
|
||||||
this.clear()
|
this.clear()
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
@ -462,7 +462,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
var topics = designer.getModel().filterSelectedTopics();
|
var topics = designer.getModel().filterSelectedTopics();
|
||||||
var rels = designer.getModel().filterSelectedRelationships();
|
var rels = designer.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
this._toolbarElems.each(function (button) {
|
_.each(this._toolbarElems, function (button) {
|
||||||
var isTopicAction = button.isTopicAction();
|
var isTopicAction = button.isTopicAction();
|
||||||
var isRelAction = button.isRelAction();
|
var isRelAction = button.isRelAction();
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
var topics = designer.getModel().filterSelectedTopics();
|
var topics = designer.getModel().filterSelectedTopics();
|
||||||
var rels = designer.getModel().filterSelectedRelationships();
|
var rels = designer.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
this._toolbarElems.each(function (button) {
|
_.each(this._toolbarElems, function (button) {
|
||||||
var isTopicAction = button.isTopicAction();
|
var isTopicAction = button.isTopicAction();
|
||||||
var isRelAction = button.isRelAction();
|
var isRelAction = button.isRelAction();
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ mindplot.layout.FreeTestSuite = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
var treeSet = manager._treeSet;
|
var treeSet = manager._treeSet;
|
||||||
treeSet._rootNodes.each(function(rootNode) {
|
_.each(treeSet._rootNodes, function(rootNode) {
|
||||||
var heightById = rootNode.getSorter().computeChildrenIdByHeights(treeSet, rootNode);
|
var heightById = rootNode.getSorter().computeChildrenIdByHeights(treeSet, rootNode);
|
||||||
this._assertBranchCollision(treeSet, rootNode, heightById);
|
this._assertBranchCollision(treeSet, rootNode, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
@ -453,7 +453,7 @@ mindplot.layout.FreeTestSuite = new Class({
|
|||||||
var children = treeSet.getChildren(node);
|
var children = treeSet.getChildren(node);
|
||||||
var childOfRootNode = treeSet._rootNodes.contains(node);
|
var childOfRootNode = treeSet._rootNodes.contains(node);
|
||||||
|
|
||||||
children.each(function(child) {
|
_.each(children, function(child) {
|
||||||
var height = heightById[child.getId()];
|
var height = heightById[child.getId()];
|
||||||
var siblings = treeSet.getSiblings(child);
|
var siblings = treeSet.getSiblings(child);
|
||||||
if (childOfRootNode) {
|
if (childOfRootNode) {
|
||||||
@ -461,12 +461,12 @@ mindplot.layout.FreeTestSuite = new Class({
|
|||||||
return (child.getOrder() % 2) == (sibling.getOrder() % 2);
|
return (child.getOrder() % 2) == (sibling.getOrder() % 2);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
siblings.each(function(sibling) {
|
_.each(siblings, function(sibling) {
|
||||||
this._branchesOverlap(child, sibling, heightById);
|
this._branchesOverlap(child, sibling, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
children.each(function(child) {
|
_.each(children, function(child) {
|
||||||
this._assertBranchCollision(treeSet, child, heightById);
|
this._assertBranchCollision(treeSet, child, heightById);
|
||||||
}, this)
|
}, this)
|
||||||
},
|
},
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
<script type='text/javascript' src='js/jquery.js'></script>
|
<script type='text/javascript' src='js/jquery.js'></script>
|
||||||
<script type='text/javascript' src='js/hotkeys.js'></script>
|
<script type='text/javascript' src='js/hotkeys.js'></script>
|
||||||
|
<script type='text/javascript' src='js/underscorejs.js'></script>
|
||||||
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script>
|
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script>
|
||||||
<script src="js/less.js" type="text/javascript"></script>
|
<script src="js/less.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user