fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Switching to explicit inheritance for canvas elements
[fnpeditor.git]
/
src
/
smartxml
/
transformations.js
diff --git
a/src/smartxml/transformations.js
b/src/smartxml/transformations.js
index
e239b6a
..
4a8e5a8
100644
(file)
--- a/
src/smartxml/transformations.js
+++ b/
src/smartxml/transformations.js
@@
-51,7
+51,7
@@
toret.createGenericTransformation = function(desc, name) {
});
this.document = document;
});
this.document = document;
- this.
hasRun = false
;
+ this.
runCount = 0
;
if(desc.init) {
desc.init.call(this);
}
if(desc.init) {
desc.init.call(this);
}
@@
-73,12
+73,13
@@
toret.createGenericTransformation = function(desc, name) {
}
var argsToPass = desc.undo ? [this].concat(this.args) : this.args;
var toret = desc.impl.apply(this.context, argsToPass);
}
var argsToPass = desc.undo ? [this].concat(this.args) : this.args;
var toret = desc.impl.apply(this.context, argsToPass);
- this.
hasRun = true
;
+ this.
runCount++
;
return toret;
},
undo: function() {
if(desc.undo) {
desc.undo.call(this.context, this);
return toret;
},
undo: function() {
if(desc.undo) {
desc.undo.call(this.context, this);
+ this.runCount++;
} else {
this.document.getNodeByPath(this.changeRootPath).replaceWith(this.snapshot);
}
} else {
this.document.getNodeByPath(this.changeRootPath).replaceWith(this.snapshot);
}
@@
-88,6
+89,7
@@
toret.createGenericTransformation = function(desc, name) {
},
wrapNodeProperty: function(object, propName, value) {
var transformation = this,
},
wrapNodeProperty: function(object, propName, value) {
var transformation = this,
+ lastRunNumber = 0,
path;
value = value || object[propName];
path;
value = value || object[propName];
@@
-95,11
+97,11
@@
toret.createGenericTransformation = function(desc, name) {
path = value.getPath();
Object.defineProperty(object, propName, {
get: function() {
path = value.getPath();
Object.defineProperty(object, propName, {
get: function() {
- if(transformation.hasRun && path) {
- return transformation.document.getNodeByPath(path);
- } else {
- return value;
+ if((lastRunNumber !== transformation.runCount) && path) {
+ value = transformation.document.getNodeByPath(path);
+ lastRunNumber = transformation.runCount;
}
}
+ return value;
}
});
}
}
});
}