Skip to content

Commit

Permalink
fix(fullscreen): btn has now same behavior as filter btn
Browse files Browse the repository at this point in the history
  • Loading branch information
azarz committed Oct 7, 2024
1 parent 26eeb76 commit 5096b30
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/css/map-buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@
margin-top: calc(78px + var(--safe-area-inset-top));
}

.maplibregl-ctrl-top-right > .maplibregl-ctrl.highest {
margin-top: calc(10px + var(--safe-area-inset-top));
}

.maplibregl-ctrl-top-right > .maplibregl-ctrl:has(.maplibregl-ctrl-shrink) {
margin-top: calc(100vh - var(--safe-area-inset-bottom) - 20px - 48px);
}
Expand Down
33 changes: 24 additions & 9 deletions src/js/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class MenuNavigation {
Globals.backButtonState = "landmark-" + previousBackState;
DOM.$search.classList.add("d-none");
DOM.$filterPoiBtn.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("d-none");
DOM.$backTopLeftBtn.classList.remove("d-none");
Globals.interactivityIndicator.hardDisable();
Globals.currentScrollIndex = 1;
Expand All @@ -150,6 +151,7 @@ class MenuNavigation {
Globals.backButtonState = "signalementOSM-" + previousBackState;
DOM.$positionWindow.classList.add("d-none");
DOM.$filterPoiBtn.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("d-none");
Globals.interactivityIndicator.hardDisable();
break;
case "comparePoi":
Expand All @@ -163,6 +165,7 @@ class MenuNavigation {
case "selectOnMapIsochrone":
case "selectOnMapLandmark":
DOM.$filterPoiBtn.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("d-none");
DOM.$layerManagerBtn.classList.add("d-none");
DOM.$mapCenter.classList.remove("d-none");
DOM.$mapCenterMenu.classList.remove("d-none");
Expand Down Expand Up @@ -225,6 +228,7 @@ class MenuNavigation {
case "routeDrawSave":
DOM.$routeDrawWindow.classList.add("d-none");
DOM.$filterPoiBtn.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("d-none");
Globals.routeDraw.dom.changeMode.classList.add("d-none");
DOM.$routeDrawEdit.classList.add("d-none");
DOM.$bottomButtons.classList.remove("routeDraw");
Expand All @@ -234,8 +238,8 @@ class MenuNavigation {
// Disparition de la croix pour le tracé d'itinéraire (décision UI)
DOM.$tabClose.classList.add("d-none");
DOM.$search.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("higher");
DOM.$filterPoiBtn.classList.add("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("higher");
DOM.$backTopLeftBtn.classList.remove("d-none");
if (!Globals.routeDraw.readonly) {
DOM.$routeDrawEdit.classList.remove("d-none");
Expand All @@ -250,10 +254,10 @@ class MenuNavigation {
Globals.backButtonState = "poi-" + previousBackState;
Globals.routeDraw.deactivate();
DOM.$search.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("higher");
DOM.$filterPoiBtn.classList.add("higher");
DOM.$backTopLeftBtn.classList.remove("d-none");
DOM.$filterPoiBtn.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("d-none");
Globals.currentScrollIndex = 2;
break;
case "layerManager":
Expand All @@ -279,9 +283,10 @@ class MenuNavigation {
}
Globals.interactivityIndicator.enable();
DOM.$search.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("higher");
DOM.$filterPoiBtn.classList.add("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("higher");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
DOM.$backTopLeftBtn.classList.remove("d-none");
Globals.currentScrollIndex = 2;
break;
Expand All @@ -291,6 +296,7 @@ class MenuNavigation {
Globals.backButtonState = "isochrone-" + previousBackState;
DOM.$search.classList.add("d-none");
DOM.$filterPoiBtn.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("highest");
DOM.$backTopLeftBtn.classList.remove("d-none");
Globals.interactivityIndicator.hardDisable();
Globals.currentScrollIndex = 1;
Expand Down Expand Up @@ -333,9 +339,10 @@ class MenuNavigation {
case "directions":
Globals.backButtonState = "directions-" + previousBackState;
DOM.$search.classList.add("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("higher");
DOM.$filterPoiBtn.classList.add("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.add("higher");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
DOM.$backTopLeftBtn.classList.remove("d-none");
Globals.interactivityIndicator.hardDisable();
// FIXME
Expand Down Expand Up @@ -389,6 +396,7 @@ class MenuNavigation {
case "landmark":
DOM.$search.classList.remove("d-none");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
DOM.$backTopLeftBtn.classList.add("d-none");
Globals.landmark.clear();
Globals.interactivityIndicator.enable();
Expand All @@ -397,6 +405,7 @@ class MenuNavigation {
case "signalementOSM":
DOM.$positionWindow.classList.remove("d-none");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
Globals.interactivityIndicator.enable();
Globals.signalement.clear();
Globals.signalementOSM.clear();
Expand All @@ -412,6 +421,7 @@ class MenuNavigation {
break;
case "selectOnMapDirections":
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
// falls through
case "selectOnMapIsochrone":
case "selectOnMapLandmark":
Expand Down Expand Up @@ -467,6 +477,7 @@ class MenuNavigation {
// Disparition de la croix
DOM.$tabClose.classList.add("d-none");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
DOM["$routeDrawWindow"].classList.remove("d-none");
Globals.routeDraw.dom.changeMode.classList.remove("d-none");
DOM.$routeDrawEdit.classList.remove("d-none");
Expand All @@ -476,9 +487,10 @@ class MenuNavigation {
break;
case "routeDraw":
DOM.$search.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$filterPoiBtn.classList.remove("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
DOM.$backTopLeftBtn.classList.add("d-none");
if (!Globals.routeDraw.readonly) {
DOM.$routeDrawEdit.classList.add("d-none");
Expand All @@ -490,16 +502,17 @@ class MenuNavigation {
break;
case "poi":
DOM.$search.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$filterPoiBtn.classList.remove("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$backTopLeftBtn.classList.add("d-none");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
break;
case "layerManager":
DOM.$search.classList.remove("d-none");
DOM.$layerManagerBtn.classList.remove("active");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$filterPoiBtn.classList.remove("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$backTopLeftBtn.classList.add("d-none");
break;
case "informations":
Expand All @@ -508,15 +521,16 @@ class MenuNavigation {
break;
case "position":
DOM.$search.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$filterPoiBtn.classList.remove("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$backTopLeftBtn.classList.add("d-none");
Globals.mapInteractivity.clear();
break;
case "isochrone":
// FIXME mettre en place une méthode sur la classe Searchs
DOM.$search.classList.remove("d-none");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("highest");
DOM.$backTopLeftBtn.classList.add("d-none");
Globals.isochrone.clear();
Globals.interactivityIndicator.enable();
Expand Down Expand Up @@ -567,9 +581,10 @@ class MenuNavigation {
break;
case "directions":
DOM.$search.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$filterPoiBtn.classList.remove("higher");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("higher");
DOM.$filterPoiBtn.classList.remove("d-none");
document.querySelector(".maplibregl-ctrl-top-right > .maplibregl-ctrl").classList.remove("d-none");
DOM.$backTopLeftBtn.classList.add("d-none");
Globals.directions.clear();
Globals.interactivityIndicator.enable();
Expand Down
6 changes: 6 additions & 0 deletions src/js/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,20 @@ const onBackKeyDown = () => {
return;
}
if (backState === "selectOnMapDirections") {
const closesearch = new Event("closesearch");
window.dispatchEvent(closesearch);
Globals.menu.close("selectOnMapDirections");
return;
}
if (backState === "selectOnMapIsochrone") {
const closesearch = new Event("closesearch");
window.dispatchEvent(closesearch);
Globals.menu.close("selectOnMapIsochrone");
return;
}
if (backState === "selectOnMapLandmark") {
const closesearch = new Event("closesearch");
window.dispatchEvent(closesearch);
Globals.menu.close("selectOnMapLandmark");
return;
}
Expand Down

0 comments on commit 5096b30

Please sign in to comment.