Correction tooltips TMR multiples

This commit is contained in:
Vincent Vandemeulebrouck 2024-12-09 23:00:43 +01:00
parent b160ce78bc
commit 23b3be246b
2 changed files with 14 additions and 8 deletions

View File

@ -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)) {

View File

@ -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) {