- Added fullscreen and measurement mode buttons for improved map interaction. - Introduced a bookmarks section to save and navigate to locations easily. - Implemented a search feature for quick access to coordinates and markers. - Added keyboard shortcuts overlay for enhanced usability. - Refactored MapControls and MapControlsContent to support new functionalities. - Introduced new icon components for better visual representation in the UI.
29 lines
821 B
TypeScript
29 lines
821 B
TypeScript
/**
|
|
* Composable for map navigation (go-to coordinates) and focus search.
|
|
* MapView registers the implementation on mount; MapSearch and shortcuts use it.
|
|
*/
|
|
type GoToCoordsFn = (mapId: number, x: number, y: number, zoom?: number) => void
|
|
|
|
const goToImpl = ref<GoToCoordsFn | null>(null)
|
|
const focusSearchImpl = ref<(() => void) | null>(null)
|
|
|
|
export function useMapNavigate() {
|
|
function setGoTo(fn: GoToCoordsFn | null) {
|
|
goToImpl.value = fn
|
|
}
|
|
|
|
function goToCoords(mapId: number, x: number, y: number, zoom?: number) {
|
|
goToImpl.value?.(mapId, x, y, zoom)
|
|
}
|
|
|
|
function setFocusSearch(fn: (() => void) | null) {
|
|
focusSearchImpl.value = fn
|
|
}
|
|
|
|
function focusSearch() {
|
|
focusSearchImpl.value?.()
|
|
}
|
|
|
|
return { setGoTo, goToCoords, setFocusSearch, focusSearch }
|
|
}
|