Skip to content

Commit f559f48

Browse files
committed
fix(ios): fullscreen API not supported
1 parent 0e85227 commit f559f48

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/js/controls.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ const addControls = () => {
9797
// contrôle fullscreen
9898
map.addControl(new maplibregl.FullscreenControl(), "top-right");
9999
DOM.$fullScreenBtn = document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl");
100+
DOM.$fullScreenBtn.addEventListener("click", () => {
101+
setTimeout(() => {
102+
if (DOM.$fullScreenBtn.querySelector("button").classList.contains("maplibregl-ctrl-shrink")) {
103+
DOM.$map.appendChild(DOM.$interactivityBtn);
104+
DOM.$map.appendChild(DOM.$mapScale);
105+
Globals.interactivityIndicator.hardDisable();
106+
} else {
107+
DOM.$map.parentNode.parentNode.appendChild(DOM.$interactivityBtn);
108+
DOM.$bottomButtons.appendChild(DOM.$mapScale);
109+
Globals.interactivityIndicator.enable();
110+
}
111+
}, 50);
112+
});
100113

101114
// contrôle d'intéractivité de la carte
102115
Globals.mapInteractivity = new MapInteractivity(map, {});

src/js/event-listeners.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -301,18 +301,6 @@ function addListeners() {
301301
}
302302
});
303303
});
304-
305-
DOM.$map.addEventListener("fullscreenchange", () => {
306-
if (document.fullscreenElement) {
307-
DOM.$map.appendChild(DOM.$interactivityBtn);
308-
DOM.$map.appendChild(DOM.$mapScale);
309-
Globals.interactivityIndicator.hardDisable();
310-
} else {
311-
DOM.$map.parentNode.parentNode.appendChild(DOM.$interactivityBtn);
312-
DOM.$bottomButtons.appendChild(DOM.$mapScale);
313-
Globals.interactivityIndicator.enable();
314-
}
315-
});
316304
}
317305

318306
export default {

0 commit comments

Comments
 (0)