Rename ChangeFlags -> ChangeFlag.

This commit is contained in:
Jürg Lehni 2011-06-19 22:21:14 +01:00
parent f0bc3f115b
commit 0df909dd71
6 changed files with 16 additions and 16 deletions

View file

@ -14,7 +14,7 @@
* All rights reserved. * All rights reserved.
*/ */
var ChangeFlags = { var ChangeFlag = {
// Anything affecting the appearance of an item, including GEOMETRY, // Anything affecting the appearance of an item, including GEOMETRY,
// STROKE, STYLE and ATTRIBUTE (except for the invisible ones: locked, name) // STROKE, STYLE and ATTRIBUTE (except for the invisible ones: locked, name)
APPEARANCE: 1, APPEARANCE: 1,
@ -30,11 +30,11 @@ var ChangeFlags = {
ATTRIBUTE: 32 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 = { var Change = {
HIERARCHY: ChangeFlags.HIERARCHY | ChangeFlags.APPEARANCE, HIERARCHY: ChangeFlag.HIERARCHY | ChangeFlag.APPEARANCE,
GEOMETRY: ChangeFlags.GEOMETRY | ChangeFlags.APPEARANCE, GEOMETRY: ChangeFlag.GEOMETRY | ChangeFlag.APPEARANCE,
STROKE: ChangeFlags.STROKE | ChangeFlags.APPEARANCE, STROKE: ChangeFlag.STROKE | ChangeFlag.APPEARANCE,
STYLE: ChangeFlags.STYLE | ChangeFlags.APPEARANCE, STYLE: ChangeFlag.STYLE | ChangeFlag.APPEARANCE,
ATTRIBUTE: ChangeFlags.ATTRIBUTE | ChangeFlags.APPEARANCE ATTRIBUTE: ChangeFlag.ATTRIBUTE | ChangeFlag.APPEARANCE
}; };

View file

@ -39,10 +39,10 @@ var Item = this.Item = Base.extend({
* Private notifier that is called whenever a change occurs in this item or * Private notifier that is called whenever a change occurs in this item or
* its sub-elements, such as Segments, Curves, PathStyles, etc. * 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) { _changed: function(flags) {
if (flags & ChangeFlags.GEOMETRY) { if (flags & ChangeFlag.GEOMETRY) {
delete this._bounds; delete this._bounds;
delete this._position; delete this._position;
} }
@ -99,7 +99,7 @@ var Item = this.Item = Base.extend({
(namedChildren[name] = namedChildren[name] || []).push(this); (namedChildren[name] = namedChildren[name] || []).push(this);
children[name] = 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; this[name] = value;
// #locked does not change appearance, all others do: // #locked does not change appearance, all others do:
this._changed(name === '_locked' this._changed(name === '_locked'
? ChangeFlags.ATTRIBUTE : Change.ATTRIBUTE); ? ChangeFlag.ATTRIBUTE : Change.ATTRIBUTE);
} }
}; };
}, {}); }, {});

View file

@ -38,7 +38,7 @@ var sources = [
'src/project/Project.js', 'src/project/Project.js',
'src/project/Symbol.js', 'src/project/Symbol.js',
'src/item/ChangeFlags.js', 'src/item/ChangeFlag.js',
'src/item/Item.js', 'src/item/Item.js',
'src/item/Group.js', 'src/item/Group.js',
'src/item/Layer.js', 'src/item/Layer.js',

View file

@ -58,7 +58,7 @@ var paper = new function() {
//#include "project/Project.js" //#include "project/Project.js"
//#include "project/Symbol.js" //#include "project/Symbol.js"
//#include "item/ChangeFlags.js" //#include "item/ChangeFlag.js"
//#include "item/Item.js" //#include "item/Item.js"
//#include "item/Group.js" //#include "item/Group.js"
//#include "item/Layer.js" //#include "item/Layer.js"

View file

@ -60,14 +60,14 @@ var Path = this.Path = PathItem.extend({
}, },
_changed: function(flags) { _changed: function(flags) {
if (flags & ChangeFlags.GEOMETRY) { if (flags & ChangeFlag.GEOMETRY) {
delete this._bounds; delete this._bounds;
delete this._position; delete this._position;
delete this._strokeBounds; delete this._strokeBounds;
delete this._length; delete this._length;
// Clockwise state becomes undefined as soon as geometry changes. // Clockwise state becomes undefined as soon as geometry changes.
delete this._clockwise; delete this._clockwise;
} else if (flags & ChangeFlags.STROKE) { } else if (flags & ChangeFlag.STROKE) {
delete this._strokeBounds; delete this._strokeBounds;
} }
}, },

View file

@ -58,7 +58,7 @@ var Project = this.Project = Base.extend({
}, },
_changed: function(flags) { _changed: function(flags) {
if (flags & ChangeFlags.GEOMETRY) { if (flags & ChangeFlag.GEOMETRY) {
// TODO: Mark as requireRedraw // TODO: Mark as requireRedraw
} }
}, },