Do not try to compute geom based property before we have a geom
fix #1177
This commit is contained in:
parent
d56162390d
commit
38c29b9cc1
1 changed files with 18 additions and 7 deletions
|
@ -445,6 +445,7 @@ L.U.FeatureMixin = {
|
||||||
},
|
},
|
||||||
|
|
||||||
resetTooltip: function () {
|
resetTooltip: function () {
|
||||||
|
if (!this.hasGeom()) return
|
||||||
const displayName = this.getDisplayName(null)
|
const displayName = this.getDisplayName(null)
|
||||||
let showLabel = this.getOption('showLabel')
|
let showLabel = this.getOption('showLabel')
|
||||||
const oldLabelHover = this.getOption('labelHover')
|
const oldLabelHover = this.getOption('labelHover')
|
||||||
|
@ -495,15 +496,17 @@ L.U.FeatureMixin = {
|
||||||
extendedProperties: function () {
|
extendedProperties: function () {
|
||||||
// Include context properties
|
// Include context properties
|
||||||
properties = this.map.getGeoContext()
|
properties = this.map.getGeoContext()
|
||||||
center = this.getCenter()
|
|
||||||
properties.lat = center.lat
|
|
||||||
properties.lon = center.lng
|
|
||||||
properties.lng = center.lng
|
|
||||||
properties.rank = this.getRank() + 1
|
|
||||||
if (L.locale) properties.locale = L.locale
|
if (L.locale) properties.locale = L.locale
|
||||||
if (L.lang) properties.lang = L.lang
|
if (L.lang) properties.lang = L.lang
|
||||||
if (typeof this.getMeasure !== 'undefined') {
|
properties.rank = this.getRank() + 1
|
||||||
properties.measure = this.getMeasure()
|
if (this.hasGeom()) {
|
||||||
|
center = this.getCenter()
|
||||||
|
properties.lat = center.lat
|
||||||
|
properties.lon = center.lng
|
||||||
|
properties.lng = center.lng
|
||||||
|
if (typeof this.getMeasure !== 'undefined') {
|
||||||
|
properties.measure = this.getMeasure()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return L.extend(properties, this.properties)
|
return L.extend(properties, this.properties)
|
||||||
},
|
},
|
||||||
|
@ -536,6 +539,10 @@ L.U.Marker = L.Marker.extend({
|
||||||
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hasGeom: function () {
|
||||||
|
return !!this._latlng
|
||||||
|
},
|
||||||
|
|
||||||
_onMouseOut: function () {
|
_onMouseOut: function () {
|
||||||
if (
|
if (
|
||||||
this.dragging &&
|
this.dragging &&
|
||||||
|
@ -680,6 +687,10 @@ L.U.Marker = L.Marker.extend({
|
||||||
})
|
})
|
||||||
|
|
||||||
L.U.PathMixin = {
|
L.U.PathMixin = {
|
||||||
|
hasGeom: function () {
|
||||||
|
return !this.isEmpty()
|
||||||
|
},
|
||||||
|
|
||||||
connectToDataLayer: function (datalayer) {
|
connectToDataLayer: function (datalayer) {
|
||||||
L.U.FeatureMixin.connectToDataLayer.call(this, datalayer)
|
L.U.FeatureMixin.connectToDataLayer.call(this, datalayer)
|
||||||
// We keep markers on their own layer on top of the paths.
|
// We keep markers on their own layer on top of the paths.
|
||||||
|
|
Loading…
Reference in a new issue