mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[simulator/web] Fix keyHandler not defined (backported from Upsilon Workshop)
This commit is contained in:
@@ -54,6 +54,9 @@ function Calculator(emModule) {
|
|||||||
function eventHandler(keyHandler) {
|
function eventHandler(keyHandler) {
|
||||||
return function(ev) {
|
return function(ev) {
|
||||||
var key = this.getAttribute('data-key');
|
var key = this.getAttribute('data-key');
|
||||||
|
/* We use eval as "emModule._IonSimulatorKeyboardKeyDown" is still missing
|
||||||
|
* even after loading Epsilon, probably due to some async init */
|
||||||
|
keyHandler = eval(keyHandler);
|
||||||
keyHandler(key);
|
keyHandler(key);
|
||||||
/* Always prevent default action of event.
|
/* Always prevent default action of event.
|
||||||
* First, this will prevent the browser from delaying that event. Indeed
|
* First, this will prevent the browser from delaying that event. Indeed
|
||||||
@@ -69,8 +72,8 @@ function Calculator(emModule) {
|
|||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var downHandler = eventHandler(emModule._IonSimulatorKeyboardKeyDown);
|
var downHandler = eventHandler("emModule._IonSimulatorKeyboardKeyDown");
|
||||||
var upHandler = eventHandler(emModule._IonSimulatorKeyboardKeyUp);
|
var upHandler = eventHandler("emModule._IonSimulatorKeyboardKeyUp");
|
||||||
|
|
||||||
calculatorElement.querySelectorAll('span').forEach(function(span){
|
calculatorElement.querySelectorAll('span').forEach(function(span){
|
||||||
/* We decide to hook both to touch and mouse events
|
/* We decide to hook both to touch and mouse events
|
||||||
|
|||||||
Reference in New Issue
Block a user