From b676c67b963eac3d072fcf88e597b1204ae38bf0 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 14 Nov 2017 12:54:41 +0200 Subject: [PATCH] refactor(view) setCurrentByPosition --- client/modules/view.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/modules/view.js b/client/modules/view.js index 4d52969d..60a5b05c 100644 --- a/client/modules/view.js +++ b/client/modules/view.js @@ -346,8 +346,6 @@ function loadAll(callback) { } function onOverLayClick(event) { - const files = Info.files; - const filesPassive = Info.filesPassive; const {target} = event; const isOverlay = target === Overlay; const position = { @@ -361,11 +359,20 @@ function onOverLayClick(event) { hideOverlay(); hide(); + setCurrentByPosition(position); +} + +function setCurrentByPosition(position) { const element = DOM.getCurrentByPosition(position); if (!element) return; + const { + files, + filesPassive, + } = Info.files; + const isFiles = ~files.indexOf(element); const isFilesPassive = ~filesPassive.indexOf(element);