Fix: problème de contexte WebGL
WARNING: Too many active WebGL contexts. Oldest context will be lost. Semble lié à la destruction incorrecte de l'Application PIXI des TMR, en cas de nombreuses ouvertures/fermetures
This commit is contained in:
parent
0ec31d8ddc
commit
4fe487a0ec
@ -86,16 +86,13 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
this._tellToGM(this.actor.name + " monte dans les terres médianes (" + tmrData.mode + ")");
|
this._tellToGM(this.actor.name + " monte dans les terres médianes (" + tmrData.mode + ")");
|
||||||
}
|
}
|
||||||
this.callbacksOnAnimate = [];
|
this.callbacksOnAnimate = [];
|
||||||
this.resizePixiTMR(
|
const displaySize = TMR_DISPLAY_SIZE.clamp(game.settings.get(SYSTEM_RDD, TMR_DISPLAY_SIZE.code) ?? TMR_DISPLAY_SIZE.def);
|
||||||
TMR_DISPLAY_SIZE.clamp(game.settings.get(SYSTEM_RDD, TMR_DISPLAY_SIZE.code) ?? TMR_DISPLAY_SIZE.def)
|
this.pixiTMR = new PixiTMR(this, displaySize);
|
||||||
)
|
this.resizePixiTMR(displaySize)
|
||||||
}
|
}
|
||||||
|
|
||||||
resizePixiTMR(displaySize) {
|
resizePixiTMR(displaySize) {
|
||||||
if (displaySize != this.displaySize) {
|
if (displaySize != this.displaySize) {
|
||||||
if (!this.pixiTMR) {
|
|
||||||
this.pixiTMR = new PixiTMR(this, displaySize);
|
|
||||||
}
|
|
||||||
this.displaySize = displaySize
|
this.displaySize = displaySize
|
||||||
this.pixiTMR.resizeTMR(displaySize);
|
this.pixiTMR.resizeTMR(displaySize);
|
||||||
this._removeTokens()
|
this._removeTokens()
|
||||||
@ -334,13 +331,10 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async close() {
|
async close() {
|
||||||
|
|
||||||
if (this.subdialog) {
|
if (this.subdialog) {
|
||||||
return this.forceTMRContinueAction()
|
return this.forceTMRContinueAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.descenteTMR = true;
|
this.descenteTMR = true;
|
||||||
this.pixiTMR.close()
|
|
||||||
if (this.actor.tmrApp) {
|
if (this.actor.tmrApp) {
|
||||||
this.actor.tmrApp = undefined; // Cleanup reference
|
this.actor.tmrApp = undefined; // Cleanup reference
|
||||||
if (!this.viewOnly) {
|
if (!this.viewOnly) {
|
||||||
@ -348,9 +342,11 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
this._tellToGM(this.actor.name + " a quitté les terres médianes");
|
this._tellToGM(this.actor.name + " a quitté les terres médianes");
|
||||||
}
|
}
|
||||||
await this.actor.santeIncDec((ReglesOptionnelles.isUsing("appliquer-fatigue") ? "fatigue" : "endurance"),
|
await this.actor.santeIncDec((ReglesOptionnelles.isUsing("appliquer-fatigue") ? "fatigue" : "endurance"),
|
||||||
this.cumulFatigue)
|
this.cumulFatigue)
|
||||||
}
|
}
|
||||||
await super.close();
|
await super.close();
|
||||||
|
this.pixiTMR.close()
|
||||||
|
this.pixiTMR = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -26,6 +26,7 @@ export class PixiTMR {
|
|||||||
this.tmrDialog = tmrDialog;
|
this.tmrDialog = tmrDialog;
|
||||||
this.callbacksOnAnimate = [];
|
this.callbacksOnAnimate = [];
|
||||||
this.sizes = new TMRConstants({ size: displaySize })
|
this.sizes = new TMRConstants({ size: displaySize })
|
||||||
|
console.info(`Creation d'Application PIXI pour les TMR de ${tmrDialog.actor.name}`)
|
||||||
this.pixiApp = new PIXI.Application(PixiTMR.computeTMRSize(this.sizes));
|
this.pixiApp = new PIXI.Application(PixiTMR.computeTMRSize(this.sizes));
|
||||||
this.pixiApp.eventMode = 'static';
|
this.pixiApp.eventMode = 'static';
|
||||||
this.pixiApp.stage.sortableChildren = true;
|
this.pixiApp.stage.sortableChildren = true;
|
||||||
@ -45,7 +46,9 @@ export class PixiTMR {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.pixiApp.ticker.stop();
|
console.info(`Destruction d'Application PIXI pour les TMR de ${this.tmrDialog.actor.name}`)
|
||||||
|
this.pixiApp.destroy();
|
||||||
|
this.pixiApp = undefined
|
||||||
}
|
}
|
||||||
static computeTMRSize(sizeConstants) {
|
static computeTMRSize(sizeConstants) {
|
||||||
return { width: sizeConstants.cellw * 13 + sizeConstants.marginx, height: sizeConstants.cellh / 2 + sizeConstants.cellh * 15 + sizeConstants.marginy }
|
return { width: sizeConstants.cellw * 13 + sizeConstants.marginx, height: sizeConstants.cellh / 2 + sizeConstants.cellh * 15 + sizeConstants.marginy }
|
||||||
|
Loading…
Reference in New Issue
Block a user