Fixed call of popup menu commands with parameters.s

This commit is contained in:
Uwe Oestermeier 2020-08-04 18:07:48 +02:00
parent 47b178fbc1
commit 12b17fd7af
3 changed files with 12 additions and 8 deletions

8
dist/iwmlib.js vendored
View File

@ -6671,9 +6671,11 @@
if (this.autoClose) {
this.close();
}
setTimeout(() => {
func.call(event, key);
}, 20);
console.log("perform", event, key);
setTimeout((event, key) => {
console.log("perform within arrow", event, key);
func(event, key);
}, 20, event, key);
}
/** Update the menu item denoted by key.

View File

@ -34,8 +34,8 @@ oncontextmenu="PopupMenu.open(cmds,
oncontextmenu="PopupMenu.open(cmds, {x: event.offsetX, y: event.offsetY}, { parent: example, keepWithin: example}); return false;"></div>
<script class="doctest">
let cmds = {
"Start": () => alert("Start"),
"Stop": () => alert("Stop")
"Start": (event, key) => {console.log("start", event, key); alert(key) },
"Stop": (event, key) => alert(key)
}
let app = new App()
let popup = new PopupMenu({ parent: example, fontSize: "2em", autoClose: false })

View File

@ -113,9 +113,11 @@ export default class PopupMenu extends Popup {
if (this.autoClose) {
this.close()
}
setTimeout(() => {
func.call(event, key)
}, 20)
console.log("perform", event, key)
setTimeout((event, key) => {
console.log("perform within arrow", event, key)
func(event, key)
}, 20, event, key)
}
/** Update the menu item denoted by key.