Fix:stabilize rotation if two maps are open

This commit is contained in:
Pieter Vander Vennet 2025-10-12 02:09:14 +02:00
parent 4c972bb60d
commit ee0a44c327

View file

@ -265,7 +265,12 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
})
this.zoom.addCallbackAndRunD((z) => this.setZoom(z))
this.maxbounds.addCallbackAndRun((bbox) => this.setMaxBounds(bbox))
this.rotation.addCallbackAndRunD((bearing) => this.setRotation(bearing))
/**
* We stabilize rotation
* IF two maps are open and have a linked rotation, they will send updates back and forth,
* causing a stack overflow
*/
this.rotation.stabilized(550).addCallbackAndRunD((bearing) => this.setRotation(bearing))
this.allowMoving.addCallbackAndRun((allowMoving) => {
this.setAllowMoving(allowMoving)
this.pingKeycodeEvent(allowMoving ? "unlocked" : "locked")