mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(menu) did not show when button pressed
This commit is contained in:
parent
3b4aa37413
commit
e02ffbfd94
1 changed files with 25 additions and 10 deletions
|
|
@ -56,9 +56,18 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
|
|||
};
|
||||
|
||||
function show(x, y) {
|
||||
var position;
|
||||
|
||||
if (!x || !y) {
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
if (position) {
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
} else {
|
||||
position = getCurrentPosition();
|
||||
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Loading) {
|
||||
|
|
@ -279,21 +288,27 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
|
|||
};
|
||||
}
|
||||
|
||||
function getCurrentPosition() {
|
||||
var current = Info.element,
|
||||
rect = current.getBoundingClientRect();
|
||||
position = {
|
||||
x: rect.left + rect.width / 3,
|
||||
y: rect.top
|
||||
};
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
function listener(event) {
|
||||
var current, x, y, position,
|
||||
var position,
|
||||
F9 = Key.F9,
|
||||
ESC = Key.ESC,
|
||||
key = event.keyCode,
|
||||
isBind = Key.isBind();
|
||||
|
||||
if (isBind && key === F9) {
|
||||
current = Info.element;
|
||||
position = current.getBoundingClientRect();
|
||||
|
||||
x = position.left + position.width / 3;
|
||||
y = position.top;
|
||||
|
||||
MenuContext.show(x, y);
|
||||
position = getCurrentPosition();
|
||||
MenuContext.show(position.x, position.y);
|
||||
|
||||
event.preventDefault();
|
||||
} else if (key === ESC) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue