mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
[Fix] quirks involving expanding items and hovering over them (#2033)
Some checks failed
Project CI / build (24.x) (push) Has been cancelled
Some checks failed
Project CI / build (24.x) (push) Has been cancelled
This commit is contained in:
parent
2c1f52413d
commit
1ebbad4797
8 changed files with 163 additions and 161 deletions
|
|
@ -603,7 +603,7 @@ export default function DHApplicationMixin(Base) {
|
|||
const doc = await fromUuid(itemUuid);
|
||||
|
||||
//get inventory-item description element
|
||||
const descriptionElement = el.querySelector('.invetory-description');
|
||||
const descriptionElement = el.querySelector('.inventory-description');
|
||||
if (!doc || !descriptionElement) continue;
|
||||
|
||||
// localize the description (idk if it's still necessary)
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
return {};
|
||||
}
|
||||
|
||||
get hasDescription() {
|
||||
return Boolean(this.description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ export default class DHArmor extends AttachableItem {
|
|||
);
|
||||
}
|
||||
|
||||
get itemFeatures() {
|
||||
return this.armorFeatures;
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
const baseDescription = this.description;
|
||||
|
|
@ -169,8 +173,4 @@ export default class DHArmor extends AttachableItem {
|
|||
const labels = [`${game.i18n.localize('DAGGERHEART.ITEMS.Armor.baseScore')}: ${this.armor.max}`];
|
||||
return labels;
|
||||
}
|
||||
|
||||
get itemFeatures() {
|
||||
return this.armorFeatures;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ export default class DHWeapon extends AttachableItem {
|
|||
);
|
||||
}
|
||||
|
||||
get itemFeatures() {
|
||||
return this.weaponFeatures;
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
const baseDescription = this.description;
|
||||
|
|
@ -269,8 +273,4 @@ export default class DHWeapon extends AttachableItem {
|
|||
|
||||
return labels;
|
||||
}
|
||||
|
||||
get itemFeatures() {
|
||||
return this.weaponFeatures;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
);
|
||||
}
|
||||
|
||||
get hasDescription() {
|
||||
return Boolean(this.description);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Event Handlers */
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -89,6 +89,10 @@ export default class DHItem extends foundry.documents.Item {
|
|||
return !pack?.locked && this.isOwner && isValidType && hasActions;
|
||||
}
|
||||
|
||||
get hasDescription() {
|
||||
return Boolean(this.system.description) || Boolean(this.system.itemFeatures?.length);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
static async createDialog(data = {}, createOptions = {}, options = {}) {
|
||||
const { folders, types, template, context = {}, ...dialogOptions } = options;
|
||||
|
|
|
|||
|
|
@ -43,16 +43,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
.item-main {
|
||||
border-radius: 5px;
|
||||
padding: 2px;
|
||||
margin: -2px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.inventory-item-header .item-label .item-name .expanded-icon {
|
||||
margin-left: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
&:has(.inventory-item-content.extensible) {
|
||||
.inventory-item-header,
|
||||
.inventory-item-content {
|
||||
background: light-dark(@dark-blue-40, @golden-40);
|
||||
}
|
||||
.item-main {
|
||||
background: light-dark(@dark-blue-40, @golden-40);
|
||||
}
|
||||
&:has(.inventory-item-content.extended) {
|
||||
.inventory-item-header .item-label .item-name .expanded-icon {
|
||||
|
|
@ -60,19 +63,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:has(.inventory-item-content.extensible) {
|
||||
.inventory-item-header {
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
.inventory-item-content {
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(:has(.inventory-item-content.extensible)) .inventory-item-header {
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.inventory-item-header,
|
||||
|
|
@ -171,7 +161,7 @@
|
|||
grid-template-rows: 1fr;
|
||||
padding-top: 4px;
|
||||
}
|
||||
.invetory-description {
|
||||
.inventory-description {
|
||||
overflow: hidden;
|
||||
|
||||
h1 {
|
||||
|
|
|
|||
|
|
@ -25,146 +25,146 @@ Parameters:
|
|||
data-type="{{type}}" data-item-type="{{item.type}}"
|
||||
data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}"
|
||||
>
|
||||
<div class="inventory-item-header {{#if hideContextMenu}}padded{{/if}}" {{#unless noExtensible}}data-action="toggleExtended" {{/unless}}>
|
||||
{{!-- Image --}}
|
||||
<div class="img-portait" draggable="true"
|
||||
{{#unless (eq showActions false)}}data-action='{{ifThen item.usable "useItem" (ifThen (hasProperty item "toChat" ) "toChat" "editDoc" ) }}'{{/unless}}
|
||||
{{#unless hideTooltip}} {{#if (eq type 'attack' )}} data-tooltip="#attack#{{item.actor.uuid}}" {{else}} data-tooltip="#item#{{item.uuid}}" {{/if}} {{/unless}}>
|
||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" />
|
||||
{{#if (and item.usable (ne showActions false))}}
|
||||
{{#if @root.isNPC}}
|
||||
<img class="roll-img d20" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt="d20">
|
||||
{{else}}
|
||||
<img class="roll-img duality" src="systems/daggerheart/assets/icons/dice/duality/DualityBW.svg" alt="2d12">
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{!-- Name & Tags --}}
|
||||
<div class="item-label" draggable="true">
|
||||
{{!-- Item Name --}}
|
||||
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
|
||||
|
||||
{{!-- Tags Start --}}
|
||||
{{#if (not hideTags)}}
|
||||
{{#> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item}}
|
||||
{{#if (eq ../type 'feature')}}
|
||||
{{#if (and system.featureForm (ne @root.document.type "character"))}}
|
||||
<div class="tag feature-form">
|
||||
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
|
||||
</div>
|
||||
<div class="item-main">
|
||||
<div class="inventory-item-header{{#if hideContextMenu}} padded{{/if}}" {{#unless (or noExtensible (not item.hasDescription))}}data-action="toggleExtended" {{/unless}}>
|
||||
{{!-- Image --}}
|
||||
<div class="img-portait" draggable="true"
|
||||
{{#unless (eq showActions false)}}data-action='{{ifThen item.usable "useItem" (ifThen (hasProperty item "toChat" ) "toChat" "editDoc" ) }}'{{/unless}}
|
||||
{{#unless hideTooltip}} {{#if (eq type 'attack' )}} data-tooltip="#attack#{{item.actor.uuid}}" {{else}} data-tooltip="#item#{{item.uuid}}" {{/if}} {{/unless}}>
|
||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" />
|
||||
{{#if (and item.usable (ne showActions false))}}
|
||||
{{#if @root.isNPC}}
|
||||
<img class="roll-img d20" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt="d20">
|
||||
{{else}}
|
||||
<img class="roll-img duality" src="systems/daggerheart/assets/icons/dice/duality/DualityBW.svg" alt="2d12">
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/ "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{!--Tags End --}}
|
||||
</div>
|
||||
{{!-- Name & Tags --}}
|
||||
<div class="item-label" draggable="true">
|
||||
{{!-- Item Name --}}
|
||||
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.hasDescription))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
|
||||
|
||||
{{!-- Simple Resource --}}
|
||||
{{#if (and (not hideResources) (not (eq item.system.resource.type 'diceValue')))}}
|
||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||
{{/if}}
|
||||
{{#if (or isQuantifiable (or (eq item.system.quantity 0) (gt item.system.quantity 1)))}}
|
||||
<div class="item-resource">
|
||||
<input type="number" id="{{item.uuid}}-quantity" class="inventory-item-quantity" value="{{item.system.quantity}}" min="0" />
|
||||
{{!-- Tags Start --}}
|
||||
{{#if (not hideTags)}}
|
||||
{{#> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item}}
|
||||
{{#if (and (eq ../type 'feature') system.featureForm (ne @root.document.type "character"))}}
|
||||
<div class="tag feature-form">
|
||||
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/ "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs"}}
|
||||
{{/if}}
|
||||
|
||||
{{!--Tags End --}}
|
||||
</div>
|
||||
|
||||
{{!-- Simple Resource --}}
|
||||
{{#if (and (not hideResources) (not (eq item.system.resource.type 'diceValue')))}}
|
||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||
{{/if}}
|
||||
{{#if (or isQuantifiable (or (eq item.system.quantity 0) (gt item.system.quantity 1)))}}
|
||||
<div class="item-resource">
|
||||
<input type="number" id="{{item.uuid}}-quantity" class="inventory-item-quantity" value="{{item.system.quantity}}" min="0" />
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{!-- Controls --}}
|
||||
{{#unless hideControls}}
|
||||
<div class="controls">
|
||||
{{!-- Toggle/Equip buttons --}}
|
||||
{{#if @root.editable}}
|
||||
{{#if (and (eq actorType 'character') (eq type 'weapon'))}}
|
||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.equipped 'unequip' 'equip' }}">
|
||||
<i class="fa-solid fa-hands" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if (and (eq actorType 'character') (eq type 'armor'))}}
|
||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.equipped 'unequip' 'equip' }}">
|
||||
<i class="fa-solid fa-fw fa-shield" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if (and (eq type 'domainCard'))}}
|
||||
<a data-action="toggleVault"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.inVault 'sendToLoadout' 'sendToVault' }}">
|
||||
<i class="fa-solid {{ifThen item.system.inVault 'fa-arrow-up' 'fa-arrow-down'}}" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if (and (and (eq type 'effect') (not (eq item.type 'beastform'))))}}
|
||||
<a data-action="toggleEffect"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.disabled 'enableEffect' 'disableEffect' }}">
|
||||
<i class="{{ifThen item.disabled 'fa-solid fa-toggle-off' 'fa-solid fa-toggle-on'}}" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{!-- Send to Chat --}}
|
||||
{{#if (hasProperty item "toChat")}}
|
||||
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">
|
||||
<i class="fa-regular fa-fw fa-message" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
|
||||
{{!-- Document management buttons or context menu --}}
|
||||
{{#if (and (not isActor) (not hideContextMenu))}}
|
||||
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
|
||||
<i class="fa-solid fa-fw fa-ellipsis-vertical" inert></i>
|
||||
</a>
|
||||
{{else if (and @root.editable (not hideModifyControls))}}
|
||||
<a data-action="editDoc" data-tooltip="DAGGERHEART.UI.Tooltip.edit">
|
||||
<i class="fa-solid fa-edit" inert></i>
|
||||
</a>
|
||||
{{#if (not isActor)}}
|
||||
<a data-action="deleteDoc" data-tooltip="DAGGERHEART.UI.Tooltip.deleteItem">
|
||||
<i class="fa-solid fa-trash" inert></i>
|
||||
</a>
|
||||
{{else if (eq type 'adversary')}}
|
||||
<a data-action='deleteAdversary' data-category="{{categoryAdversary}}" data-tooltip="CONTROLS.CommonDelete">
|
||||
<i class="fas fa-trash" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{#unless hideDescription}}
|
||||
<div class="inventory-item-content{{#unless (or noExtensible (not item.hasDescription))}} extensible{{/unless}}">
|
||||
{{!-- Description --}}
|
||||
<div class="inventory-description"></div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{!-- Dice Resource --}}
|
||||
{{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}}
|
||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||
{{/if}}
|
||||
|
||||
{{!-- Controls --}}
|
||||
{{#unless hideControls}}
|
||||
<div class="controls">
|
||||
{{!-- Toggle/Equip buttons --}}
|
||||
{{#if @root.editable}}
|
||||
{{#if (and (eq actorType 'character') (eq type 'weapon'))}}
|
||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.equipped 'unequip' 'equip' }}">
|
||||
<i class="fa-solid fa-hands" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if (and (eq actorType 'character') (eq type 'armor'))}}
|
||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.equipped 'unequip' 'equip' }}">
|
||||
<i class="fa-solid fa-fw fa-shield" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if (and (eq type 'domainCard'))}}
|
||||
<a data-action="toggleVault"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.inVault 'sendToLoadout' 'sendToVault' }}">
|
||||
<i class="fa-solid {{ifThen item.system.inVault 'fa-arrow-up' 'fa-arrow-down'}}" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if (and (and (eq type 'effect') (not (eq item.type 'beastform'))))}}
|
||||
<a data-action="toggleEffect"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.disabled 'enableEffect' 'disableEffect' }}">
|
||||
<i class="{{ifThen item.disabled 'fa-solid fa-toggle-off' 'fa-solid fa-toggle-on'}}" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{!-- Actions Buttons --}}
|
||||
{{#if (and showActions item.system.actions.size)}}
|
||||
<div class="item-buttons">
|
||||
{{#each item.system.actions as | action |}}
|
||||
<div class="item-button">
|
||||
{{#if (and (eq action.type 'beastform') @root.beastformActive)}}
|
||||
<button type="button" data-action="cancelBeastform" data-item-uuid="{{action.uuid}}">
|
||||
<i class="fa-solid {{action.typeIcon}} action-icon"></i>
|
||||
{{localize "DAGGERHEART.ACTORS.Character.cancelBeastform"}}
|
||||
</button>
|
||||
{{else}}
|
||||
<button type="button" data-action="useItem" data-item-uuid="{{action.uuid}}">
|
||||
<i class="fa-solid {{action.typeIcon}} action-icon"></i>
|
||||
{{action.name}}
|
||||
</button>
|
||||
{{/if}}
|
||||
|
||||
{{!-- Send to Chat --}}
|
||||
{{#if (hasProperty item "toChat")}}
|
||||
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">
|
||||
<i class="fa-regular fa-fw fa-message" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
|
||||
{{!-- Document management buttons or context menu --}}
|
||||
{{#if (and (not isActor) (not hideContextMenu))}}
|
||||
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
|
||||
<i class="fa-solid fa-fw fa-ellipsis-vertical" inert></i>
|
||||
</a>
|
||||
{{else if (and @root.editable (not hideModifyControls))}}
|
||||
<a data-action="editDoc" data-tooltip="DAGGERHEART.UI.Tooltip.edit">
|
||||
<i class="fa-solid fa-edit" inert></i>
|
||||
</a>
|
||||
{{#if (not isActor)}}
|
||||
<a data-action="deleteDoc" data-tooltip="DAGGERHEART.UI.Tooltip.deleteItem">
|
||||
<i class="fa-solid fa-trash" inert></i>
|
||||
</a>
|
||||
{{else if (eq type 'adversary')}}
|
||||
<a data-action='deleteAdversary' data-category="{{categoryAdversary}}" data-tooltip="CONTROLS.CommonDelete">
|
||||
<i class="fas fa-trash" inert></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if action.uses.max}}
|
||||
<div class="spacer"></div>
|
||||
<button type="button" class="action-uses-button" data-action="increaseActionUses" data-item-uuid="{{action.uuid}}">
|
||||
{{action.remainingUses}}/{{action.uses.max}}
|
||||
</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
<div class="inventory-item-content{{#unless noExtensible}} extensible{{/unless}}">
|
||||
{{!-- Description --}}
|
||||
{{#unless hideDescription}}
|
||||
<div class="invetory-description"></div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{!-- Dice Resource --}}
|
||||
{{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}}
|
||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||
{{/if}}
|
||||
{{!-- Actions Buttons --}}
|
||||
{{#if (and showActions item.system.actions.size)}}
|
||||
<div class="item-buttons">
|
||||
{{#each item.system.actions as | action |}}
|
||||
<div class="item-button">
|
||||
{{#if (and (eq action.type 'beastform') @root.beastformActive)}}
|
||||
<button type="button" data-action="cancelBeastform" data-item-uuid="{{action.uuid}}">
|
||||
<i class="fa-solid {{action.typeIcon}} action-icon"></i>
|
||||
{{localize "DAGGERHEART.ACTORS.Character.cancelBeastform"}}
|
||||
</button>
|
||||
{{else}}
|
||||
<button type="button" data-action="useItem" data-item-uuid="{{action.uuid}}">
|
||||
<i class="fa-solid {{action.typeIcon}} action-icon"></i>
|
||||
{{action.name}}
|
||||
</button>
|
||||
{{/if}}
|
||||
{{#if action.uses.max}}
|
||||
<div class="spacer"></div>
|
||||
<button type="button" class="action-uses-button" data-action="increaseActionUses" data-item-uuid="{{action.uuid}}">
|
||||
{{action.remainingUses}}/{{action.uses.max}}
|
||||
</button>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</li>
|
||||
Loading…
Add table
Add a link
Reference in a new issue