daggerheart/module/applications/ux/contextMenu.mjs
WBHarry 3eda3c4c05
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
[Feature] Action Areas (#1815)
* Functioning setup

* .

* Fixes

* Completed

* Apply suggestions from code review

Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com>

* using function.call instead of function.bind

* Run lint fix on action areas PR (#1820)

* .

* .

* Restructured getTemplateShape to be a lot more readable

* .

* .

* Changed from 'area' to 'areas'

* .

* Moved the areas button to the left

* Fix regression with actions list

* Updated all SRD adversaries

---------

Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com>
Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
2026-04-21 22:27:52 +02:00

25 lines
859 B
JavaScript

export default class DHContextMenu extends foundry.applications.ux.ContextMenu {
/**
* Trigger a context menu event in response to a normal click on a additional options button.
* @param {PointerEvent} event
*/
static triggerContextMenu(event, altSelector) {
event.preventDefault();
event.stopPropagation();
const selector = altSelector ?? '[data-item-uuid]';
if (ui.context?.selector === selector) return;
const { clientX, clientY } = event;
const target = event.target.closest(selector) ?? event.currentTarget.closest(selector);
target?.dispatchEvent(
new PointerEvent('contextmenu', {
view: window,
bubbles: true,
cancelable: true,
clientX,
clientY
})
);
}
}