mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 00:29:50 +02:00
revert field button
This commit is contained in:
+1
-144
@@ -13,7 +13,6 @@ import { isColourValid } from '../../osm/tags';
|
||||
import { uiLengthIndicator } from '..';
|
||||
import { uiTooltip } from '../tooltip';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import { services } from '../../services';
|
||||
|
||||
export {
|
||||
uiFieldText as uiFieldColour,
|
||||
@@ -31,8 +30,6 @@ export function uiFieldText(field, context) {
|
||||
var dispatch = d3_dispatch('change');
|
||||
var input = d3_select(null);
|
||||
var outlinkButton = d3_select(null);
|
||||
var mapillaryViewButton = d3_select(null);
|
||||
var mapillarySetButton = d3_select(null);
|
||||
var wrap = d3_select(null);
|
||||
var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
|
||||
var _entityIDs = [];
|
||||
@@ -172,12 +169,8 @@ export function uiFieldText(field, context) {
|
||||
change()();
|
||||
});
|
||||
} else if (field.type === 'identifier' && field.urlFormat && field.pattern) {
|
||||
|
||||
input.attr('type', 'text');
|
||||
|
||||
if (field.id === 'mapillary') {
|
||||
updateMapillaryImageIDField();
|
||||
}
|
||||
|
||||
outlinkButton = wrap.selectAll('.foreign-id-permalink')
|
||||
.data([0]);
|
||||
|
||||
@@ -362,116 +355,6 @@ export function uiFieldText(field, context) {
|
||||
if (format) input.attr('placeholder', format);
|
||||
}
|
||||
|
||||
function updateMapillaryImageIDField() {
|
||||
const service = services.mapillary;
|
||||
// set button
|
||||
mapillarySetButton = wrap.selectAll('.mapillary-set-current')
|
||||
.data([0]);
|
||||
|
||||
mapillarySetButton.enter()
|
||||
.append('button')
|
||||
.attr('class', 'form-field-button mapillary-set-current')
|
||||
.call(svgIcon('#fas-rotate'))
|
||||
.attr('title', t('inspector.set_photo_from_field'))
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return;
|
||||
if (image.id === utilGetSetValue(input).trim()) return;
|
||||
service
|
||||
.ensureViewerLoaded(context)
|
||||
.then(function() {
|
||||
utilGetSetValue(input, image.id);
|
||||
change()();
|
||||
});
|
||||
mapillarySetButton.node()?.blur();
|
||||
})
|
||||
.merge(mapillarySetButton)
|
||||
.classed('disabled', _debounce(() => {
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return true;
|
||||
if (image.id === utilGetSetValue(input).trim()) return true;
|
||||
return false;
|
||||
}), 100);
|
||||
|
||||
// view button
|
||||
mapillaryViewButton = wrap.selectAll('.mapillary-show-view')
|
||||
.data([0]);
|
||||
|
||||
mapillaryViewButton.enter()
|
||||
.append('button')
|
||||
.attr('class', 'form-field-button mapillary-show-view')
|
||||
.call(svgIcon('#fas-eye'))
|
||||
.attr('title', t('inspector.show_photo_from_field'))
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
const isHidden = context.container()
|
||||
.select('.photoviewer')
|
||||
.selectAll('.photo-wrapper.mly-wrapper.hide')
|
||||
.size();
|
||||
|
||||
if (isHidden) {
|
||||
if (!utilGetSetValue(input).trim()) return;
|
||||
|
||||
service
|
||||
.ensureViewerLoaded(context)
|
||||
.then(function() {
|
||||
service
|
||||
.selectImage(context, utilGetSetValue(input).trim())
|
||||
.showViewer(context);
|
||||
});
|
||||
mapillaryViewButton.classed('disabled', true);
|
||||
} else {
|
||||
if (!utilGetSetValue(input).trim()) return;
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return;
|
||||
if (image.id === utilGetSetValue(input).trim()) return;
|
||||
|
||||
service
|
||||
.ensureViewerLoaded(context)
|
||||
.then(function() {
|
||||
service
|
||||
.selectImage(context, utilGetSetValue(input).trim());
|
||||
});
|
||||
}
|
||||
mapillaryViewButton.node()?.blur();
|
||||
})
|
||||
.merge(mapillaryViewButton)
|
||||
.classed('disabled', _debounce(() => {
|
||||
if (!utilGetSetValue(input).trim()) return true;
|
||||
const isHidden = context.container()
|
||||
.select('.photoviewer')
|
||||
.selectAll('.photo-wrapper.mly-wrapper.hide')
|
||||
.size();
|
||||
if (isHidden) return false;
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return true;
|
||||
if (image.id === utilGetSetValue(input).trim()) return true;
|
||||
return false;
|
||||
}, 100));
|
||||
|
||||
service.on('imageChanged', function() {
|
||||
mapillarySetButton.classed('disabled', () => {
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return true;
|
||||
if (image.id === utilGetSetValue(input).trim()) return true;
|
||||
return false;
|
||||
});
|
||||
mapillaryViewButton.classed('disabled', () => {
|
||||
const isHidden = context.container()
|
||||
.select('.photoviewer')
|
||||
.selectAll('.photo-wrapper.mly-wrapper.hide')
|
||||
.size();
|
||||
if (isHidden) return false;
|
||||
if (!utilGetSetValue(input).trim()) return true;
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return true;
|
||||
if (image.id === utilGetSetValue(input).trim()) return true;
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function validIdentifierValueForLink() {
|
||||
const value = utilGetSetValue(input).trim();
|
||||
@@ -642,32 +525,6 @@ export function uiFieldText(field, context) {
|
||||
outlinkButton.classed('disabled', disabled);
|
||||
}
|
||||
|
||||
if (mapillarySetButton && !mapillarySetButton.empty()) {
|
||||
const service = services.mapillary;
|
||||
mapillarySetButton.classed('disabled', () => {
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return true;
|
||||
if (image.id === utilGetSetValue(input).trim()) return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (mapillaryViewButton && !mapillaryViewButton.empty()) {
|
||||
const service = services.mapillary;
|
||||
mapillaryViewButton.classed('disabled', () => {
|
||||
if (!utilGetSetValue(input).trim()) return true;
|
||||
const isHidden = context.container()
|
||||
.select('.photoviewer')
|
||||
.selectAll('.photo-wrapper.mly-wrapper.hide')
|
||||
.size();
|
||||
if (isHidden) return false;
|
||||
const image = service.getActiveImage();
|
||||
if (!image) return true;
|
||||
if (image.id === utilGetSetValue(input).trim()) return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (!isMixed) {
|
||||
_lengthIndicator.update(tags[field.key]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user