mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
Some variables and formatting
This commit is contained in:
@@ -20,7 +20,7 @@ export function uiEntityEditor(context) {
|
||||
coalesceChanges = false,
|
||||
modified = false,
|
||||
base,
|
||||
id,
|
||||
entityId,
|
||||
activePreset,
|
||||
reference;
|
||||
|
||||
@@ -31,7 +31,7 @@ export function uiEntityEditor(context) {
|
||||
|
||||
|
||||
function entityEditor(selection) {
|
||||
var entity = context.entity(id),
|
||||
var entity = context.entity(entityId),
|
||||
tags = _.clone(entity.tags);
|
||||
|
||||
// Header
|
||||
@@ -63,7 +63,9 @@ export function uiEntityEditor(context) {
|
||||
.merge(enter);
|
||||
|
||||
header.selectAll('.preset-reset')
|
||||
.on('click', function() { dispatch.call('choose', this, activePreset); });
|
||||
.on('click', function() {
|
||||
dispatch.call('choose', this, activePreset);
|
||||
});
|
||||
|
||||
|
||||
// Body
|
||||
@@ -119,12 +121,15 @@ export function uiEntityEditor(context) {
|
||||
.call(reference.body);
|
||||
|
||||
body.selectAll('.preset-reset')
|
||||
.on('click', function() { dispatch.call('choose', this, activePreset); });
|
||||
.on('click', function() {
|
||||
dispatch.call('choose', this, activePreset);
|
||||
});
|
||||
|
||||
body.select('.preset-list-item button')
|
||||
.call(uiPresetIcon()
|
||||
.geometry(context.geometry(id))
|
||||
.preset(activePreset));
|
||||
.geometry(context.geometry(entityId))
|
||||
.preset(activePreset)
|
||||
);
|
||||
|
||||
body.select('.preset-list-item .label')
|
||||
.text(activePreset.name());
|
||||
@@ -132,22 +137,25 @@ export function uiEntityEditor(context) {
|
||||
body.select('.preset-editor')
|
||||
.call(presetEditor
|
||||
.preset(activePreset)
|
||||
.entityID(id)
|
||||
.entityID(entityId)
|
||||
.tags(tags)
|
||||
.state(state));
|
||||
.state(state)
|
||||
);
|
||||
|
||||
body.select('.raw-tag-editor')
|
||||
.call(rawTagEditor
|
||||
.preset(activePreset)
|
||||
.entityID(id)
|
||||
.entityID(entityId)
|
||||
.tags(tags)
|
||||
.state(state));
|
||||
.state(state)
|
||||
);
|
||||
|
||||
if (entity.type === 'relation') {
|
||||
body.select('.raw-member-editor')
|
||||
.style('display', 'block')
|
||||
.call(uiRawMemberEditor(context)
|
||||
.entityID(id));
|
||||
.entityID(entityId)
|
||||
);
|
||||
} else {
|
||||
body.select('.raw-member-editor')
|
||||
.style('display', 'none');
|
||||
@@ -155,7 +163,8 @@ export function uiEntityEditor(context) {
|
||||
|
||||
body.select('.raw-membership-editor')
|
||||
.call(uiRawMembershipEditor(context)
|
||||
.entityID(id));
|
||||
.entityID(entityId)
|
||||
);
|
||||
|
||||
body.select('.key-trap')
|
||||
.on('keydown.key-trap', function() {
|
||||
@@ -174,7 +183,7 @@ export function uiEntityEditor(context) {
|
||||
function historyChanged() {
|
||||
if (state === 'hide') return;
|
||||
|
||||
var entity = context.hasEntity(id),
|
||||
var entity = context.hasEntity(entityId),
|
||||
graph = context.graph();
|
||||
if (!entity) return;
|
||||
|
||||
@@ -226,7 +235,7 @@ export function uiEntityEditor(context) {
|
||||
// Tag changes that fire on input can all get coalesced into a single
|
||||
// history operation when the user leaves the field. #2342
|
||||
function changeTags(changed, onInput) {
|
||||
var entity = context.entity(id),
|
||||
var entity = context.entity(entityId),
|
||||
annotation = t('operations.change_tags.annotation'),
|
||||
tags = _.clone(entity.tags);
|
||||
|
||||
@@ -242,9 +251,9 @@ export function uiEntityEditor(context) {
|
||||
|
||||
if (!_.isEqual(entity.tags, tags)) {
|
||||
if (coalesceChanges) {
|
||||
context.overwrite(actionChangeTags(id, tags), annotation);
|
||||
context.overwrite(actionChangeTags(entityId, tags), annotation);
|
||||
} else {
|
||||
context.perform(actionChangeTags(id, tags), annotation);
|
||||
context.perform(actionChangeTags(entityId, tags), annotation);
|
||||
coalesceChanges = !!onInput;
|
||||
}
|
||||
}
|
||||
@@ -267,10 +276,10 @@ export function uiEntityEditor(context) {
|
||||
|
||||
|
||||
entityEditor.entityID = function(_) {
|
||||
if (!arguments.length) return id;
|
||||
id = _;
|
||||
if (!arguments.length) return entityId;
|
||||
entityId = _;
|
||||
base = context.graph();
|
||||
entityEditor.preset(context.presets().match(context.entity(id), base));
|
||||
entityEditor.preset(context.presets().match(context.entity(entityId), base));
|
||||
entityEditor.modified(false);
|
||||
coalesceChanges = false;
|
||||
return entityEditor;
|
||||
@@ -281,7 +290,7 @@ export function uiEntityEditor(context) {
|
||||
if (!arguments.length) return activePreset;
|
||||
if (_ !== activePreset) {
|
||||
activePreset = _;
|
||||
reference = uiTagReference(activePreset.reference(context.geometry(id)), context)
|
||||
reference = uiTagReference(activePreset.reference(context.geometry(entityId)), context)
|
||||
.showing(false);
|
||||
}
|
||||
return entityEditor;
|
||||
|
||||
@@ -142,6 +142,7 @@ export function uiField(context, dispatch, presetField, entity, show) {
|
||||
field.tags = function(_) {
|
||||
if (!arguments.length) return tags;
|
||||
tags = _;
|
||||
// field.impl.tags(tags);
|
||||
return field;
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export function uiPresetEditor(context) {
|
||||
fieldsArr,
|
||||
preset,
|
||||
tags,
|
||||
id;
|
||||
entityId;
|
||||
|
||||
|
||||
function presetEditor(selection) {
|
||||
@@ -38,8 +38,8 @@ export function uiPresetEditor(context) {
|
||||
|
||||
function render(selection) {
|
||||
if (!fieldsArr) {
|
||||
var entity = context.entity(id),
|
||||
geometry = context.geometry(id),
|
||||
var entity = context.entity(entityId),
|
||||
geometry = context.geometry(entityId),
|
||||
presets = context.presets();
|
||||
|
||||
fieldsArr = [];
|
||||
@@ -108,7 +108,7 @@ export function uiPresetEditor(context) {
|
||||
}
|
||||
});
|
||||
|
||||
d.tags(tags);
|
||||
// d.tags(tags);
|
||||
});
|
||||
|
||||
|
||||
@@ -197,9 +197,9 @@ export function uiPresetEditor(context) {
|
||||
|
||||
|
||||
presetEditor.entityID = function(_) {
|
||||
if (!arguments.length) return id;
|
||||
if (id === _) return presetEditor;
|
||||
id = _;
|
||||
if (!arguments.length) return entityId;
|
||||
if (entityId === _) return presetEditor;
|
||||
entityId = _;
|
||||
fieldsArr = null;
|
||||
return presetEditor;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user