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:
parent
7961fcbf0f
commit
0f97c325cf
@ -66,8 +66,7 @@ class App {
|
||||
)
|
||||
|
||||
this.Instance.addEventListener("annotations.willChange", _ => {
|
||||
//hide buttons
|
||||
Comp.ActPanelElements.forEach(child => child.style.display = 'none');
|
||||
Comp.ActPanel.Toggle();
|
||||
});
|
||||
|
||||
// Load annotations into PSPDFKit
|
||||
|
||||
@ -36,18 +36,32 @@ $('.btn_reject').click(_ =>
|
||||
}));
|
||||
|
||||
|
||||
class Comp{
|
||||
static __fActPanel;
|
||||
static get ActPanel(){
|
||||
if(Comp.__fActPanel)
|
||||
return Comp.__fActPanel
|
||||
else{
|
||||
Comp.__fActPanel = document.getElementById("flex-actio-panel")
|
||||
return Comp.__fActPanel
|
||||
class Comp {
|
||||
static ActPanel = class {
|
||||
static __Root;
|
||||
static get Root() {
|
||||
Comp.ActPanel.__Root ??= document.getElementById("flex-actio-panel")
|
||||
return Comp.ActPanel.__Root
|
||||
}
|
||||
|
||||
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]
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user