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() { bringSubDialogToTop() {
if (this.subdialog?.bringToTop && this.subdialog?.element[0]) { if (this.subdialog?.bringToTop && this.subdialog?.element && this.subdialog?.element[0]) {
this.subdialog.bringToTop(); this.subdialog.bringToTop();
} }
} }
@ -241,10 +241,11 @@ export class RdDTMRDialog extends Dialog {
this._getTokensRencontres().forEach(t => this._trackToken(t)) this._getTokensRencontres().forEach(t => this._trackToken(t))
this._getTokensSortsReserve().forEach(t => this._trackToken(t)) this._getTokensSortsReserve().forEach(t => this._trackToken(t))
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
updateTokens() { updateTokens() {
this._removeTokens(t => true); this._removeTokens(t => true);
this.allTokens = []
this.loadRencontres(); this.loadRencontres();
this.loadCasesSpeciales(); this.loadCasesSpeciales();
this._createTokens(); this._createTokens();
@ -1133,6 +1134,14 @@ export class RdDTMRDialog extends Dialog {
return tmr; 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) { _removeTokens(filter = it => true) {
this.allTokens.filter(filter).forEach(token => this.pixiTMR.removeToken(token)) this.allTokens.filter(filter).forEach(token => this.pixiTMR.removeToken(token))
@ -1144,7 +1153,7 @@ export class RdDTMRDialog extends Dialog {
return return
} }
if (this.demiReve === token && this.isDemiReveCache()) { if (this.demiReve === token && this.isDemiReveCache()) {
return; return
} }
this.pixiTMR.positionToken(token); this.pixiTMR.positionToken(token);
if (!this.allTokens.includes(token)) { if (!this.allTokens.includes(token)) {

View File

@ -184,12 +184,9 @@ export class PixiTMR {
const coordTMR = TMRUtility.oddqToCoordTMR(oddq); const coordTMR = TMRUtility.oddqToCoordTMR(oddq);
const tmr = TMRUtility.getTMR(coordTMR) const tmr = TMRUtility.getTMR(coordTMR)
if (tmr) { if (tmr) {
const tmrTooltip = `${coordTMR}: ${TMRUtility.getTMRLabel(coordTMR)}`; return this.tmrDialog.getTokensDetails(coordTMR)
const tokenTooltips = this.tmrDialog.allTokens
.filter(token => token.coordTMR() == coordTMR)
.map(token => token.tooltip);
return [tmrTooltip, ...tokenTooltips].reduce(Misc.joining('\n'))
} }
return undefined
} }
computeEventOddq(event) { computeEventOddq(event) {