From 90d0d520602dce9e87ead6812e2a63cf8af2af64 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 10 Feb 2020 09:50:48 +0100 Subject: [PATCH] Preventing Panel access when hidden --- Panels/LayersPanel.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Panels/LayersPanel.js b/Panels/LayersPanel.js index 98684a18e..bfc43216f 100644 --- a/Panels/LayersPanel.js +++ b/Panels/LayersPanel.js @@ -27,7 +27,6 @@ function newLayersPanel () { const LAYER_SEPARATION = 0 - let visible = true let headerHeight = 40 let footerHeight = 10 let layerHeight = 70 @@ -188,12 +187,14 @@ function newLayersPanel () { } function panelSizePhysics () { + if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return } + let viewPortHeight = canvas.chartSpace.viewport.visibleArea.bottomLeft.y - canvas.chartSpace.viewport.visibleArea.topLeft.y if (viewPortHeight < headerHeight) { - visible = false + thisObject.visible = false } else { - visible = true + thisObject.visible = true } if (desiredPanelHeight > viewPortHeight) { @@ -239,6 +240,7 @@ function newLayersPanel () { } function getContainer (point) { + if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return } let container container = thisObject.panelTabButton.getContainer(point) @@ -367,7 +369,7 @@ function newLayersPanel () { } function draw () { - if (isInitialized === false || visible === false) { return } + if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return } // thisObject.container.frame.draw(false, false, false, thisObject.fitFunction)