fix: add back slideshow.setOptions method, called from U.Map

This commit is contained in:
Yohan Boniface 2024-07-12 15:18:52 +02:00
parent a51cc8102f
commit b4d13304f0
2 changed files with 12 additions and 12 deletions

View file

@ -18,13 +18,7 @@ export default class Slideshow extends WithTemplate {
this.map = map this.map = map
this._id = null this._id = null
this.CLASSNAME = 'umap-slideshow-active' this.CLASSNAME = 'umap-slideshow-active'
this.options = Object.assign( this.setOptions(options)
{
delay: 5000,
autoplay: false,
},
options
)
this._current = null this._current = null
if (this.options.autoplay) { if (this.options.autoplay) {
@ -60,6 +54,16 @@ export default class Slideshow extends WithTemplate {
return this.current.getNext() return this.current.getNext()
} }
setOptions(options) {
this.options = Object.assign(
{
delay: 5000,
autoplay: false,
},
options
)
}
defaultDatalayer() { defaultDatalayer() {
return this.map.findDataLayer((d) => d.canBrowse()) return this.map.findDataLayer((d) => d.canBrowse())
} }

View file

@ -1469,12 +1469,8 @@ U.Map = L.Map.extend({
{ handler: 'Switch', label: L._('Autostart when map is loaded') }, { handler: 'Switch', label: L._('Autostart when map is loaded') },
], ],
] ]
const slideshowHandler = function () {
this.slideshow.setOptions(this.options.slideshow)
}
const slideshowBuilder = new U.FormBuilder(this, slideshowFields, { const slideshowBuilder = new U.FormBuilder(this, slideshowFields, {
callback: slideshowHandler, callback: () => this.slideshow.setOptions(this.options.slideshow),
callbackContext: this,
}) })
slideshow.appendChild(slideshowBuilder.build()) slideshow.appendChild(slideshowBuilder.build())
}, },