fix(ui): no objects rendered until vis toggled

This commit is contained in:
psychedelicious 2024-08-06 13:37:41 +10:00
parent e1cb30bbb4
commit f4de2fd3b1
2 changed files with 5 additions and 5 deletions

View File

@ -117,6 +117,6 @@ export class CanvasInpaintMask {
updateVisibility = (arg?: { isEnabled: boolean }) => {
this.log.trace('Updating visibility');
const isEnabled = get(arg, 'isEnabled', this.state.isEnabled);
this.konva.layer.visible(isEnabled && this.renderer.hasObjects());
this.konva.layer.visible(isEnabled);
};
}

View File

@ -70,6 +70,9 @@ export class CanvasLayer {
this.log.debug('Updating');
const { position, objects, opacity, isEnabled } = state;
if (this.isFirstRender || isEnabled !== this.state.isEnabled) {
this.updateVisibility({ isEnabled });
}
if (this.isFirstRender || objects !== this.state.objects) {
await this.updateObjects({ objects });
}
@ -79,9 +82,6 @@ export class CanvasLayer {
if (this.isFirstRender || opacity !== this.state.opacity) {
this.updateOpacity({ opacity });
}
if (this.isFirstRender || isEnabled !== this.state.isEnabled) {
this.updateVisibility({ isEnabled });
}
// this.transformer.syncInteractionState();
if (this.isFirstRender) {
@ -95,7 +95,7 @@ export class CanvasLayer {
updateVisibility = (arg?: { isEnabled: boolean }) => {
this.log.trace('Updating visibility');
const isEnabled = get(arg, 'isEnabled', this.state.isEnabled);
this.konva.layer.visible(isEnabled && this.renderer.hasObjects());
this.konva.layer.visible(isEnabled);
};
updateObjects = async (arg?: { objects: CanvasLayerState['objects'] }) => {