mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
fix(menu) when click on ".." show full menu
This commit is contained in:
parent
4f1e70a06b
commit
4d93472df0
1 changed files with 48 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue