diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 7389b9ad..5bfc1cea 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -176,7 +176,7 @@ export class RdDTMRDialog extends Dialog { } bringSubDialogToTop() { - if (this.subdialog?.bringToTop && this.subdialog?.element[0]) { + if (this.subdialog?.bringToTop && this.subdialog?.element && this.subdialog?.element[0]) { this.subdialog.bringToTop(); } } @@ -241,10 +241,11 @@ export class RdDTMRDialog extends Dialog { this._getTokensRencontres().forEach(t => this._trackToken(t)) this._getTokensSortsReserve().forEach(t => this._trackToken(t)) } - + /* -------------------------------------------- */ updateTokens() { this._removeTokens(t => true); + this.allTokens = [] this.loadRencontres(); this.loadCasesSpeciales(); this._createTokens(); @@ -1133,6 +1134,14 @@ export class RdDTMRDialog extends Dialog { return tmr; } + getTokensDetails(coordTMR) { + const tmrTooltip = `${coordTMR}: ${TMRUtility.getTMRLabel(coordTMR)}` + const tokenTooltips = this.allTokens + .filter(token => token.coordTMR() == coordTMR) + .map(token => token.tooltip); + return [tmrTooltip, ...tokenTooltips].reduce(Misc.joining('\n')) + } + /* -------------------------------------------- */ _removeTokens(filter = it => true) { this.allTokens.filter(filter).forEach(token => this.pixiTMR.removeToken(token)) @@ -1144,7 +1153,7 @@ export class RdDTMRDialog extends Dialog { return } if (this.demiReve === token && this.isDemiReveCache()) { - return; + return } this.pixiTMR.positionToken(token); if (!this.allTokens.includes(token)) { diff --git a/module/tmr/pixi-tmr.js b/module/tmr/pixi-tmr.js index 781e138b..4d891eb8 100644 --- a/module/tmr/pixi-tmr.js +++ b/module/tmr/pixi-tmr.js @@ -184,12 +184,9 @@ export class PixiTMR { const coordTMR = TMRUtility.oddqToCoordTMR(oddq); const tmr = TMRUtility.getTMR(coordTMR) if (tmr) { - const tmrTooltip = `${coordTMR}: ${TMRUtility.getTMRLabel(coordTMR)}`; - const tokenTooltips = this.tmrDialog.allTokens - .filter(token => token.coordTMR() == coordTMR) - .map(token => token.tooltip); - return [tmrTooltip, ...tokenTooltips].reduce(Misc.joining('\n')) + return this.tmrDialog.getTokensDetails(coordTMR) } + return undefined } computeEventOddq(event) {