forked from mapbox/mapbox-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deselect deleted features; closes mapbox#357
It involved some refactoring to keep the selection in the store, accessible outside of simple_select. And other refactoring to improve testability and clarify the API of the store.
- Loading branch information
DAVID CLARK
committed
Jun 15, 2016
1 parent
57fd3d2
commit c15a440
Showing
13 changed files
with
431 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function SimpleSet(items) { | ||
this._items = items || []; | ||
} | ||
|
||
SimpleSet.prototype.add = function(item) { | ||
if (this._items.indexOf(item) !== -1) return; | ||
this._items.push(item); | ||
return this; | ||
}; | ||
|
||
SimpleSet.prototype.delete = function(item) { | ||
var itemIndex = this._items.indexOf(item); | ||
if (itemIndex === -1) return; | ||
this._items.splice(itemIndex, 1); | ||
return this; | ||
}; | ||
|
||
SimpleSet.prototype.has = function(item) { | ||
return this._items.indexOf(item) !== -1; | ||
}; | ||
|
||
SimpleSet.prototype.values = function() { | ||
return this._items; | ||
}; | ||
|
||
SimpleSet.prototype.clear = function() { | ||
this._items = []; | ||
return this; | ||
}; | ||
|
||
module.exports = SimpleSet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.