refactor(view) setCurrentByPosition

This commit is contained in:
coderaiser 2017-11-14 12:54:41 +02:00
parent a088a6718e
commit b676c67b96

View file

@ -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);