From 92e9e578f7d4632d894420061477002e9a17f850 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 18:04:09 -0800 Subject: [PATCH] `updateTitle` restores dynamic title update functionality of original fullscreen control extension --- public/script/leaflet-fullscreen.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 77fb0ee..86e1762 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -58,6 +58,13 @@ function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { toggleFullscreen(map, mergedOptions, getFullscreen, setFullscreen) }) + function updateTitle() { + Object.assign(link, { title: mergedOptions.title[getFullscreen()] }) + } + + updateTitle() + map.on('fullscreenchange', updateTitle) + return container }