Skip to content

Commit

Permalink
fix: 無名ピクチャを -1 以下とする対応
Browse files Browse the repository at this point in the history
  • Loading branch information
aokashi committed Apr 21, 2024
1 parent 01ff060 commit 0c51de3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/engine/src/wwa_picture/WWAPictureItem.ts
Expand Up @@ -4,6 +4,7 @@ import { CacheCanvas } from "../wwa_cgmanager";
import { Coord, WWAConsts } from "../wwa_data";
import * as util from "../wwa_util";
import {
isAnonymousPicture,
getArrayItemFromSingleOrArray,
adjustPositiveValue,
getHorizontalCirclePosition,
Expand Down Expand Up @@ -177,7 +178,7 @@ export default class WWAPictureItem {
// layerNumber が 0 の場合はいわゆる無名ピクチャという扱いのため、既存のピクチャ定義を上書きしない挙動となっている。
// このことを想定して、 canvas のクリアを除外しているのだが、これだと変化前の画像データが残ってしまうことになる。
// TODO WWAeval の実装では無名ピクチャをどのように実装しているのかソースを確認する
if (this.layerNumber !== 0) {
if (isAnonymousPicture(this.layerNumber)) {
// TODO これをオフにするオプションがあっても良さそう
this.clearCanvas();
}
Expand Down
2 changes: 2 additions & 0 deletions packages/engine/src/wwa_picture/utils.ts
Expand Up @@ -59,6 +59,8 @@ const matchToSnakeCaseProperty = (propertyName: PicturePropertyName) => {
return propertySnakeCaseTable[propertyName] ?? propertyName;
};

export const isAnonymousPicture = (layerNumber: number) => layerNumber < 0;

export const checkValuesFromRawRegistry = (registry: RawPictureRegistry): PictureRegistry => {
const propertiesArray = Object.entries(registry.properties).map(([key, value]) => {
const camelCaseKey = matchToSnakeCaseProperty(key as PicturePropertyName);
Expand Down

0 comments on commit 0c51de3

Please sign in to comment.