mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 14:38:05 +02:00
type -> geometry
This commit is contained in:
+2
-2
@@ -8,7 +8,7 @@ iD.presets = function(context) {
|
||||
icon: 'marker-stroked',
|
||||
match: {
|
||||
tags: {},
|
||||
type: ['point', 'vertex', 'line', 'area']
|
||||
geometry: ['point', 'vertex', 'line', 'area']
|
||||
},
|
||||
form: []
|
||||
}),
|
||||
@@ -51,7 +51,7 @@ iD.presets = function(context) {
|
||||
};
|
||||
|
||||
all.defaults = function(entity, n) {
|
||||
var rec = recent.matchType(entity, context.graph()).collection.slice(0, 4),
|
||||
var rec = recent.matchGeometry(entity, context.graph()).collection.slice(0, 4),
|
||||
def = _.uniq(rec.concat(defaults[entity.geometry(context.graph())].collection)).slice(0, n - 1);
|
||||
return iD.presets.Collection(_.unique(rec.concat(def).concat(other)));
|
||||
};
|
||||
|
||||
@@ -5,8 +5,8 @@ iD.presets.Category = function(category, all) {
|
||||
return all.item(name);
|
||||
}));
|
||||
|
||||
category.matchType = function(entity, resolver) {
|
||||
return category.match.type.indexOf(entity.geometry(resolver)) >= 0;
|
||||
category.matchGeometry = function(entity, resolver) {
|
||||
return category.match.geometry.indexOf(entity.geometry(resolver)) >= 0;
|
||||
};
|
||||
|
||||
category.matchTags = function() { return false; };
|
||||
|
||||
@@ -11,12 +11,12 @@ iD.presets.Collection = function(collection) {
|
||||
},
|
||||
|
||||
match: function(entity, resolver) {
|
||||
return presets.matchType(entity, resolver).matchTags(entity);
|
||||
return presets.matchGeometry(entity, resolver).matchTags(entity);
|
||||
},
|
||||
|
||||
matchType: function(entity, resolver) {
|
||||
matchGeometry: function(entity, resolver) {
|
||||
return iD.presets.Collection(collection.filter(function(d) {
|
||||
return d.matchType(entity, resolver);
|
||||
return d.matchGeometry(entity, resolver);
|
||||
}));
|
||||
},
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ iD.presets.Preset = function(preset, forms) {
|
||||
}
|
||||
}) : [];
|
||||
|
||||
preset.matchType = function(entity, resolver) {
|
||||
return preset.match.type.indexOf(entity.geometry(resolver)) >= 0;
|
||||
preset.matchGeometry = function(entity, resolver) {
|
||||
return preset.match.geometry.indexOf(entity.geometry(resolver)) >= 0;
|
||||
};
|
||||
|
||||
preset.matchTags = function(entity) {
|
||||
|
||||
@@ -8,7 +8,7 @@ iD.ui.PresetGrid = function(context) {
|
||||
|
||||
selection.html('');
|
||||
|
||||
presets = presets.matchType(entity, context.graph());
|
||||
presets = presets.matchGeometry(entity, context.graph());
|
||||
|
||||
var messagewrap = selection.append('div')
|
||||
.attr('class', 'message inspector-inner fillL');
|
||||
|
||||
@@ -148,7 +148,7 @@ iD.ui.TagEditor = function(context) {
|
||||
|
||||
// change preset if necessary (undos/redos)
|
||||
var newmatch = presets
|
||||
.matchType(entity, context.graph())
|
||||
.matchGeometry(entity, context.graph())
|
||||
.matchTags(entity.update({ tags: tags }));
|
||||
if (newmatch !== preset) {
|
||||
return tageditor(selection_, newmatch);
|
||||
|
||||
Reference in New Issue
Block a user