mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 15:56:56 +02:00
Make it so preset.init() can be called again to reset the datastructures
(this is mostly so I can reset recent.collection for the walkthrough)
This commit is contained in:
@@ -12,14 +12,14 @@ export function presetCollection(collection) {
|
||||
|
||||
|
||||
item: function(id) {
|
||||
return _.find(collection, function(d) {
|
||||
return _.find(this.collection, function(d) {
|
||||
return d.id === id;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
matchGeometry: function(geometry) {
|
||||
return presetCollection(collection.filter(function(d) {
|
||||
return presetCollection(this.collection.filter(function(d) {
|
||||
return d.matchGeometry(geometry);
|
||||
}));
|
||||
},
|
||||
@@ -44,10 +44,10 @@ export function presetCollection(collection) {
|
||||
|
||||
value = value.toLowerCase();
|
||||
|
||||
var searchable = _.filter(collection, function(a) {
|
||||
var searchable = _.filter(this.collection, function(a) {
|
||||
return a.searchable !== false && a.suggestion !== true;
|
||||
}),
|
||||
suggestions = _.filter(collection, function(a) {
|
||||
suggestions = _.filter(this.collection, function(a) {
|
||||
return a.suggestion === true;
|
||||
});
|
||||
|
||||
|
||||
@@ -107,6 +107,12 @@ export function presetIndex() {
|
||||
all.init = function() {
|
||||
var d = data.presets;
|
||||
|
||||
all.collection = [];
|
||||
recent.collection = [];
|
||||
fields = {};
|
||||
universal = [];
|
||||
index = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
|
||||
|
||||
if (d.fields) {
|
||||
_.forEach(d.fields, function(d, id) {
|
||||
fields[id] = presetField(id, d);
|
||||
|
||||
Reference in New Issue
Block a user