mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
Minor performance improvement...
This commit is contained in:
parent
f3da916965
commit
80940b8529
@ -139,9 +139,7 @@ mindplot.ConnectionLine = new Class({
|
||||
else {
|
||||
x = -mindplot.Topic.CONNECTOR_WIDTH;
|
||||
}
|
||||
console.log("conector:" + x + ", " + y);
|
||||
connector.setPosition(x, y);
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -682,7 +682,7 @@ mindplot.Designer = new Class({
|
||||
});
|
||||
|
||||
|
||||
var relIds = topics.map(function (rel) {
|
||||
var relIds = relation.map(function (rel) {
|
||||
return rel.getId();
|
||||
});
|
||||
|
||||
|
@ -138,7 +138,10 @@ mindplot.layout.Node = new Class({
|
||||
$assert($defined(position.x), "x can not be null");
|
||||
$assert($defined(position.y), "y can not be null");
|
||||
|
||||
this._setProperty('position', Object.clone(position));
|
||||
// This is a performance improvement to avoid movements that really could be avoided.
|
||||
var currentPos = this.getPosition();
|
||||
if (currentPos == null || Math.abs(currentPos.x - position.x) > 2 || Math.abs(currentPos.y - position.y) > 2)
|
||||
this._setProperty('position', position);
|
||||
},
|
||||
|
||||
_setProperty:function (key, value) {
|
||||
|
@ -111,14 +111,15 @@ mindplot.model.Mindmap = new Class({
|
||||
},
|
||||
|
||||
findNodeById:function (id) {
|
||||
var result;
|
||||
for (var i = 0; i < this._branches; i++) {
|
||||
var result = null;
|
||||
for (var i = 0; i < this._branches.length; i++) {
|
||||
var branch = this._branches[i];
|
||||
result = branch.findNodeById(id)
|
||||
result = branch.findNodeById(id);
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -189,7 +189,7 @@ mindplot.model.NodeModel = new Class({
|
||||
findNodeById : function(id) {
|
||||
var result = null;
|
||||
if (this.getId() == id) {
|
||||
return this;
|
||||
result = this;
|
||||
} else {
|
||||
var children = this.getChildren();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
|
@ -411,7 +411,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
return null;
|
||||
}
|
||||
// Is the connections points valid ?. If it's not, do not load the relationship ...
|
||||
if (mindmap.findNodeById(srcId) == null || mindmap.findNodeById(destId)) {
|
||||
if (mindmap.findNodeById(srcId) == null || mindmap.findNodeById(destId)==null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user