Skip to content

Commit 3a79f98

Browse files
committed
Version bump
- proofed hud button insertion against modules extending BasePlaceableHUD - proofed hud button click detection against programmatic click dispatch
1 parent 706726b commit 3a79f98

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Token Magic FX - Update v0.7.6.1
2+
3+
- Fixed errors thrown during `renderBasePlaceableHUD`
4+
- Placeable HUD button clicks are now proofed to make sure they're not programmatically dispatched #299
5+
16
# Token Magic FX - Update v0.7.6
27

38
**Filter Editor**

tokenmagic/module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"id": "tokenmagic",
33
"title": "Token Magic FX",
44
"description": "<p>Add special effects and animations on your tokens, tiles, drawings, templates, and regions</p>",
5-
"version": "0.7.6",
5+
"version": "0.7.6.1",
66
"manifest": "https://github.com/Feu-Secret/Tokenmagic/releases/latest/download/module.json",
7-
"download": "https://github.com/Feu-Secret/Tokenmagic/releases/download/0.7.6/tokenmagic.zip",
7+
"download": "https://github.com/Feu-Secret/Tokenmagic/releases/download/0.7.6.1/tokenmagic.zip",
88
"compatibility": {
99
"minimum": "13",
1010
"verified": "13.350"

tokenmagic/module/tokenmagic.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,16 +2199,18 @@ Hooks.on('preCreateMeasuredTemplate', (document) => {
21992199
/* -------------------------------------------- */
22002200

22012201
Hooks.on('renderBasePlaceableHUD', (hud, form, data, options) => {
2202-
if (!game.user.isGM) return;
2202+
if (!game.user.isGM || !hud.document._TMFXgetPlaceableType?.()) return;
22032203

22042204
const alwaysDisplay = game.settings.get('tokenmagic', 'alwaysDisplayEditorControl');
22052205
if (!alwaysDisplay && !hud.object.document.getFlag('tokenmagic', 'filters')?.length) {
22062206
return;
22072207
}
22082208

2209+
const leftColumn = form.querySelector('.placeable-hud .col.left');
2210+
if (!leftColumn) return;
2211+
22092212
const button = document.createElement('button');
22102213
button.classList.add('control-icon');
2211-
//if (foundry.utils.getProperty(data, 'flags.tokenmagic.filters')?.length) button.classList.add('active');
22122214

22132215
button.dataset.action = 'tmfx-editor';
22142216
button.dataset.tooltip = game.i18n.localize('TMFX.hud.title');
@@ -2218,10 +2220,11 @@ Hooks.on('renderBasePlaceableHUD', (hud, form, data, options) => {
22182220

22192221
button.appendChild(icon);
22202222
button.addEventListener('click', (event) => {
2221-
window.TokenMagic.filterEditor(hud.object, event.target.closest('.col.left').getBoundingClientRect());
2223+
if (event.pointerType)
2224+
window.TokenMagic.filterEditor(hud.object, event.target.closest('.col.left').getBoundingClientRect());
22222225
});
22232226

2224-
form.querySelector('.placeable-hud .col.left').appendChild(button);
2227+
leftColumn.appendChild(button);
22252228
});
22262229

22272230
Hooks.on('getHeaderControlsDocumentSheetV2', (config, controls) => {

0 commit comments

Comments
 (0)