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:
@@ -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
|
||||||
|
|||||||
@@ -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]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user