From 4c065eb830131de38677505ed8aa3c7f165c4718 Mon Sep 17 00:00:00 2001 From: ienaga Date: Tue, 16 Jul 2024 21:05:43 +0900 Subject: [PATCH] =?UTF-8?q?#147=20feat:=20canvas=E3=81=AE=E3=82=AD?= =?UTF-8?q?=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=E3=82=AD=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E7=94=9F=E6=88=90=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/MovieClipCreateDisplayObjectElementUseCase.ts | 4 ++-- .../usecase/ShapeCreateDisplayObjectElementUseCase.ts | 4 ++-- src/js/core/domain/model/Character.ts | 8 ++++++++ .../service/ScreenDisplayObjectUpdateMaskStyleService.ts | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/js/core/application/MovieClip/usecase/MovieClipCreateDisplayObjectElementUseCase.ts b/src/js/core/application/MovieClip/usecase/MovieClipCreateDisplayObjectElementUseCase.ts index 22c88c01..baef1319 100644 --- a/src/js/core/application/MovieClip/usecase/MovieClipCreateDisplayObjectElementUseCase.ts +++ b/src/js/core/application/MovieClip/usecase/MovieClipCreateDisplayObjectElementUseCase.ts @@ -4,7 +4,7 @@ import type { Layer } from "@/core/domain/model/Layer"; import type { MovieClip } from "@/core/domain/model/MovieClip"; import { execute as movieClipRegisterEventUseCase } from "@/core/application/MovieClip/usecase/MovieClipRegisterEventUseCase"; import { execute as movieClipDisplayObjectComponent } from "../component/MovieClipDisplayObjectComponent"; -import { $getCacheCanvas } from "@/cache/CacheUtil"; +import { $getCacheCanvas, $setCacheCanvas } from "@/cache/CacheUtil"; import { execute as instanceUpdateBlendModeService } from "@/core/application/Instance/service/InstanceUpdateBlendModeService"; import { execute as screenAreaHierarchyAdjustmentService } from "@/screen/application/ScreenArea/service/ScreenAreaHierarchyAdjustmentService"; import { $getDeactivated, $getReDrawState } from "@/screen/application/ScreenArea/ScreenAreaUtil"; @@ -40,7 +40,7 @@ export const execute = async ( canvas = await instance.getHTMLElement(); // キャッシュに保存 - // $setCacheCanvas(work_space_id, instance.id, cacheKey, canvas); + $setCacheCanvas(work_space_id, instance.id, cacheKey, canvas); } // ブレンドモードを設定 diff --git a/src/js/core/application/Shape/usecase/ShapeCreateDisplayObjectElementUseCase.ts b/src/js/core/application/Shape/usecase/ShapeCreateDisplayObjectElementUseCase.ts index 28578cc8..0d532e7b 100644 --- a/src/js/core/application/Shape/usecase/ShapeCreateDisplayObjectElementUseCase.ts +++ b/src/js/core/application/Shape/usecase/ShapeCreateDisplayObjectElementUseCase.ts @@ -4,7 +4,7 @@ import type { Layer } from "@/core/domain/model/Layer"; import type { Shape } from "@/core/domain/model/Shape"; import { execute as shapeRegisterEventUseCase } from "@/core/application/Shape/usecase/ShapeRegisterEventUseCase"; import { execute as shapeDisplayObjectComponent } from "../component/ShapeDisplayObjectComponent"; -import { $getCacheCanvas } from "@/cache/CacheUtil"; +import { $getCacheCanvas, $setCacheCanvas } from "@/cache/CacheUtil"; import { execute as screenAreaHierarchyAdjustmentService } from "@/screen/application/ScreenArea/service/ScreenAreaHierarchyAdjustmentService"; import { execute as screenAreaReadOnlyElementService } from "@/screen/application/ScreenArea/service/ScreenAreaReadOnlyElementService"; import { execute as instanceUpdateBlendModeService } from "@/core/application/Instance/service/InstanceUpdateBlendModeService"; @@ -40,7 +40,7 @@ export const execute = async ( canvas = await instance.getHTMLElement(character); // キャッシュに保存 - // $setCacheCanvas(work_space_id, instance.id, cacheKey, canvas); + $setCacheCanvas(work_space_id, instance.id, cacheKey, canvas); } // ブレンドモードを設定 diff --git a/src/js/core/domain/model/Character.ts b/src/js/core/domain/model/Character.ts index c4f7b57c..65f57565 100644 --- a/src/js/core/domain/model/Character.ts +++ b/src/js/core/domain/model/Character.ts @@ -14,6 +14,7 @@ import { execute as characterCalcGetBoundsService } from "@/core/application/Cha import { execute as characterCalcGetRectService } from "@/core/application/Character/service/CharacterCalcGetRectService"; import { PositionImpl } from "@/interface/PositionImpl"; import { $getCurrentWorkSpace } from "@/core/application/CoreUtil"; +import { $BITMAP_TYPE } from "@/config/InstanceConfig"; /** * @description DisplayObjectのユニークID @@ -229,6 +230,13 @@ export class Character } + const workSpace = $getCurrentWorkSpace(); + const instance = workSpace.getLibrary(this._$libraryId); + if (instance && instance.type !== $BITMAP_TYPE) { + const scale = workSpace.scale; + cacheKey += `_${this.scaleX * scale}_${this.scaleY * scale}`; + } + // TODO filters return cacheKey; diff --git a/src/js/screen/application/DisplayObject/service/ScreenDisplayObjectUpdateMaskStyleService.ts b/src/js/screen/application/DisplayObject/service/ScreenDisplayObjectUpdateMaskStyleService.ts index bd299750..b75f42cc 100644 --- a/src/js/screen/application/DisplayObject/service/ScreenDisplayObjectUpdateMaskStyleService.ts +++ b/src/js/screen/application/DisplayObject/service/ScreenDisplayObjectUpdateMaskStyleService.ts @@ -66,7 +66,7 @@ export const execute = async ( } // キャッシュに保存 - // $setCacheCanvas(workSpace.id, instance.id, cacheKey, canvas); + $setCacheCanvas(workSpace.id, instance.id, cacheKey, canvas); } if (!canvas.dataset.base64) {