From 11edfb47ecaf1b96d30b0ff12f643dec72695885 Mon Sep 17 00:00:00 2001 From: Sergey Podolsky Date: Tue, 30 Oct 2018 20:25:10 +0200 Subject: [PATCH] Filter out resize events if invisible When splitPane becomes hidden its offsetWidth and offsetHeight is set to zero. This triggers resize handler. Then it calculates maxFirstComponentWidth as a difference between zero offsetWidth and other values, which produces and passes negative "left" value into setLeft. As a result the whole panel shifts beyond the screen after becoming visible again. --- split-pane.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/split-pane.js b/split-pane.js index 56a901e..4df6787 100644 --- a/split-pane.js +++ b/split-pane.js @@ -121,7 +121,7 @@ https://raw.github.com/shagstrom/split-pane/master/LICENSE parent = $splitPane.parent().closest('.split-pane')[0] || window; $(parent).on(parent === window ? 'resize' : 'splitpaneresize', function(event) { var target = event.target === document ? window : event.target; - if (target === parent) { + if (target === parent && $($splitPane[0]).is(":visible")) { internalHandler(event); } });