mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
fix: feature.isOnScreen is now passing the "bounds" argument
Otherwise, when using the browser, we'll end up using this._map.getBounds(), but in this case the UI may not be in the map (may be filtered).
This commit is contained in:
parent
dd79e8f923
commit
c879914eb8
2 changed files with 4 additions and 6 deletions
|
@ -98,8 +98,8 @@ class Feature {
|
||||||
this.pushGeometry()
|
this.pushGeometry()
|
||||||
}
|
}
|
||||||
|
|
||||||
isOnScreen() {
|
isOnScreen(bounds) {
|
||||||
return this.ui?.isOnScreen()
|
return this.ui?.isOnScreen(bounds)
|
||||||
}
|
}
|
||||||
|
|
||||||
pushGeometry() {
|
pushGeometry() {
|
||||||
|
@ -261,7 +261,7 @@ class Feature {
|
||||||
builder.helpers['properties.name'].input.focus()
|
builder.helpers['properties.name'].input.focus()
|
||||||
})
|
})
|
||||||
this.map.editedFeature = this
|
this.map.editedFeature = this
|
||||||
if (!this.ui.isOnScreen()) this.zoomTo(event)
|
if (!this.ui.isOnScreen(this.map.getBounds())) this.zoomTo(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAdvancedEditActions(container) {
|
getAdvancedEditActions(container) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ const FeatureMixin = {
|
||||||
text: translate('Copy as GeoJSON'),
|
text: translate('Copy as GeoJSON'),
|
||||||
callback: () => {
|
callback: () => {
|
||||||
L.Util.copyToClipboard(JSON.stringify(this.feature.toGeoJSON()))
|
L.Util.copyToClipboard(JSON.stringify(this.feature.toGeoJSON()))
|
||||||
this._map.tooltip.open({content: L._('Copied!')})
|
this._map.tooltip.open({ content: L._('Copied!') })
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (this._map.editEnabled && !this.feature.isReadOnly()) {
|
if (this._map.editEnabled && !this.feature.isReadOnly()) {
|
||||||
|
@ -156,7 +156,6 @@ const FeatureMixin = {
|
||||||
|
|
||||||
const PointMixin = {
|
const PointMixin = {
|
||||||
isOnScreen: function (bounds) {
|
isOnScreen: function (bounds) {
|
||||||
bounds = bounds || this._map.getBounds()
|
|
||||||
return bounds.contains(this.getCenter())
|
return bounds.contains(this.getCenter())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -428,7 +427,6 @@ const PathMixin = {
|
||||||
],
|
],
|
||||||
|
|
||||||
isOnScreen: function (bounds) {
|
isOnScreen: function (bounds) {
|
||||||
bounds = bounds || this._map.getBounds()
|
|
||||||
return bounds.overlaps(this.getBounds())
|
return bounds.overlaps(this.getBounds())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue