DM-426 - Enable layout grid button needs two clicks in new file

This commit is contained in:
Valentin Mihai 2023-09-11 18:03:02 +03:00
parent 962879d755
commit 6c0996b0a3
3 changed files with 14 additions and 0 deletions

View File

@ -338,6 +338,7 @@ export class FilePreviewScreenComponent
document.documentElement.addEventListener('fullscreenchange', this.fullscreenListener);
this.#openRssDialogIfDefault();
this._viewerHeaderService.resetLayers();
}
ngAfterViewInit() {

View File

@ -33,6 +33,11 @@ export class LayersService {
return tooltipsDisabled ? this.#enableIcon : this.#disableIcon;
}
resetLayers() {
this._active = false;
this.#updateButton();
}
async toggleLayers(): Promise<void> {
const layers = await this._documentViewer.document.getLayersArray();
layers.forEach(layer => {
@ -45,6 +50,10 @@ export class LayersService {
this._documentViewer.refreshAndUpdateView();
this._active = !this._active;
this.#updateButton();
}
#updateButton() {
this._pdf.instance.UI.updateElement(HeaderElements.TOGGLE_LAYERS, {
title: this.toggleLayersBtnTitle,
img: this.toggleLayersBtnIcon,

View File

@ -377,4 +377,8 @@ export class ViewerHeaderService {
this.disable(ROTATION_ACTION_BUTTONS);
}
}
resetLayers() {
this._layersService.resetLayers();
}
}