Merge pull request #1750 from umap-project/latest-open-popup
feat: open popup when default view is set to latest
This commit is contained in:
commit
9a46901795
3 changed files with 11 additions and 13 deletions
|
@ -307,16 +307,15 @@ U.FeatureMixin = {
|
|||
return value
|
||||
},
|
||||
|
||||
zoomTo: function (e) {
|
||||
e = e || {}
|
||||
const easing = e.easing !== undefined ? e.easing : this.map.getOption('easing')
|
||||
zoomTo: function ({ easing, latlng, callback } = {}) {
|
||||
if (easing === undefined) easing = this.map.getOption('easing')
|
||||
if (callback) this.map.once('moveend', callback.call(this))
|
||||
if (easing) {
|
||||
this.map.flyTo(this.getCenter(), this.getBestZoom())
|
||||
} else {
|
||||
const latlng = e.latlng || this.getCenter()
|
||||
latlng = latlng || this.getCenter()
|
||||
this.map.setView(latlng, this.getBestZoom() || this.map.getZoom())
|
||||
}
|
||||
if (e.callback) e.callback.call(this)
|
||||
},
|
||||
|
||||
getBestZoom: function () {
|
||||
|
|
|
@ -82,7 +82,6 @@ U.Map = L.Map.extend({
|
|||
.split(',')
|
||||
}
|
||||
|
||||
|
||||
let editedFeature = null
|
||||
const self = this
|
||||
try {
|
||||
|
@ -335,7 +334,6 @@ U.Map = L.Map.extend({
|
|||
if (this.options.editMode === 'advanced') {
|
||||
new U.SettingsToolbar({ actions: editActions }).addTo(this)
|
||||
}
|
||||
|
||||
}
|
||||
this._controls.zoom = new L.Control.Zoom({
|
||||
zoomInTitle: L._('Zoom in'),
|
||||
|
@ -717,7 +715,7 @@ U.Map = L.Map.extend({
|
|||
if (datalayer) {
|
||||
const feature = datalayer.getFeatureByIndex(-1)
|
||||
if (feature) {
|
||||
feature.zoomTo()
|
||||
feature.zoomTo({ callback: this.options.noControl ? null : feature.view })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ def test_default_view_latest_with_marker(map, live_server, datalayer, page):
|
|||
expect(page).to_have_url(re.compile(r".*#7/48\..+/14\..+"))
|
||||
layers = page.locator(".umap-browser .datalayer h5")
|
||||
expect(layers).to_have_count(1)
|
||||
expect(page.locator(".leaflet-popup")).to_be_visible()
|
||||
|
||||
|
||||
def test_default_view_latest_with_line(map, live_server, page):
|
||||
|
|
Loading…
Reference in a new issue