mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
.
This commit is contained in:
parent
2962f8b755
commit
3b237a223f
3 changed files with 37 additions and 8 deletions
|
|
@ -17,4 +17,30 @@ export default class DhActorDirectory extends foundry.applications.sidebar.tabs.
|
||||||
: null;
|
: null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
_onDragStart(event) {
|
||||||
|
let actor;
|
||||||
|
const { entryId } = event.currentTarget.dataset;
|
||||||
|
if (entryId) {
|
||||||
|
actor = this.collection.get(entryId);
|
||||||
|
if (!actor?.visible) return false;
|
||||||
|
}
|
||||||
|
super._onDragStart(event);
|
||||||
|
|
||||||
|
// Create the drag preview.
|
||||||
|
if (actor && canvas.ready) {
|
||||||
|
const img = event.currentTarget.querySelector('img');
|
||||||
|
const pt = actor.prototypeToken;
|
||||||
|
const usesSize = actor.system.metadata.usesSize;
|
||||||
|
const tokenSizes = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).tokenSizes;
|
||||||
|
const width = usesSize ? tokenSizes[actor.system.size] : pt.width;
|
||||||
|
const height = usesSize ? tokenSizes[actor.system.size] : pt.height;
|
||||||
|
|
||||||
|
const w = width * canvas.dimensions.size * Math.abs(pt.texture.scaleX) * canvas.stage.scale.x;
|
||||||
|
const h = height * canvas.dimensions.size * Math.abs(pt.texture.scaleY) * canvas.stage.scale.y;
|
||||||
|
const preview = foundry.applications.ux.DragDrop.implementation.createDragImage(img, w, h);
|
||||||
|
event.dataTransfer.setDragImage(preview, w / 2, h / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,14 +146,6 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
||||||
options.scrollingTextData = textData;
|
options.scrollingTextData = textData;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.parent.isToken && changes.system?.size) {
|
|
||||||
const tokenSizes = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).tokenSizes;
|
|
||||||
this.parent.prototypeToken.update({
|
|
||||||
width: tokenSizes[changes.system.size],
|
|
||||||
height: tokenSizes[changes.system.size]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changes.system?.resources) {
|
if (changes.system?.resources) {
|
||||||
const defeatedSettings = game.settings.get(
|
const defeatedSettings = game.settings.get(
|
||||||
CONFIG.DH.id,
|
CONFIG.DH.id,
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,17 @@ export default class DHToken extends TokenDocument {
|
||||||
super.deleteCombatants(tokens, combat ?? {});
|
super.deleteCombatants(tokens, combat ?? {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**@inheritdoc */
|
||||||
|
getSize(data = {}) {
|
||||||
|
if (this.actor?.system.metadata.usesSize) {
|
||||||
|
const tokenSizes = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).tokenSizes;
|
||||||
|
const size = tokenSizes[this.actor.system.size];
|
||||||
|
return super.getSize({ ...data, width: size, height: size });
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getSize(data);
|
||||||
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
_onRelatedUpdate(update = {}, operation = {}) {
|
_onRelatedUpdate(update = {}, operation = {}) {
|
||||||
super._onRelatedUpdate(update, operation);
|
super._onRelatedUpdate(update, operation);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue