fix(menu) did not show when button pressed

This commit is contained in:
coderaiser 2015-05-27 02:20:48 -04:00
parent 3b4aa37413
commit e02ffbfd94

View file

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