mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-24 08:23:38 +02:00
Compare commits
4 commits
fb4ddf227c
...
37b088fe7d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37b088fe7d | ||
|
|
7c0ab25e10 | ||
|
|
1160f51347 | ||
|
|
92bcaf4962 |
5 changed files with 7 additions and 51 deletions
|
|
@ -52,46 +52,6 @@
|
||||||
* @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) {
|
_cleanType(value, options, _state) {
|
||||||
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);
|
if (cls) return cls.cleanData(value, options, _state);
|
||||||
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) {
|
_cleanType(value, options, _state) {
|
||||||
value = super._cleanType(value, options);
|
value = super._cleanType(value, options, _state);
|
||||||
|
|
||||||
// If not partial, ensure all data exists
|
// If not partial, ensure all data exists
|
||||||
if (!options.partial) {
|
if (!options.partial) {
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,7 @@ 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 {
|
||||||
&.adversary,
|
background: @dark-blue;
|
||||||
&.character,
|
|
||||||
&.item {
|
|
||||||
background: @dark-blue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue