From bd7259cfe4cc2dbaf5c74f173579d57bd5089be1 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 2 Jun 2015 05:09:33 -0400 Subject: [PATCH] feature(dom) resize: set current file on left panel, when right panel is active on resizing, and size is to small for two panels --- lib/client/listeners.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/client/listeners.js b/lib/client/listeners.js index b33aa3b6..9885ba49 100644 --- a/lib/client/listeners.js +++ b/lib/client/listeners.js @@ -22,6 +22,7 @@ var Util, DOM, CloudFunc, CloudCmd; dragndrop(); unload(); pop(); + resize(); }; this.initKeysPanel = function() { @@ -296,6 +297,17 @@ var Util, DOM, CloudFunc, CloudCmd; }); } + function resize() { + Events.add('resize', function() { + var is = window.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH, + name = Info.panel.getAttribute('data-name'), + isLeft = name === 'js-left'; + + if (is && !isLeft) + DOM.changePanel(); + }); + } + } })(Util, DOM, CloudFunc, CloudCmd);