fix(menu) when click on ".." show full menu

This commit is contained in:
coderaiser 2017-10-19 13:56:47 +03:00
parent 4f1e70a06b
commit 4d93472df0

View file

@ -68,22 +68,60 @@ function MenuProto(Position) {
return {
x: position.x,
y: position.y,
}
};
if (Position)
return {
x: Position.x,
y: Position.y,
}
};
if (position)
return {
x: position.x,
y: position.y,
}
};
return getCurrentPosition();
}
function getMenuNameByEl(el) {
if (!el)
return 'context';
const name = DOM.getCurrentName(el);
if (name === '..')
return 'context';
return 'contextFile';
}
function getMenuByName(name) {
if (name === 'context')
return MenuContext;
return MenuContextFile;
}
function getMenuNameByEl(el) {
if (!el)
return 'context';
const name = DOM.getCurrentName(el);
if (name === '..')
return 'context'
return 'contextFile'
};
function getMenuByName(name) {
if (name === 'context')
return MenuContext;
return MenuContextFile;
}
function show(position) {
const {x, y} = getPosition(position);
@ -104,8 +142,9 @@ function MenuProto(Position) {
MenuContext = new MenuIO(fm, options, menuData);
MenuContextFile = new MenuIO(fm, optionsFile, menuDataFile);
const is = DOM.getCurrentByPosition({x, y});
const menu = is ? MenuContextFile : MenuContext;
const el = DOM.getCurrentByPosition({x, y});
const menuName = getMenuNameByEl(el);
const menu = getMenuByName(menuName);
menu.show(x, y);
@ -216,11 +255,14 @@ function MenuProto(Position) {
function beforeShow(callback, params) {
const name = params.name;
let notShow = DOM.getCurrentByPosition({
let el = DOM.getCurrentByPosition({
x: params.x,
y: params.y
});
const menuName = getMenuNameByEl(el);
let notShow = menuName === 'contextFile';
if (params.name === 'contextFile') {
notShow = !notShow;
}