From 56a5d06f16f2747fbc1d50a1429e40dd272e6006 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 8 Dec 2023 22:31:26 +0100 Subject: [PATCH] Fix erreur console ouverture TMR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit quand TMR pas affichées, bringToTop ne marche pas --- module/rdd-tmr-dialog.js | 16 +++++++++------- module/tmr/present-cites.js | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 8224dac6..3e04dac4 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -162,9 +162,11 @@ export class RdDTMRDialog extends Dialog { } async forceTMRDisplay() { - this.bringToTop() - if (this.subdialog?.bringToTop) { - this.subdialog.bringToTop(); + if (this.rendered) { + this.bringToTop() + if (this.subdialog?.bringToTop) { + this.subdialog.bringToTop(); + } } } @@ -581,7 +583,7 @@ export class RdDTMRDialog extends Dialog { } this.descenteTMR = false; this.currentRencontre = undefined; - if (this._presentCite(tmr)) { + if (await this._presentCite(tmr)) { return; } this.currentRencontre = await this._jetDeRencontre(tmr); @@ -592,7 +594,7 @@ export class RdDTMRDialog extends Dialog { } else { const dialog = new RdDTMRRencontreDialog(this.actor, this.currentRencontre, tmr); - dialog.render(true); + await dialog.render(true); this.setTMRPendingAction(dialog); } } @@ -602,11 +604,11 @@ export class RdDTMRDialog extends Dialog { } /* -------------------------------------------- */ - _presentCite(tmr) { + async _presentCite(tmr) { const presentCite = this.casesSpeciales.find(c => EffetsDraconiques.presentCites.isCase(c, tmr.coord)); if (presentCite) { const caseData = presentCite; - const dialog = EffetsDraconiques.presentCites.choisirUnPresent(caseData, present => { + const dialog = await EffetsDraconiques.presentCites.choisirUnPresent(caseData, present => { this._utiliserPresentCite(presentCite, present, tmr) this.restoreTMRAfterAction(); }); diff --git a/module/tmr/present-cites.js b/module/tmr/present-cites.js index c3eade99..1b00a8b0 100644 --- a/module/tmr/present-cites.js +++ b/module/tmr/present-cites.js @@ -49,7 +49,7 @@ export class PresentCites extends Draconique { content: `La ${this.tmrLabel(casetmr)} vous offre un présent, faites votre choix`, buttons: buttons }); - dialog.render(true); + await dialog.render(true); return dialog }