mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Fix item summary animation replaying on every rerender (#1176)
This commit is contained in:
parent
f1b5c80a53
commit
e655954890
1 changed files with 14 additions and 5 deletions
|
|
@ -203,11 +203,19 @@ export default function DHApplicationMixin(Base) {
|
||||||
this.relatedDocs.filter(doc => doc).map(doc => delete doc.apps[this.id]);
|
this.relatedDocs.filter(doc => doc).map(doc => delete doc.apps[this.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _renderHTML(context, options) {
|
||||||
|
const rendered = await super._renderHTML(context, options);
|
||||||
|
for (const result of Object.values(rendered)) {
|
||||||
|
await this.#prepareInventoryDescription(result);
|
||||||
|
}
|
||||||
|
return rendered;
|
||||||
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async _onRender(context, options) {
|
async _onRender(context, options) {
|
||||||
await super._onRender(context, options);
|
await super._onRender(context, options);
|
||||||
this._createTagifyElements(this.options.tagifyConfigs);
|
this._createTagifyElements(this.options.tagifyConfigs);
|
||||||
await this.#prepareInventoryDescription(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -215,8 +223,8 @@ export default function DHApplicationMixin(Base) {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
_syncPartState(partId, newElement, priorElement, state) {
|
_preSyncPartState(partId, newElement, priorElement, state) {
|
||||||
super._syncPartState(partId, newElement, priorElement, state);
|
super._preSyncPartState(partId, newElement, priorElement, state);
|
||||||
for (const el of priorElement.querySelectorAll('.extensible.extended')) {
|
for (const el of priorElement.querySelectorAll('.extensible.extended')) {
|
||||||
const { actionId, itemUuid } = el.parentElement.dataset;
|
const { actionId, itemUuid } = el.parentElement.dataset;
|
||||||
const selector = `${actionId ? `[data-action-id="${actionId}"]` : `[data-item-uuid="${itemUuid}"]`} .extensible`;
|
const selector = `${actionId ? `[data-action-id="${actionId}"]` : `[data-item-uuid="${itemUuid}"]`} .extensible`;
|
||||||
|
|
@ -496,11 +504,12 @@ export default function DHApplicationMixin(Base) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares and enriches an inventory item or action description for display.
|
* Prepares and enriches an inventory item or action description for display.
|
||||||
|
* @param {HTMLElement} element the element to enrich the inventory items of
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async #prepareInventoryDescription(context) {
|
async #prepareInventoryDescription(element) {
|
||||||
// Get all inventory item elements with a data-item-uuid attribute
|
// Get all inventory item elements with a data-item-uuid attribute
|
||||||
const inventoryItems = this.element.querySelectorAll('.inventory-item[data-item-uuid]');
|
const inventoryItems = element.querySelectorAll('.inventory-item[data-item-uuid]');
|
||||||
for (const el of inventoryItems) {
|
for (const el of inventoryItems) {
|
||||||
// Get the doc uuid from the element
|
// Get the doc uuid from the element
|
||||||
const { itemUuid } = el?.dataset || {};
|
const { itemUuid } = el?.dataset || {};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue