move changes to svg display name

This commit is contained in:
Nick Doiron
2017-01-03 18:18:18 +08:00
parent af1ac89df7
commit 94ee7d4916
3 changed files with 9 additions and 19 deletions

View File

@@ -7,8 +7,6 @@ import { geoExtent } from '../geo/index';
import { osmEntity, osmNode, osmRelation, osmWay } from '../osm/index';
import { utilDetect } from '../util/detect';
import { utilRebind } from '../util/rebind';
import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix';
var dispatch = d3.dispatch('authLoading', 'authDone', 'change', 'loading', 'loaded'),
useHttps = window.location.protocol === 'https:',
@@ -71,12 +69,7 @@ function getTags(obj) {
var attrs = elems[i].attributes;
tags[attrs.k.value] = attrs.v.value;
}
var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1
var arabicRegex = /[\u0600-\u06FF]/g
if(tags.name && tags.highway && !isFirefox && arabicRegex.test(tags.name)){
tags.real_name = tags.name;
tags.name = fixArabicScriptTextForSvg(tags.real_name);
}
return tags;
}

View File

@@ -12,8 +12,6 @@ import { uiRawTagEditor } from './raw_tag_editor';
import { uiTagReference } from './tag_reference';
import { uiPreset } from './preset';
import { utilRebind } from '../util/rebind';
import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix';
export function uiEntityEditor(context) {
var dispatch = d3.dispatch('choose'),
@@ -225,14 +223,6 @@ export function uiEntityEditor(context) {
tags[k] = v;
}
});
var arabicRegex = /[\u0600-\u06FF]/g
if(tags.highway && tags.real_name){
if(arabicRegex.test(tags.real_name)){
tags.name = fixArabicScriptTextForSvg(tags.real_name);
} else{
tags.name = tags.real_name;
}
}
if (!onInput) {
tags = clean(tags);

View File

@@ -2,7 +2,7 @@ import * as d3 from 'd3';
import { t, textDirection } from './locale';
import { utilDetect } from './detect';
import { remove as removeDiacritics } from 'diacritics';
import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix';
export function utilTagText(entity) {
return d3.entries(entity.tags).map(function(e) {
@@ -66,6 +66,13 @@ export function utilDisplayName(entity) {
name = network + ' ' + name;
}
}
var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1
var arabicRegex = /[\u0600-\u06FF]/g
if(!isFirefox && name && entity.tags.highway && arabicRegex.test(name)){
name = fixArabicScriptTextForSvg(name);
}
return name;
}