mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 06:35:20 +02:00
Pass entity explicitly
This commit is contained in:
@@ -4,9 +4,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
button: 'browse'
|
||||
};
|
||||
|
||||
var showgrid = singular() && singular().isNew() && _.without(Object.keys(singular().tags), 'area').length === 0;
|
||||
|
||||
var inspector = iD.ui.Inspector(context).initial(showgrid),
|
||||
var inspector = iD.ui.Inspector(context, singular()),
|
||||
keybinding = d3.keybinding('select'),
|
||||
timeout = null,
|
||||
behaviors = [
|
||||
@@ -91,7 +89,6 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
.select('.inspector-wrap');
|
||||
|
||||
wrap.style('display', 'block')
|
||||
.datum(entity)
|
||||
.call(inspector)
|
||||
.style('right', '-500px')
|
||||
.style('opacity', 1)
|
||||
|
||||
+7
-18
@@ -1,11 +1,8 @@
|
||||
iD.ui.Inspector = function(context) {
|
||||
iD.ui.Inspector = function(context, entity) {
|
||||
var event = d3.dispatch('changeTags', 'close', 'change'),
|
||||
initial = false,
|
||||
tagEditor;
|
||||
|
||||
function inspector(selection) {
|
||||
var entity = selection.datum();
|
||||
|
||||
var panewrap = selection
|
||||
.append('div')
|
||||
.classed('panewrap', true);
|
||||
@@ -18,22 +15,19 @@ iD.ui.Inspector = function(context) {
|
||||
.append('div')
|
||||
.classed('pane', true);
|
||||
|
||||
var presetGrid = iD.ui.PresetGrid(context)
|
||||
.entity(entity)
|
||||
var presetGrid = iD.ui.PresetGrid(context, entity)
|
||||
.on('close', function() {
|
||||
event.close();
|
||||
})
|
||||
.on('choose', function(preset) {
|
||||
|
||||
panewrap
|
||||
.transition()
|
||||
.style('right', '0%');
|
||||
|
||||
tagLayer.call(tagEditor, preset);
|
||||
|
||||
});
|
||||
|
||||
tagEditor = iD.ui.TagEditor(context)
|
||||
tagEditor = iD.ui.TagEditor(context, entity)
|
||||
.tags(entity.tags)
|
||||
.on('changeTags', function(tags) {
|
||||
event.changeTags(entity, tags);
|
||||
@@ -42,20 +36,20 @@ iD.ui.Inspector = function(context) {
|
||||
event.close(entity);
|
||||
})
|
||||
.on('choose', function() {
|
||||
|
||||
panewrap
|
||||
.transition()
|
||||
.style('right', '-100%');
|
||||
|
||||
presetLayer.call(presetGrid, true);
|
||||
|
||||
});
|
||||
|
||||
var initial = entity.isNew() && _.without(Object.keys(entity.tags), 'area').length === 0;
|
||||
|
||||
if (initial) {
|
||||
panewrap.style('right','-100%')
|
||||
panewrap.style('right', '-100%');
|
||||
presetLayer.call(presetGrid);
|
||||
} else {
|
||||
panewrap.style('right','-0%');
|
||||
panewrap.style('right', '-0%');
|
||||
tagLayer.call(tagEditor);
|
||||
}
|
||||
}
|
||||
@@ -65,10 +59,5 @@ iD.ui.Inspector = function(context) {
|
||||
return inspector;
|
||||
};
|
||||
|
||||
inspector.initial = function(_) {
|
||||
initial = _;
|
||||
return inspector;
|
||||
};
|
||||
|
||||
return d3.rebind(inspector, event, 'on');
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
iD.ui.PresetGrid = function(context) {
|
||||
iD.ui.PresetGrid = function(context, entity) {
|
||||
var event = d3.dispatch('choose', 'close'),
|
||||
entity,
|
||||
default_limit = 9,
|
||||
currently_drawn = 9,
|
||||
presets = context.presets(),
|
||||
@@ -242,11 +241,5 @@ iD.ui.PresetGrid = function(context) {
|
||||
.text(t('commit.cancel'));
|
||||
}
|
||||
|
||||
presetgrid.entity = function(_) {
|
||||
if (!arguments.length) return entity;
|
||||
entity = _;
|
||||
return presetgrid;
|
||||
};
|
||||
|
||||
return d3.rebind(presetgrid, event, 'on');
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
iD.ui.TagEditor = function(context) {
|
||||
iD.ui.TagEditor = function(context, entity) {
|
||||
var event = d3.dispatch('changeTags', 'choose', 'close'),
|
||||
presets = context.presets(),
|
||||
entity,
|
||||
tags,
|
||||
name,
|
||||
preset,
|
||||
@@ -11,7 +10,6 @@ iD.ui.TagEditor = function(context) {
|
||||
|
||||
function tageditor(selection, newpreset) {
|
||||
|
||||
entity = selection.datum();
|
||||
selection_ = selection;
|
||||
var geometry = entity.geometry(context.graph());
|
||||
|
||||
@@ -87,7 +85,7 @@ iD.ui.TagEditor = function(context) {
|
||||
.on('change', changeTags)
|
||||
.on('close', event.close);
|
||||
|
||||
tagList = iD.ui.Taglist(context)
|
||||
tagList = iD.ui.Taglist(context, entity)
|
||||
.on('change', changeTags);
|
||||
|
||||
var tageditorpreset = editorwrap.append('div')
|
||||
|
||||
+2
-5
@@ -1,4 +1,4 @@
|
||||
iD.ui.Taglist = function(context) {
|
||||
iD.ui.Taglist = function(context, entity) {
|
||||
var event = d3.dispatch('change'),
|
||||
taginfo = iD.taginfo(),
|
||||
initial = false,
|
||||
@@ -42,8 +42,6 @@ iD.ui.Taglist = function(context) {
|
||||
}
|
||||
|
||||
function drawTags(tags) {
|
||||
var entity = list.datum();
|
||||
|
||||
collapsebutton.text(t('inspector.additional') + ' (' + Object.keys(tags).length + ')');
|
||||
|
||||
tags = d3.entries(tags);
|
||||
@@ -201,8 +199,7 @@ iD.ui.Taglist = function(context) {
|
||||
}
|
||||
|
||||
function bindTypeahead() {
|
||||
var entity = list.datum(),
|
||||
geometry = entity.geometry(context.graph()),
|
||||
var geometry = entity.geometry(context.graph()),
|
||||
row = d3.select(this),
|
||||
key = row.selectAll('.key-wrap'),
|
||||
value = row.selectAll('.input-wrap-position');
|
||||
|
||||
Reference in New Issue
Block a user