From 1f21056e286d0664713bc4dc1189c7dc6869a6ee Mon Sep 17 00:00:00 2001 From: Dorako Date: Wed, 12 Apr 2023 20:44:47 +0200 Subject: [PATCH] 2.1.5 --- CHANGELOG.md | 4 ++++ modules/pixi.js | 32 ++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab41f5a..77393d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.1.5 + +- (Fix) Fix canvas rendering breaking due to skull overlay change in 2.14 when adjusted token setting was disabled. + # 2.1.4 - (Refinement) Adjusted token effect icons are now larger. diff --git a/modules/pixi.js b/modules/pixi.js index 7b5d0a5..6220eab 100644 --- a/modules/pixi.js +++ b/modules/pixi.js @@ -13,26 +13,30 @@ Token.prototype._refreshEffects = function (...args) { }; const origDrawOverlay = Token.prototype._drawOverlay; -Token.prototype._drawOverlay = async function (src, tint) { +Token.prototype._drawOverlay = async function (...args) { const enabled = game.settings.get("pf2e-dorako-ui", "ux.adjust-token-effects-hud"); if (!enabled) { origDrawOverlay.apply(this, args); return; } - const icon = await this._drawEffect(src, tint); - if (icon) { - const gridSize = this.scene?.grid?.size ?? 100; - const gridScale = gridSize / 100; - const tile = this.document.width; - icon.alpha = 0.8; - icon.x = 24 * gridScale * tile; - icon.y = 24 * gridScale * tile; - icon.width = 48 * gridScale * tile; - icon.height = 48 * gridScale * tile; + if (this) { + const src = args.src; + const tint = args.tint; + const icon = await this._drawEffect(src, tint); + if (icon) { + const gridSize = this.scene?.grid?.size ?? 100; + const gridScale = gridSize / 100; + const tile = this.document.width; + icon.alpha = 0.8; + icon.x = 24 * gridScale * tile; + icon.y = 24 * gridScale * tile; + icon.width = 48 * gridScale * tile; + icon.height = 48 * gridScale * tile; + } + // icon.anchor.set(0.5); + // debugger; + return icon; } - // icon.anchor.set(0.5); - // debugger; - return icon; }; // const origDrawEffect = Token.prototype._drawEffect;