Skip to content

Commit

Permalink
Fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Mar 2, 2024
1 parent b13025c commit fdd174b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/lib/utils/draw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function moveMarker(markerId: ID, context: FacilMapContext, toasts: Toast
const mapContext = requireMapContext(context);
const client = requireClientContext(context);

const markerLayer = mapContext.value.components.markersLayer.markersById[markerId];
const markerLayer = mapContext.value.components.markersLayer.getLayerByMarkerId(markerId);
if(!markerLayer)
return;

Expand All @@ -48,7 +48,7 @@ export function moveMarker(markerId: ID, context: FacilMapContext, toasts: Toast
mapContext.value.components.map.fire('fmInteractionStart');
mapContext.value.components.markersLayer.lockMarker(markerId);

async function finish(save: boolean) {
const finish = async (save: boolean) => {
toasts.hideToast("fm-draw-drag-marker");

markerLayer.dragging!.disable();
Expand All @@ -64,7 +64,7 @@ export function moveMarker(markerId: ID, context: FacilMapContext, toasts: Toast

mapContext.value.components.markersLayer.unlockMarker(markerId);
mapContext.value.components.map.fire('fmInteractionEnd');
}
};

toasts.showToast("fm-draw-drag-marker", "Drag marker", "Drag the marker to reposition it.", {
noCloseButton: true,
Expand Down
4 changes: 4 additions & 0 deletions leaflet/src/markers/markers-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ export default class MarkersLayer extends MarkerCluster {
this._deleteMarker(this.client.markers[id]);
}

getLayerByMarkerId(markerId: ID): MarkerLayer | undefined {
return this.markersById[markerId];
}

protected _addMarker(marker: Marker): void {
const updatePos = !this.markersById[marker.id] || !this.lockedMarkerIds.has(marker.id);

Expand Down

0 comments on commit fdd174b

Please sign in to comment.