mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Bug/fixed character attack (#192)
* Fixed weapon useage in Character * Added DHContextMenu to pass on the event from clicking a contextmenuitem
This commit is contained in:
parent
e3b9dcad2a
commit
1f5b5f9915
5 changed files with 40 additions and 15 deletions
24
module/applications/contextMenu.mjs
Normal file
24
module/applications/contextMenu.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export default class DhContextMenu extends ContextMenu {
|
||||
constructor(container, selector, menuItems, options) {
|
||||
super(container, selector, menuItems, options);
|
||||
|
||||
/** @deprecated since v13 until v15 */
|
||||
this.#jQuery = options.jQuery;
|
||||
}
|
||||
|
||||
#jQuery;
|
||||
|
||||
activateListeners(menu) {
|
||||
menu.addEventListener('click', this.#onClickItem.bind(this));
|
||||
}
|
||||
|
||||
#onClickItem(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const element = event.target.closest('.context-item');
|
||||
if (!element) return;
|
||||
const item = this.menuItems.find(i => i.element === element);
|
||||
item?.callback(this.#jQuery ? $(this.target) : this.target, event);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue