Skip to content

Commit

Permalink
Panel stays open fullscreen, closes itself when too small
Browse files Browse the repository at this point in the history
  • Loading branch information
Saira-A committed Jan 11, 2024
1 parent ccb6037 commit 260b0f0
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions src/content-handlers/iiif/modules/uv-shared-module/RightPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,40 @@ export class RightPanel<T extends ExpandPanel> extends BaseExpandPanel<T> {
let isLargeScreen: boolean = window.innerWidth >= 1200;

const updatePanelBasedOnScreenWidth = () => {
const newIsLargeScreen = window.innerWidth >= 1200;

if (newIsLargeScreen !== isLargeScreen) {
isLargeScreen = newIsLargeScreen;

if (this.fullscreenEnabled && isLargeScreen) {

this.toggle(true);
} else {

this.toggle(false);
}
const newIsLargeScreen = window.innerWidth >= 1200;

if (newIsLargeScreen !== isLargeScreen) {
isLargeScreen = newIsLargeScreen;

if (this.fullscreenEnabled && isLargeScreen) {
this.toggle(true);
} else {
this.toggle(false);
}
}
};


updatePanelBasedOnScreenWidth();


window.addEventListener('resize', updatePanelBasedOnScreenWidth);

// Open the panel by default for small screens and close it after a few seconds
if (!isLargeScreen) {
this.toggle(true);

setTimeout(() => {
this.toggle(false);
}, 5000);
}

this.extensionHost.subscribe(IIIFEvents.TOGGLE_EXPAND_RIGHT_PANEL, () => {
if (this.isFullyExpanded) {
this.collapseFull();
} else {
this.expandFull();
}
if (this.isFullyExpanded) {
this.collapseFull();
} else {
this.expandFull();
}
});
}

}


init(): void {
Expand Down

0 comments on commit 260b0f0

Please sign in to comment.