fixes route drawing
This commit is contained in:
@@ -125,9 +125,14 @@ export class LayerManager {
|
||||
this.map.on('mouseleave', id, listener.onLeave);
|
||||
}
|
||||
|
||||
if (listener.onMouseDown && !this.addedListeners.has("click-" + id)) {
|
||||
this.addedListeners.add("click-" + id)
|
||||
this.map.on('click', id, listener.onMouseDown);
|
||||
if (listener.onMouseDown && !this.addedListeners.has("mousedown-" + id)) {
|
||||
this.addedListeners.add("mousedown-" + id)
|
||||
this.map.on('mousedown', id, listener.onMouseDown);
|
||||
}
|
||||
|
||||
if (listener.onMouseUp && !this.addedListeners.has("mouseup-" + id)) {
|
||||
this.addedListeners.add("mouseup-" + id)
|
||||
this.map.on('mouseup', id, listener.onMouseUp);
|
||||
}
|
||||
|
||||
if (listener.onMouseMove && !this.addedListeners.has("mousemove-" + id)) {
|
||||
@@ -188,7 +193,7 @@ export class LayerManager {
|
||||
}
|
||||
|
||||
private restoreLayers() {
|
||||
for (const [id, layer] of Object.entries(this.layers)) {
|
||||
for (const [id, layer] of Object.entries(this.layers)) {
|
||||
this.addLayer(id, layer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* Component adapted from: https://github.com/gpxstudio/gpx.studio/blob/main/website/src/lib/components/layer-control/OverpassLayer.ts
|
||||
* Original author: @vcoppe
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import { createOverpassPopup } from "$lib/util/maplibre_util";
|
||||
import * as M from "maplibre-gl";
|
||||
import { type LngLatBounds, type MapMouseEvent, type StyleSpecification } from "maplibre-gl";
|
||||
|
||||
@@ -29,6 +29,6 @@ export class TrailLayer implements BaseLayer {
|
||||
|
||||
};
|
||||
|
||||
this.listeners = { id: listerners ?? {} }
|
||||
this.listeners = { [id]: listerners ?? {} }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user