From a88aa4c8a057b600faa4538a7b7ca63545af2f6f Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 24 Apr 2026 00:36:18 +0000 Subject: [PATCH] Change cursor when the user hovers over a layer --- ts/map/Map.vue | 14 +++++++++++++- ts/view/Dash.vue | 8 +++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ts/map/Map.vue b/ts/map/Map.vue index 30657708..6d60b5eb 100644 --- a/ts/map/Map.vue +++ b/ts/map/Map.vue @@ -25,15 +25,19 @@ import { ref, type Ref, shallowRef, + watch, } from "vue"; interface Props { bounds?: maplibregl.LngLatBounds; center?: maplibregl.LngLatLike; + cursor?: string; zoom?: number; } -const props = withDefaults(defineProps(), {}); +const props = withDefaults(defineProps(), { + cursor: "", +}); const mapDiv = ref(null); const map: Ref = shallowRef(null); @@ -150,4 +154,12 @@ onBeforeUnmount(() => { map.value.remove(); } }); +watch( + () => props.cursor, + (newCursor) => { + if (map.value && map.value.loaded()) { + map.value.getCanvas().style.cursor = newCursor; + } + }, +); diff --git a/ts/view/Dash.vue b/ts/view/Dash.vue index 854bd43d..0deca7b2 100644 --- a/ts/view/Dash.vue +++ b/ts/view/Dash.vue @@ -135,6 +135,7 @@