From 8fb25646bdbd0a9269274a6ce33e123ae04545cb Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 9 Mar 2022 13:13:03 +1300 Subject: [PATCH] Initial pass: reset pane width on browser resize --- shared/naturalcrit/splitPane/splitPane.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index 1b4cee5ae..6d4dc95c4 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -10,7 +10,6 @@ const SplitPane = createClass({ return { storageKey : 'naturalcrit-pane-split', onDragFinish : function(){} //fires when dragging - }; }, getInitialState : function() { @@ -26,6 +25,17 @@ const SplitPane = createClass({ size : paneSize }); } + window.addEventListener('resize', this.resetSize); + }, + + componentWillUnmount : function() { + window.removeEventListener('resize', this.resetSize); + }, + + resetSize : function() { + this.setState({ + size : window.innerWidth / 2 + }); }, handleUp : function(){