mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-25 00:43:38 +02:00
Compare commits
No commits in common. "37b088fe7d59c25cc2fbfe738c7cbd4a6c3bd92b" and "fb4ddf227c62f8bc90aff9177eca288abac85875" have entirely different histories.
37b088fe7d
...
fb4ddf227c
5 changed files with 51 additions and 7 deletions
|
|
@ -52,6 +52,46 @@
|
||||||
* @extends {foundry.applications.ux.ContextMenu}
|
* @extends {foundry.applications.ux.ContextMenu}
|
||||||
*/
|
*/
|
||||||
export default class DHContextMenu extends foundry.applications.ux.ContextMenu {
|
export default class DHContextMenu extends foundry.applications.ux.ContextMenu {
|
||||||
|
/**
|
||||||
|
* @param {HTMLElement|jQuery} container - The HTML element that contains the context menu targets.
|
||||||
|
* @param {string} selector - A CSS selector which activates the context menu.
|
||||||
|
* @param {ContextMenuEntry[]} menuItems - An Array of entries to display in the menu
|
||||||
|
* @param {ContextMenuOptions} [options] - Additional options to configure the context menu.
|
||||||
|
*/
|
||||||
|
constructor(container, selector, menuItems, options) {
|
||||||
|
super(container, selector, menuItems, options);
|
||||||
|
|
||||||
|
/** @deprecated since v13 until v15 */
|
||||||
|
this.#jQuery = options.jQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to pass jQuery objects or HTMLElement instances to callback.
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
#jQuery;
|
||||||
|
|
||||||
|
/**@inheritdoc */
|
||||||
|
activateListeners(menu) {
|
||||||
|
menu.addEventListener('click', this.#onClickItem.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle click events on context menu items.
|
||||||
|
* @param {PointerEvent} event The click event
|
||||||
|
*/
|
||||||
|
#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?.onClick(event, this.#jQuery ? $(this.target) : this.target);
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger a context menu event in response to a normal click on a additional options button.
|
* Trigger a context menu event in response to a normal click on a additional options button.
|
||||||
* @param {PointerEvent} event
|
* @param {PointerEvent} event
|
||||||
|
|
|
||||||
|
|
@ -354,11 +354,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasDamage() {
|
get hasDamage() {
|
||||||
return !foundry.utils.isEmpty(this.damage?.parts) && this.type !== 'healing';
|
return !foundry.utils.isEmpty(this.damage.parts) && this.type !== 'healing';
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasHealing() {
|
get hasHealing() {
|
||||||
return !foundry.utils.isEmpty(this.damage?.parts) && this.type === 'healing';
|
return !foundry.utils.isEmpty(this.damage.parts) && this.type === 'healing';
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasSave() {
|
get hasSave() {
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,10 @@ export class ActionField extends foundry.data.fields.ObjectField {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
_cleanType(value, options, _state) {
|
_cleanType(value, options) {
|
||||||
if (!(typeof value === 'object')) value = {};
|
if (!(typeof value === 'object')) value = {};
|
||||||
const cls = this.getModel(value);
|
const cls = this.getModel(value);
|
||||||
if (cls) return cls.cleanData(value, options, _state);
|
if (cls) return cls.cleanData(value, options);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ class ResourcesField extends fields.TypedObjectField {
|
||||||
return key in CONFIG.DH.RESOURCE[this.actorType].all;
|
return key in CONFIG.DH.RESOURCE[this.actorType].all;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cleanType(value, options, _state) {
|
_cleanType(value, options) {
|
||||||
value = super._cleanType(value, options, _state);
|
value = super._cleanType(value, options);
|
||||||
|
|
||||||
// If not partial, ensure all data exists
|
// If not partial, ensure all data exists
|
||||||
if (!options.partial) {
|
if (!options.partial) {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,11 @@ body.game:is(.performance-low, .noblur) {
|
||||||
.themed.theme-dark .application.daggerheart.sheet.dh-style,
|
.themed.theme-dark .application.daggerheart.sheet.dh-style,
|
||||||
.themed.theme-dark.application.daggerheart.sheet.dh-style,
|
.themed.theme-dark.application.daggerheart.sheet.dh-style,
|
||||||
&.theme-dark .application.daggerheart {
|
&.theme-dark .application.daggerheart {
|
||||||
background: @dark-blue;
|
&.adversary,
|
||||||
|
&.character,
|
||||||
|
&.item {
|
||||||
|
background: @dark-blue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue