Fix two bugs in the selected items code.

This commit is contained in:
Jonathan Puckey 2011-04-21 20:52:28 +02:00
parent be8ee90f75
commit dfb5cbc5eb
2 changed files with 4 additions and 4 deletions

View file

@ -72,7 +72,7 @@ var Document = this.Document = Base.extend({
_selectItem: function(item, select) { _selectItem: function(item, select) {
if (select) { if (select) {
this.selectedItemCount++; this._selectedItemCount++;
this._selectedItems[item.getId()] = item; this._selectedItems[item.getId()] = item;
} else { } else {
this._selectedItemCount--; this._selectedItemCount--;
@ -101,7 +101,7 @@ var Document = this.Document = Base.extend({
// Todo: use Layer#color // Todo: use Layer#color
context.strokeStyle = context.fillStyle = '#4f7aff'; context.strokeStyle = context.fillStyle = '#4f7aff';
param = { selection: true }; param = { selection: true };
Base.each(this.selectedItems, function(item) { Base.each(this._selectedItems, function(item) {
item.draw(context, param); item.draw(context, param);
}); });
context.restore(); context.restore();

View file

@ -222,11 +222,11 @@ var Segment = this.Segment = Base.extend({
if (!this._selectionState) { if (!this._selectionState) {
path._selectedSegmentCount--; path._selectedSegmentCount--;
if (path._selectedSegmentCount == 0) if (path._selectedSegmentCount == 0)
path._document._selectItem(path, true); path._document._selectItem(path, false);
} else { } else {
path._selectedSegmentCount++; path._selectedSegmentCount++;
if (path._selectedSegmentCount == 1) if (path._selectedSegmentCount == 1)
path._document._selectItem(path, false); path._document._selectItem(path, true);
} }
} }
}, },