fix info box content and crash when drawing areas while info box is open

This commit is contained in:
Martin Raifer
2016-11-08 17:21:08 +01:00
parent 7d14d2b0b0
commit 7069ca8ef7
+7 -2
View File
@@ -6,6 +6,11 @@ import { geoExtent } from '../geo/index';
import { utilDetect } from '../util/detect';
import { uiCmd } from './cmd';
import {
geoLength as d3GeoLength,
geoCentroid as d3GeoCentroid
} from 'd3';
export function uiInfo(context) {
var key = uiCmd('⌘I'),
@@ -149,9 +154,9 @@ export function uiInfo(context) {
if (geometry === 'line' || geometry === 'area') {
var closed = (entity.type === 'relation') || (entity.isClosed() && !entity.isDegenerate()),
feature = entity.asGeoJSON(resolver),
length = radiansToMeters(d3.geoLength(toLineString(feature))),
length = radiansToMeters(d3GeoLength(toLineString(feature))),
lengthLabel = t('infobox.' + (closed ? 'perimeter' : 'length')),
centroid = d3.geoCentroid(feature);
centroid = d3GeoCentroid(feature);
list.append('li')
.text(t('infobox.geometry') + ': ' +