From 2a3546db9741938b2e25aea340ac6ee0d0382fe8 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:50:11 +1000 Subject: [PATCH] tidy(ui): remove "filter" from CanvasImageState --- .../controlLayers/konva/CanvasImage.ts | 18 +----------------- .../src/features/controlLayers/store/types.ts | 2 -- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasImage.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasImage.ts index 9b691dcdb2..d2d129f70d 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasImage.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasImage.ts @@ -5,7 +5,6 @@ import type { CanvasFilter } from 'features/controlLayers/konva/CanvasFilter'; import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager'; import type { CanvasObjectRenderer } from 'features/controlLayers/konva/CanvasObjectRenderer'; import type { CanvasStagingArea } from 'features/controlLayers/konva/CanvasStagingArea'; -import { FILTER_MAP } from 'features/controlLayers/konva/filters'; import { loadImage } from 'features/controlLayers/konva/util'; import type { CanvasImageState } from 'features/controlLayers/store/types'; import { t } from 'i18next'; @@ -137,14 +136,6 @@ export class CanvasImageRenderer { this.konva.group.add(this.konva.image); } - if (this.state.filters.length > 0) { - this.konva.image.cache(); - this.konva.image.filters(this.state.filters.map((f) => FILTER_MAP[f])); - } else { - this.konva.image.clearCache(); - this.konva.image.filters([]); - } - this.konva.placeholder.rect.setAttrs({ width, height }); this.konva.placeholder.text.setAttrs({ width, height, fontSize: width / 16 }); @@ -161,19 +152,12 @@ export class CanvasImageRenderer { if (force || this.state !== state) { this.log.trace({ state }, 'Updating image'); - const { image, filters } = state; + const { image } = state; const { width, height, image_name } = image; if (force || (this.state.image.image_name !== image_name && !this.isLoading)) { await this.updateImageSource(image_name); } this.konva.image?.setAttrs({ width, height }); - if (filters.length > 0) { - this.konva.image?.cache(); - this.konva.image?.filters(filters.map((f) => FILTER_MAP[f])); - } else { - this.konva.image?.clearCache(); - this.konva.image?.filters([]); - } this.state = state; return true; } diff --git a/invokeai/frontend/web/src/features/controlLayers/store/types.ts b/invokeai/frontend/web/src/features/controlLayers/store/types.ts index bc59752e3d..ab160fd433 100644 --- a/invokeai/frontend/web/src/features/controlLayers/store/types.ts +++ b/invokeai/frontend/web/src/features/controlLayers/store/types.ts @@ -566,7 +566,6 @@ const zCanvasImageState = z.object({ id: zId, type: z.literal('image'), image: zImageWithDims, - filters: z.array(zLayerEffect), }); export type CanvasImageState = z.infer; @@ -806,7 +805,6 @@ export const imageDTOToImageObject = (imageDTO: ImageDTO, overrides?: Partial