mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
39 lines
734 B
JavaScript
39 lines
734 B
JavaScript
import _clone from 'lodash-es/clone';
|
|
import { t } from '../util/locale';
|
|
import { presetCollection } from './collection';
|
|
|
|
|
|
export function presetCategory(id, category, all) {
|
|
category = _clone(category);
|
|
|
|
category.id = id;
|
|
|
|
|
|
category.members = presetCollection(category.members.map(function(id) {
|
|
return all.item(id);
|
|
}));
|
|
|
|
|
|
category.matchGeometry = function(geometry) {
|
|
return category.geometry.indexOf(geometry) >= 0;
|
|
};
|
|
|
|
|
|
category.matchScore = function() {
|
|
return -1;
|
|
};
|
|
|
|
|
|
category.name = function() {
|
|
return t('presets.categories.' + id + '.name', {'default': id});
|
|
};
|
|
|
|
|
|
category.terms = function() {
|
|
return [];
|
|
};
|
|
|
|
|
|
return category;
|
|
}
|