Skip to content

Commit

Permalink
fix(ios): fullscreen API not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
azarz committed Oct 21, 2024
1 parent 0e85227 commit f559f48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
13 changes: 13 additions & 0 deletions src/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ const addControls = () => {
// contrôle fullscreen
map.addControl(new maplibregl.FullscreenControl(), "top-right");
DOM.$fullScreenBtn = document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl");
DOM.$fullScreenBtn.addEventListener("click", () => {
setTimeout(() => {
if (DOM.$fullScreenBtn.querySelector("button").classList.contains("maplibregl-ctrl-shrink")) {
DOM.$map.appendChild(DOM.$interactivityBtn);
DOM.$map.appendChild(DOM.$mapScale);
Globals.interactivityIndicator.hardDisable();
} else {
DOM.$map.parentNode.parentNode.appendChild(DOM.$interactivityBtn);
DOM.$bottomButtons.appendChild(DOM.$mapScale);
Globals.interactivityIndicator.enable();
}
}, 50);
});

// contrôle d'intéractivité de la carte
Globals.mapInteractivity = new MapInteractivity(map, {});
Expand Down
12 changes: 0 additions & 12 deletions src/js/event-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,18 +301,6 @@ function addListeners() {
}
});
});

DOM.$map.addEventListener("fullscreenchange", () => {
if (document.fullscreenElement) {
DOM.$map.appendChild(DOM.$interactivityBtn);
DOM.$map.appendChild(DOM.$mapScale);
Globals.interactivityIndicator.hardDisable();
} else {
DOM.$map.parentNode.parentNode.appendChild(DOM.$interactivityBtn);
DOM.$bottomButtons.appendChild(DOM.$mapScale);
Globals.interactivityIndicator.enable();
}
});
}

export default {
Expand Down

0 comments on commit f559f48

Please sign in to comment.