mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-11 12:17:14 +02:00
fix dependency cycle caused by utilDisplayLabel importing presetManager
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { remove as removeDiacritics } from 'diacritics';
|
||||
import { fixRTLTextForSvg, rtlRegex } from './svg_paths_rtl_fix';
|
||||
|
||||
import { presetManager } from '../presets';
|
||||
import { t, localizer } from '../core/localizer';
|
||||
import { utilArrayUnion } from './array';
|
||||
import { utilDetect } from './detect';
|
||||
@@ -244,32 +243,6 @@ export function utilDisplayType(id) {
|
||||
}
|
||||
|
||||
|
||||
// `utilDisplayLabel`
|
||||
// Returns a string suitable for display
|
||||
// By default returns something like name/ref, fallback to preset type, fallback to OSM type
|
||||
// "Main Street" or "Tertiary Road"
|
||||
// If `verbose=true`, include both preset name and feature name.
|
||||
// "Tertiary Road Main Street"
|
||||
//
|
||||
export function utilDisplayLabel(entity, graphOrGeometry, verbose) {
|
||||
var result;
|
||||
var displayName = utilDisplayName(entity);
|
||||
var preset = typeof graphOrGeometry === 'string' ?
|
||||
presetManager.matchTags(entity.tags, graphOrGeometry) :
|
||||
presetManager.match(entity, graphOrGeometry);
|
||||
var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
|
||||
|
||||
if (verbose) {
|
||||
result = [presetName, displayName].filter(Boolean).join(' ');
|
||||
} else {
|
||||
result = displayName || presetName;
|
||||
}
|
||||
|
||||
// Fallback to the OSM type (node/way/relation)
|
||||
return result || utilDisplayType(entity.id);
|
||||
}
|
||||
|
||||
|
||||
export function utilEntityRoot(entityType) {
|
||||
return {
|
||||
node: 'n',
|
||||
|
||||
Reference in New Issue
Block a user