Fixed drag/drop of features for environments (#1488)

This commit is contained in:
WBHarry 2025-12-29 13:02:22 +01:00 committed by GitHub
parent c070c6cc2d
commit f6bd1430e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 52 additions and 7 deletions

View file

@ -30,7 +30,7 @@ export default class DhpEnvironment extends DHBaseActorSheet {
dragSelector: '[data-item-id][draggable="true"], [data-item-id] [draggable="true"]',
dropSelector: null
}
],
]
};
/**@override */
@ -79,6 +79,9 @@ export default class DhpEnvironment extends DHBaseActorSheet {
case 'header':
await this._prepareHeaderContext(context, options);
break;
case 'features':
await this._prepareFeaturesContext(context, options);
break;
case 'notes':
await this._prepareNotesContext(context, options);
@ -115,6 +118,22 @@ export default class DhpEnvironment extends DHBaseActorSheet {
}
}
/**
* Prepare render context for the features part.
* @param {ApplicationRenderContext} context
* @param {ApplicationRenderOptions} options
* @returns {Promise<void>}
* @protected
*/
async _prepareFeaturesContext(context, _options) {
const featureForms = ['passive', 'action', 'reaction'];
context.features = this.document.system.features.sort((a, b) =>
a.system.featureForm !== b.system.featureForm
? featureForms.indexOf(a.system.featureForm) - featureForms.indexOf(b.system.featureForm)
: a.sort - b.sort
);
}
/**
* Prepare render context for the Header part.
* @param {ApplicationRenderContext} context