Define default value for Item#_selected and copy it over when item is cloned.

This commit is contained in:
Jürg Lehni 2011-06-14 15:35:39 +01:00
parent 2679d6eb9e
commit c4b3d1c82a

View file

@ -222,7 +222,7 @@ var Item = this.Item = Base.extend({
return true; return true;
} }
} }
return !!this._selected; return this._selected;
}, },
setSelected: function(selected) { setSelected: function(selected) {
@ -236,6 +236,8 @@ var Item = this.Item = Base.extend({
} }
}, },
_selected: false,
// TODO: isFullySelected / setFullySelected // TODO: isFullySelected / setFullySelected
// TODO: Change to getter / setters for these below that notify of changes // TODO: Change to getter / setters for these below that notify of changes
// through _changed() // through _changed()
@ -612,7 +614,8 @@ var Item = this.Item = Base.extend({
// Only copy over these fields if they are actually defined in 'this' // Only copy over these fields if they are actually defined in 'this'
// TODO: Consider moving this to Base once it's useful in more than one // TODO: Consider moving this to Base once it's useful in more than one
// place // place
var keys = ['locked', 'visible', 'opacity', 'blendMode', '_clipMask']; var keys = ['locked', 'visible', 'opacity', 'blendMode', '_clipMask',
'_selected'];
for (var i = 0, l = keys.length; i < l; i++) { for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i]; var key = keys[i];
if (this.hasOwnProperty(key)) if (this.hasOwnProperty(key))