diff --git a/EnvelopeGenerator.Web/wwwroot/js/app.js b/EnvelopeGenerator.Web/wwwroot/js/app.js index ff5d09f9..2e316da1 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/app.js +++ b/EnvelopeGenerator.Web/wwwroot/js/app.js @@ -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 diff --git a/EnvelopeGenerator.Web/wwwroot/js/event-binder.js b/EnvelopeGenerator.Web/wwwroot/js/event-binder.js index b631d303..c790e708 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/event-binder.js +++ b/EnvelopeGenerator.Web/wwwroot/js/event-binder.js @@ -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] - } } \ No newline at end of file