mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-13 16:33:28 -04:00
Add basic code for fine-grained change tracking, as required by on-the fly SVG DOM manipulation.
This commit is contained in:
parent
a2358a0fc0
commit
6052e94a2a
2 changed files with 16 additions and 0 deletions
|
@ -54,6 +54,19 @@ var Item = this.Item = Base.extend(/** @lends Item# */{
|
|||
// If this item is a symbol's definition, notify it of the change too
|
||||
if (this._parentSymbol)
|
||||
this._parentSymbol._changed(flags);
|
||||
// Have project keep track of changed items, so they can be iterated.
|
||||
// This can be used for example to update the SVG tree. Needs to be
|
||||
// activated in Project
|
||||
if (this._project._changes) {
|
||||
var entry = this._project._changesById[this._id];
|
||||
if (entry) {
|
||||
entry.flags |= flags;
|
||||
} else {
|
||||
entry = { item: this, flags: flags };
|
||||
this._project._changesById[this._id] = entry;
|
||||
this._project._changes.push(entry);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,6 +55,9 @@ var Project = this.Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
this.layers = [];
|
||||
this.symbols = [];
|
||||
this.activeLayer = new Layer();
|
||||
// Change tracking, not in use for now. Activate once required:
|
||||
// this._changes = [];
|
||||
// this._changesById = {};
|
||||
},
|
||||
|
||||
_needsRedraw: function() {
|
||||
|
|
Loading…
Reference in a new issue