mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Rename ChangeFlags -> ChangeFlag.
This commit is contained in:
parent
f0bc3f115b
commit
0df909dd71
6 changed files with 16 additions and 16 deletions
|
@ -14,7 +14,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
var ChangeFlags = {
|
||||
var ChangeFlag = {
|
||||
// Anything affecting the appearance of an item, including GEOMETRY,
|
||||
// STROKE, STYLE and ATTRIBUTE (except for the invisible ones: locked, name)
|
||||
APPEARANCE: 1,
|
||||
|
@ -30,11 +30,11 @@ var ChangeFlags = {
|
|||
ATTRIBUTE: 32
|
||||
};
|
||||
|
||||
// Shortcuts to the ChangeFlags to send to #_changed(), all including appearance
|
||||
// Shortcuts to the ChangeFlag to send to #_changed(), all including appearance
|
||||
var Change = {
|
||||
HIERARCHY: ChangeFlags.HIERARCHY | ChangeFlags.APPEARANCE,
|
||||
GEOMETRY: ChangeFlags.GEOMETRY | ChangeFlags.APPEARANCE,
|
||||
STROKE: ChangeFlags.STROKE | ChangeFlags.APPEARANCE,
|
||||
STYLE: ChangeFlags.STYLE | ChangeFlags.APPEARANCE,
|
||||
ATTRIBUTE: ChangeFlags.ATTRIBUTE | ChangeFlags.APPEARANCE
|
||||
HIERARCHY: ChangeFlag.HIERARCHY | ChangeFlag.APPEARANCE,
|
||||
GEOMETRY: ChangeFlag.GEOMETRY | ChangeFlag.APPEARANCE,
|
||||
STROKE: ChangeFlag.STROKE | ChangeFlag.APPEARANCE,
|
||||
STYLE: ChangeFlag.STYLE | ChangeFlag.APPEARANCE,
|
||||
ATTRIBUTE: ChangeFlag.ATTRIBUTE | ChangeFlag.APPEARANCE
|
||||
};
|
|
@ -39,10 +39,10 @@ var Item = this.Item = Base.extend({
|
|||
* Private notifier that is called whenever a change occurs in this item or
|
||||
* its sub-elements, such as Segments, Curves, PathStyles, etc.
|
||||
*
|
||||
* @param {ChangeFlags} flags describes what exactly has changed.
|
||||
* @param {ChangeFlag} flags describes what exactly has changed.
|
||||
*/
|
||||
_changed: function(flags) {
|
||||
if (flags & ChangeFlags.GEOMETRY) {
|
||||
if (flags & ChangeFlag.GEOMETRY) {
|
||||
delete this._bounds;
|
||||
delete this._position;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ var Item = this.Item = Base.extend({
|
|||
(namedChildren[name] = namedChildren[name] || []).push(this);
|
||||
children[name] = this;
|
||||
}
|
||||
this._changed(ChangeFlags.ATTRIBUTE);
|
||||
this._changed(ChangeFlag.ATTRIBUTE);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -210,7 +210,7 @@ var Item = this.Item = Base.extend({
|
|||
this[name] = value;
|
||||
// #locked does not change appearance, all others do:
|
||||
this._changed(name === '_locked'
|
||||
? ChangeFlags.ATTRIBUTE : Change.ATTRIBUTE);
|
||||
? ChangeFlag.ATTRIBUTE : Change.ATTRIBUTE);
|
||||
}
|
||||
};
|
||||
}, {});
|
||||
|
|
|
@ -38,7 +38,7 @@ var sources = [
|
|||
'src/project/Project.js',
|
||||
'src/project/Symbol.js',
|
||||
|
||||
'src/item/ChangeFlags.js',
|
||||
'src/item/ChangeFlag.js',
|
||||
'src/item/Item.js',
|
||||
'src/item/Group.js',
|
||||
'src/item/Layer.js',
|
||||
|
|
|
@ -58,7 +58,7 @@ var paper = new function() {
|
|||
//#include "project/Project.js"
|
||||
//#include "project/Symbol.js"
|
||||
|
||||
//#include "item/ChangeFlags.js"
|
||||
//#include "item/ChangeFlag.js"
|
||||
//#include "item/Item.js"
|
||||
//#include "item/Group.js"
|
||||
//#include "item/Layer.js"
|
||||
|
|
|
@ -60,14 +60,14 @@ var Path = this.Path = PathItem.extend({
|
|||
},
|
||||
|
||||
_changed: function(flags) {
|
||||
if (flags & ChangeFlags.GEOMETRY) {
|
||||
if (flags & ChangeFlag.GEOMETRY) {
|
||||
delete this._bounds;
|
||||
delete this._position;
|
||||
delete this._strokeBounds;
|
||||
delete this._length;
|
||||
// Clockwise state becomes undefined as soon as geometry changes.
|
||||
delete this._clockwise;
|
||||
} else if (flags & ChangeFlags.STROKE) {
|
||||
} else if (flags & ChangeFlag.STROKE) {
|
||||
delete this._strokeBounds;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -58,7 +58,7 @@ var Project = this.Project = Base.extend({
|
|||
},
|
||||
|
||||
_changed: function(flags) {
|
||||
if (flags & ChangeFlags.GEOMETRY) {
|
||||
if (flags & ChangeFlag.GEOMETRY) {
|
||||
// TODO: Mark as requireRedraw
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue