mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-23 07:53:39 +02:00
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
* 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>
25 lines
859 B
JavaScript
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
|
|
})
|
|
);
|
|
}
|
|
}
|