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

View file

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