Refactored Comp Klasse zur Aufnahme der geschachtelten ActPanel Klasse mit Lazy-Initialisierung und hinzugefügten Methoden zum Umschalten der Sichtbarkeit. Konfigurierte Comp.ActPanel.Toggle() so, dass die Schaltflächen ausgeblendet werden, wenn Anmerkungen geöffnet werden, und sichtbar sind, wenn Anmerkungen geschlossen werden, über addEventListener("annotations.willChange", e).

This commit is contained in:
Developer 02
2024-06-12 16:27:34 +02:00
parent 7961fcbf0f
commit 0f97c325cf
2 changed files with 27 additions and 14 deletions

View File

@@ -66,8 +66,7 @@ class App {
) )
this.Instance.addEventListener("annotations.willChange", _ => { this.Instance.addEventListener("annotations.willChange", _ => {
//hide buttons Comp.ActPanel.Toggle();
Comp.ActPanelElements.forEach(child => child.style.display = 'none');
}); });
// Load annotations into PSPDFKit // Load annotations into PSPDFKit

View File

@@ -36,18 +36,32 @@ $('.btn_reject').click(_ =>
})); }));
class Comp{ class Comp {
static __fActPanel; static ActPanel = class {
static get ActPanel(){ static __Root;
if(Comp.__fActPanel) static get Root() {
return Comp.__fActPanel Comp.ActPanel.__Root ??= document.getElementById("flex-actio-panel")
else{ return Comp.ActPanel.__Root
Comp.__fActPanel = document.getElementById("flex-actio-panel") }
return Comp.__fActPanel
static get Elements() {
return [...Comp.ActPanel.Root.children]
}
static get IsHided() {
return Comp.ActPanel.Root.style.display == 'none';
}
/**
* @param {string} value
*/
static set Display(value) {
Comp.ActPanel.Root.style.display = value
Comp.ActPanel.Elements.forEach(e => e.style.display = value);
}
static Toggle() {
Comp.ActPanel.Display = Comp.ActPanel.IsHided ? '' : 'none'
} }
} }
static get ActPanelElements() {
return [...Comp.ActPanel.children]
}
} }