feat(ui) do not set $canvasManager until ready

This commit is contained in:
psychedelicious 2024-08-21 17:54:56 +10:00
parent 9b3b961105
commit 0a2afed08b
2 changed files with 5 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import { logger } from 'app/logging/logger';
import { useAppStore } from 'app/store/nanostores/store';
import { useAppSelector } from 'app/store/storeHooks';
import { HeadsUpDisplay } from 'features/controlLayers/components/HeadsUpDisplay';
import { $canvasManager, CanvasManager } from 'features/controlLayers/konva/CanvasManager';
import { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
import { TRANSPARENCY_CHECKER_PATTERN } from 'features/controlLayers/konva/constants';
import Konva from 'konva';
import { memo, useCallback, useEffect, useLayoutEffect, useState } from 'react';
@ -38,7 +38,6 @@ const useStageRenderer = (stage: Konva.Stage, container: HTMLDivElement | null,
}
const manager = new CanvasManager(stage, container, store, socket);
$canvasManager.set(manager);
console.log(manager);
const cleanup = manager.initialize();
return cleanup;

View File

@ -454,6 +454,10 @@ export class CanvasManager {
this.log.debug('Arranging entities');
await this.arrangeEntities();
}
if (isFirstRender) {
$canvasManager.set(this);
}
};
initialize = () => {