Skip to content

Commit

Permalink
useBoolean().toggle replaces useBoolean().set
Browse files Browse the repository at this point in the history
  • Loading branch information
Stassi committed Nov 13, 2024
1 parent 566a35e commit 9d17220
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions public/script/leaflet-fullscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function useBoolean(initialValue = false) {
get() {
return state
},
set(newState) {
state = newState
toggle() {
state = !state
},
}
}
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -106,15 +106,15 @@ export function fullscreenMap({
document.msFullscreenElement)
) {
if (!fullscreen) {
setFullscreen(true)
toggleFullscreen()

DomUtil.addClass(container, 'leaflet-fullscreen-on')

map.invalidateSize()
map.fire('fullscreenchange')
}
} else if (fullscreen) {
setFullscreen(false)
toggleFullscreen()

DomUtil.removeClass(container, 'leaflet-fullscreen-on')

Expand Down

0 comments on commit 9d17220

Please sign in to comment.