From 9d172206fedb94ace123266a3f66a7b4d98fb949 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 03:02:30 -0800 Subject: [PATCH] `useBoolean().toggle` replaces `useBoolean().set` --- public/script/leaflet-fullscreen.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 7d87627..12cb368 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -11,8 +11,8 @@ function useBoolean(initialValue = false) { get() { return state }, - set(newState) { - state = newState + toggle() { + state = !state }, } } @@ -48,7 +48,7 @@ export function fullscreenMap({ id, ...mapOptions }) { - const { get: getFullscreen, set: setFullscreen } = useBoolean(), + const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(), control = leafletControl({ position }), map = leafletMap(id, mapOptions) @@ -106,7 +106,7 @@ export function fullscreenMap({ document.msFullscreenElement) ) { if (!fullscreen) { - setFullscreen(true) + toggleFullscreen() DomUtil.addClass(container, 'leaflet-fullscreen-on') @@ -114,7 +114,7 @@ export function fullscreenMap({ map.fire('fullscreenchange') } } else if (fullscreen) { - setFullscreen(false) + toggleFullscreen() DomUtil.removeClass(container, 'leaflet-fullscreen-on')