Added event parameter to PopupMenu perform.
This commit is contained in:
+5
-4
@@ -83,10 +83,10 @@ export default class PopupMenu extends Popup {
|
||||
Elements.addClass(item, 'popupMenuItem')
|
||||
this.items[key] = item
|
||||
item.onclick = event => {
|
||||
this.perform(key)
|
||||
this.perform(event, key)
|
||||
}
|
||||
item.ontap = event => {
|
||||
this.perform(key)
|
||||
this.perform(event, key)
|
||||
}
|
||||
item.onmouseover = event => {
|
||||
this.over(event, key)
|
||||
@@ -105,15 +105,16 @@ export default class PopupMenu extends Popup {
|
||||
}
|
||||
|
||||
/** Execute a menu command.
|
||||
* @param {object} event - The trigger event.
|
||||
* @param {string} key - The selected key.
|
||||
*/
|
||||
perform(key) {
|
||||
perform(event, key) {
|
||||
let func = this.commands[key]
|
||||
if (this.autoClose) {
|
||||
this.close()
|
||||
}
|
||||
setTimeout(() => {
|
||||
func.call()
|
||||
func.call(event, key)
|
||||
}, 20)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user