Skip to content

Commit

Permalink
Window resizes when sidebar is hidden in order to elimenate the white…
Browse files Browse the repository at this point in the history
…space on the right when no info pane is visible
  • Loading branch information
dhochbaum-dcp committed May 6, 2024
1 parent 6ac3532 commit 7c60973
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ export default class ApplicationController extends Controller.extend(

@tracked layerGroupsStorage;

widowResize() {
return new Promise((resolve) => {
setTimeout(() => {
const resizeEvent = window.document.createEvent('UIEvents');
resizeEvent.initUIEvent('resize', true, false, window, 0);
window.dispatchEvent(resizeEvent);
resolve();
}, 1);
});
}

// this action extracts query-param-friendly state of layer groups
// for various paramable layers
@action
Expand Down Expand Up @@ -190,7 +201,7 @@ export default class ApplicationController extends Controller.extend(
}

@action
toggleLeftSideMenuVisibility() {
async toggleLeftSideMenuVisibility() {
this.leftSideMenuVisibilty = !this.leftSideMenuVisibilty;

const mapContainer = document.querySelector('.map-container');
Expand All @@ -199,6 +210,8 @@ export default class ApplicationController extends Controller.extend(
mapContainer.setAttribute('class', 'map-container');
else mapContainer.setAttribute('class', 'map-container full-width');

await this.widowResize();

this.metrics.trackEvent('MatomoTagManager', {
category: 'Toggled Layer Menu Visibility',
action: 'Toggled Layer Menu Visibility',
Expand Down
2 changes: 1 addition & 1 deletion app/styles/layouts/_l-default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ body {
}

&.full-width {
width: 100%;
width: 100% !important;
}

}
Expand Down

0 comments on commit 7c60973

Please sign in to comment.