mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[PR][Feature] Actor Sizes (#1433)
* Added support for adversary actor sizes * . * . * Finished token implementation * Fixed token-config * Updated SRD adversaries * . * Added size to Beastform tokenData * Fixed sizing for evolved beastforms * Beastform compendium update * .
This commit is contained in:
parent
7926c614e3
commit
8178fa5738
176 changed files with 1198 additions and 203 deletions
|
|
@ -17,4 +17,30 @@ export default class DhActorDirectory extends foundry.applications.sidebar.tabs.
|
|||
: 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue