diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21b5a00..3329435 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,8 +59,8 @@ jobs: - name: Install run: pnpm install - # - name: Build - # run: pnpm -r build + - name: Build + run: pnpm -r build - name: Test run: pnpm run test diff --git a/packages/vue3-pixi-projection/src/elements/camera3d.ts b/packages/vue3-pixi-projection/src/elements/camera3d.ts index b99ee10..b96b495 100644 --- a/packages/vue3-pixi-projection/src/elements/camera3d.ts +++ b/packages/vue3-pixi-projection/src/elements/camera3d.ts @@ -3,7 +3,7 @@ import type { DefineComponent, VNodeProps, } from 'vue-demi' -import type { AllowedPixiProps, PixiEvents } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents } from 'vue3-pixi' import type { Camera3d } from 'pixi-projection' export interface Camera3dProps { diff --git a/packages/vue3-pixi-projection/src/elements/container2d.ts b/packages/vue3-pixi-projection/src/elements/container2d.ts index fc5ea24..192b761 100644 --- a/packages/vue3-pixi-projection/src/elements/container2d.ts +++ b/packages/vue3-pixi-projection/src/elements/container2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Container2d } from 'pixi-projection' import type { Allowed2dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/container3d.ts b/packages/vue3-pixi-projection/src/elements/container3d.ts index a1a41c5..521a24b 100644 --- a/packages/vue3-pixi-projection/src/elements/container3d.ts +++ b/packages/vue3-pixi-projection/src/elements/container3d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Container3d } from 'pixi-projection' import type { Allowed3dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/mesh2d.ts b/packages/vue3-pixi-projection/src/elements/mesh2d.ts index 1040399..be874dc 100644 --- a/packages/vue3-pixi-projection/src/elements/mesh2d.ts +++ b/packages/vue3-pixi-projection/src/elements/mesh2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, MeshProps, PixiEvents } from '@vue-pixi/renderer' +import type { AllowedPixiProps, MeshProps, PixiEvents } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Mesh2d } from 'pixi-projection' import type { Allowed2dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/mesh3d2d.ts b/packages/vue3-pixi-projection/src/elements/mesh3d2d.ts index c129242..a28b2b4 100644 --- a/packages/vue3-pixi-projection/src/elements/mesh3d2d.ts +++ b/packages/vue3-pixi-projection/src/elements/mesh3d2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, MeshProps, PixiEvents } from '@vue-pixi/renderer' +import type { AllowedPixiProps, MeshProps, PixiEvents } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Mesh3d2d } from 'pixi-projection' import type { Allowed3dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/simpleMesh2d.ts b/packages/vue3-pixi-projection/src/elements/simpleMesh2d.ts index d6f7f7c..bd2bc97 100644 --- a/packages/vue3-pixi-projection/src/elements/simpleMesh2d.ts +++ b/packages/vue3-pixi-projection/src/elements/simpleMesh2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, MeshProps, PixiEvents } from '@vue-pixi/renderer' +import type { AllowedPixiProps, MeshProps, PixiEvents } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { SimpleMesh2d } from 'pixi-projection' import type { Allowed2dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/simpleMesh3d2d.ts b/packages/vue3-pixi-projection/src/elements/simpleMesh3d2d.ts index f550a23..4bd8eb0 100644 --- a/packages/vue3-pixi-projection/src/elements/simpleMesh3d2d.ts +++ b/packages/vue3-pixi-projection/src/elements/simpleMesh3d2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, MeshProps, PixiEvents } from '@vue-pixi/renderer' +import type { AllowedPixiProps, MeshProps, PixiEvents } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { SimpleMesh3d2d } from 'pixi-projection' import type { Allowed3dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/sprite2d.ts b/packages/vue3-pixi-projection/src/elements/sprite2d.ts index 9f7e0e4..22ea2a8 100644 --- a/packages/vue3-pixi-projection/src/elements/sprite2d.ts +++ b/packages/vue3-pixi-projection/src/elements/sprite2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents, SpriteProps } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents, SpriteProps } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Sprite2d } from 'pixi-projection' import type { Allowed2dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/sprite2s.ts b/packages/vue3-pixi-projection/src/elements/sprite2s.ts index d6f9020..d53d059 100644 --- a/packages/vue3-pixi-projection/src/elements/sprite2s.ts +++ b/packages/vue3-pixi-projection/src/elements/sprite2s.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents, SpriteProps } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents, SpriteProps } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Sprite2s } from 'pixi-projection' import type { Allowed2sPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/sprite3d.ts b/packages/vue3-pixi-projection/src/elements/sprite3d.ts index 516909b..3223475 100644 --- a/packages/vue3-pixi-projection/src/elements/sprite3d.ts +++ b/packages/vue3-pixi-projection/src/elements/sprite3d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents, SpriteProps } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents, SpriteProps } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Sprite3d } from 'pixi-projection' import type { Allowed3dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/text2d.ts b/packages/vue3-pixi-projection/src/elements/text2d.ts index 3bedbee..bd57b4b 100644 --- a/packages/vue3-pixi-projection/src/elements/text2d.ts +++ b/packages/vue3-pixi-projection/src/elements/text2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents, TextProps } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents, TextProps } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Text2d } from 'pixi-projection' import type { Allowed2dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/text2s.ts b/packages/vue3-pixi-projection/src/elements/text2s.ts index db07bf9..fa314c6 100644 --- a/packages/vue3-pixi-projection/src/elements/text2s.ts +++ b/packages/vue3-pixi-projection/src/elements/text2s.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents, TextProps } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents, TextProps } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Text2s } from 'pixi-projection' import type { Allowed2sPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/text3d.ts b/packages/vue3-pixi-projection/src/elements/text3d.ts index 1e4686e..5facbaf 100644 --- a/packages/vue3-pixi-projection/src/elements/text3d.ts +++ b/packages/vue3-pixi-projection/src/elements/text3d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents, TextProps } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents, TextProps } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { Text3d } from 'pixi-projection' import type { Allowed3dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/elements/tilingSprite2d.ts b/packages/vue3-pixi-projection/src/elements/tilingSprite2d.ts index 9449952..a81956a 100644 --- a/packages/vue3-pixi-projection/src/elements/tilingSprite2d.ts +++ b/packages/vue3-pixi-projection/src/elements/tilingSprite2d.ts @@ -1,4 +1,4 @@ -import type { AllowedPixiProps, PixiEvents, TilingSpriteProps } from '@vue-pixi/renderer' +import type { AllowedPixiProps, PixiEvents, TilingSpriteProps } from 'vue3-pixi' import type { ComponentOptionsMixin, DefineComponent, VNodeProps } from 'vue-demi' import type { TilingSprite2d } from 'pixi-projection' import type { Allowed2dPixiProps } from './props' diff --git a/packages/vue3-pixi-projection/src/index.ts b/packages/vue3-pixi-projection/src/index.ts index 1a6e7d0..8a99735 100644 --- a/packages/vue3-pixi-projection/src/index.ts +++ b/packages/vue3-pixi-projection/src/index.ts @@ -1,7 +1,6 @@ -import type { Renderer } from '@vue-pixi/renderer' -import { elements, pathProp } from './renderer' +import { ProjectionRenderer } from './renderer' -export default { elements, pathProp } as Renderer +export default ProjectionRenderer export * from './global' export * from './types' diff --git a/packages/vue3-pixi-projection/src/renderer/elements.ts b/packages/vue3-pixi-projection/src/renderer/elements.ts deleted file mode 100644 index 0f65831..0000000 --- a/packages/vue3-pixi-projection/src/renderer/elements.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { - Camera3d, - Container2d, - Container3d, - Mesh2d, - Mesh3d2d, - SimpleMesh2d, - SimpleMesh3d2d, - Sprite2d, - Sprite2s, - Sprite3d, - Text2d, - Text2s, - Text3d, - TilingSprite2d, -} from 'pixi-projection' -import type { Renderer } from '@vue-pixi/renderer' -import { normalizeTexture } from '@vue-pixi/renderer' -import { isUndefined } from '@antfu/utils' - -export const elements: Renderer['elements'] = { - Container2d: () => new Container2d().proj, - Container3d: () => new Container3d(), - - Sprite2d: props => new Sprite2d(normalizeTexture(props.texture)), - Sprite3d: props => new Sprite3d(normalizeTexture(props.texture)), - Sprite2s: props => new Sprite2s(normalizeTexture(props.texture)), - - Camera3d: (props) => { - const camera = new Camera3d() - if (!isUndefined(props.focus)) - camera.setPlanes(props.focus, props.near, props.far, props.orthographic) - return camera - }, - - Text2d: props => new Text2d( - props.text, - props.style, - props.canvas, - ), - Text2s: props => new Text2s( - props.text, - props.style, - props.canvas, - ), - Text3d: props => new Text3d( - props.text, - props.style, - props.canvas, - ), - - TilingSprite2d: props => new TilingSprite2d( - normalizeTexture(props.texture), - props.width, - props.height, - ), - Mesh2d: props => new Mesh2d( - props.geometry, - props.shader, - props.state, - props.drawMode, - ), - Mesh3d2d: props => new Mesh3d2d( - props.geometry, - props.shader, - props.state, - props.drawMode, - ), - - SimpleMesh2d: props => new SimpleMesh2d(normalizeTexture(props.texture)), - SimpleMesh3d2d: props => new SimpleMesh3d2d(normalizeTexture(props.texture)), -} diff --git a/packages/vue3-pixi-projection/src/renderer/index.ts b/packages/vue3-pixi-projection/src/renderer/index.ts index dffe842..079d0e8 100644 --- a/packages/vue3-pixi-projection/src/renderer/index.ts +++ b/packages/vue3-pixi-projection/src/renderer/index.ts @@ -1,2 +1,169 @@ -export * from './elements' -export * from './patchProp' +import { + Camera3d, + Container2d, + Container3d, + Mesh2d, + Mesh3d2d, + SimpleMesh2d, + SimpleMesh3d2d, + Sprite2d, + Sprite2s, + Sprite3d, + Text2d, + Text2s, + Text3d, + TilingSprite2d, +} from 'pixi-projection' +import type { Renderer, RendererOptions } from 'vue3-pixi' +import { normalizeTexture, setSkipFirstValue } from 'vue3-pixi' +import { isUndefined } from '@antfu/utils' +import { patchProp } from './patchProp' + +const Container2dRenderer: RendererOptions = { + name: 'Container2d', + createElement: () => new Container2d(), + patchProp, +} +const Container3dRenderer: RendererOptions = { + name: 'Container3d', + createElement: () => new Container3d(), + patchProp, +} + +const Sprite2dRenderer: RendererOptions = { + name: 'Sprite2d', + createElement: props => new Sprite2d(normalizeTexture(props.texture)), + patchProp, +} +const Sprite3dRenderer: RendererOptions = { + name: 'Sprite3d', + createElement: props => new Sprite3d(normalizeTexture(props.texture)), + patchProp, +} + +const Sprite2sRenderer: RendererOptions = { + name: 'Sprite2s', + createElement: props => new Sprite2s(normalizeTexture(props.texture)), + patchProp, +} + +const Camera3dRenderer: RendererOptions = { + name: 'Camera3d', + createElement: (props) => { + const camera = new Camera3d() + if (!isUndefined(props.focus)) { + camera.setPlanes( + props.focus, + props.near, + props.far, + props.orthographic, + ) + } + return camera + }, + patchProp: (el, key, prevValue, nextValue) => { + const planeKeys = ['focus', 'near', 'far', 'orthographic'] + function setPlanes(config: any) { + el.setPlanes( + config.focus || el._focus, + config.near || el.near, + config.far || el.far, + config.orthographic || el._orthographic, + ) + } + if (planeKeys.includes(key)) + return setSkipFirstValue(el, key, () => setPlanes({ [key]: nextValue })) + patchProp(el, key, prevValue, nextValue) + }, +} + +const Text2dRenderer: RendererOptions = { + name: 'Text2d', + createElement: props => new Text2d( + props.text, + props.style, + props.canvas, + ), + patchProp, +} + +const Text2sRenderer: RendererOptions = { + name: 'Text2s', + createElement: props => new Text2s( + props.text, + props.style, + props.canvas, + ), + patchProp, +} + +const Text3dRenderer: RendererOptions = { + name: 'Text3d', + createElement: props => new Text3d( + props.text, + props.style, + props.canvas, + ), + patchProp, +} + +const TilingSprite2dRenderer: RendererOptions = { + name: 'TilingSprite2d', + createElement: props => new TilingSprite2d( + normalizeTexture(props.texture), + props.width, + props.height, + ), + patchProp, +} + +const Mesh2dRenderer: RendererOptions = { + name: 'Mesh2d', + createElement: props => new Mesh2d( + props.geometry, + props.shader, + props.state, + props.drawMode, + ), + patchProp, +} + +const Mesh3d2dRenderer: RendererOptions = { + name: 'Mesh3d2d', + createElement: props => new Mesh3d2d( + props.geometry, + props.shader, + props.state, + props.drawMode, + ), + patchProp, +} + +const SimpleMesh2dRenderer: RendererOptions = { + name: 'SimpleMesh2d', + createElement: props => new SimpleMesh2d(normalizeTexture(props.texture)), + patchProp, +} + +const SimpleMesh3d2dRenderer: RendererOptions = { + name: 'SimpleMesh3d2d', + createElement: props => new SimpleMesh3d2d(normalizeTexture(props.texture)), + patchProp, +} + +export const ProjectionRenderer: Renderer = [ + Container2dRenderer, + Container3dRenderer, + Sprite2dRenderer, + Sprite3dRenderer, + Sprite2sRenderer, + Camera3dRenderer, + Text2dRenderer, + Text2sRenderer, + Text3dRenderer, + TilingSprite2dRenderer, + Mesh2dRenderer, + Mesh3d2dRenderer, + SimpleMesh2dRenderer, + SimpleMesh3d2dRenderer, +] diff --git a/packages/vue3-pixi-projection/src/renderer/internal/index.ts b/packages/vue3-pixi-projection/src/renderer/internal/index.ts new file mode 100644 index 0000000..bd76935 --- /dev/null +++ b/packages/vue3-pixi-projection/src/renderer/internal/index.ts @@ -0,0 +1 @@ +export * from './setter' diff --git a/packages/vue3-pixi-projection/src/renderer/setter.ts b/packages/vue3-pixi-projection/src/renderer/internal/setter.ts similarity index 92% rename from packages/vue3-pixi-projection/src/renderer/setter.ts rename to packages/vue3-pixi-projection/src/renderer/internal/setter.ts index 037fa74..267e430 100644 --- a/packages/vue3-pixi-projection/src/renderer/setter.ts +++ b/packages/vue3-pixi-projection/src/renderer/internal/setter.ts @@ -1,4 +1,4 @@ -import { setPointProperty as _setPointProperty, setPropertyValue } from '@vue-pixi/renderer' +import { setPointProperty as _setPointProperty, setPropertyValue } from 'vue3-pixi' export function setPointProperty(inst: any, name: string, key: string, prevValue: any, nextValue: any) { if (_setPointProperty(inst, name, key, prevValue, nextValue)) diff --git a/packages/vue3-pixi-projection/src/renderer/patchProp.ts b/packages/vue3-pixi-projection/src/renderer/patchProp.ts index 6575508..6f1718a 100644 --- a/packages/vue3-pixi-projection/src/renderer/patchProp.ts +++ b/packages/vue3-pixi-projection/src/renderer/patchProp.ts @@ -1,25 +1,18 @@ import type { Container2d } from 'pixi-projection' -import { Camera3d } from 'pixi-projection' -import { setPropertyValue, setSkipFirstValue } from '@vue-pixi/renderer' -import { setPointProperty } from './setter' +import { patchProp as defuPatchProp, setPropertyValue } from 'vue3-pixi' +import { setPointProperty } from './internal' const pointProps = ['position3d', 'euler'] as const const projProps = ['affine'] -export function pathProp(el: any, key: string, prevValue: any, nextValue: any) { - const patches = [ - { element: Camera3d, patch: patchCamera3dProps }, - ] - - for (const { element, patch } of patches) { - if (el instanceof element && patch(el, key, prevValue, nextValue)) - return true - } +export function patchProp(el: any, key: string, prevValue: any, nextValue: any) { if (patchProjProps(el, key, prevValue, nextValue)) return true if (patchPointProps(el, key, prevValue, nextValue)) return true + + return defuPatchProp(el, key, prevValue, nextValue) } export function patchPointProps(el: Container2d, key: string, prevValue: any, nextValue: any) { @@ -30,24 +23,6 @@ export function patchPointProps(el: Container2d, key: string, prevValue: any, ne return false } -export function patchCamera3dProps(el: any, key: string, _: any, nextValue: any) { - const props = ['focus', 'near', 'far', 'orthographic'] - - function setPlanes(config: any) { - el.setPlanes( - config.focus || el._focus, - config.near || el.near, - config.far || el.far, - config.orthographic || el._orthographic, - ) - } - - if (props.includes(key)) - return setSkipFirstValue(el, key, () => setPlanes({ [key]: nextValue })) - - return false -} - export function patchProjProps(el: any, key: string, _: any, nextValue: any) { if (projProps.includes(key)) { setPropertyValue(el, key, () => el.proj[key] = nextValue) diff --git a/packages/vue3-pixi-projection/tsup.config.ts b/packages/vue3-pixi-projection/tsup.config.ts new file mode 100644 index 0000000..ace4c1c --- /dev/null +++ b/packages/vue3-pixi-projection/tsup.config.ts @@ -0,0 +1,11 @@ +import type { Options } from 'tsup' + +export default { + entryPoints: [ + 'src/*.ts', + ], + external: ['vue-demi', 'vue', '@vue/runtime-core'], + clean: true, + format: ['cjs', 'esm'], + dts: true, +} diff --git a/packages/vue3-pixi/src/components/loader/index.ts b/packages/vue3-pixi/src/components/loader/index.ts index 57fe526..7600d2d 100644 --- a/packages/vue3-pixi/src/components/loader/index.ts +++ b/packages/vue3-pixi/src/components/loader/index.ts @@ -5,7 +5,7 @@ import { defineComponent, onBeforeUnmount, ref, renderSlot, watch } from 'vue-de import type { IBaseTextureOptions, Texture } from 'pixi.js' import { isString } from '@antfu/utils' -import { setTextureOptions } from './utils' +import { setTextureOptions } from '../../renderer' export type LoadAsset = string | { default: string } | Promise export type LoadAssets = Record | (LoadAsset | [string, LoadAsset])[] diff --git a/packages/vue3-pixi/src/components/loader/utils/index.ts b/packages/vue3-pixi/src/components/loader/utils/index.ts deleted file mode 100644 index 54c4d2b..0000000 --- a/packages/vue3-pixi/src/components/loader/utils/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import type { IBaseTextureOptions, Texture } from 'pixi.js' - -export function setTextureOptions(texture: Texture, options: IBaseTextureOptions = {}) { - for (const key in options) - // @ts-expect-error - texture.baseTexture[key] = options[key] -} diff --git a/packages/vue3-pixi/src/renderer/index.ts b/packages/vue3-pixi/src/renderer/index.ts index da93975..1b3ceb8 100644 --- a/packages/vue3-pixi/src/renderer/index.ts +++ b/packages/vue3-pixi/src/renderer/index.ts @@ -1,5 +1,9 @@ export * from './renderer' export * from './utils' + +export { patchProp } from './patchProp' +export { nodeOps } from './nodeOps' + export { setObjectProperty, setPointProperty, @@ -7,3 +11,8 @@ export { setSkipFirstValue, callInstanceSetter, } from './internal' + +export type { + Renderer, + RendererOptions, +} from './internal' diff --git a/packages/vue3-pixi/src/renderer/internal/default-renderer.ts b/packages/vue3-pixi/src/renderer/internal/default-renderer.ts index b690273..f87522b 100644 --- a/packages/vue3-pixi/src/renderer/internal/default-renderer.ts +++ b/packages/vue3-pixi/src/renderer/internal/default-renderer.ts @@ -19,7 +19,7 @@ import { Text, TilingSprite, } from 'pixi.js' -import { patchProp as defuPatchProp, patchBoolProp } from '../patchProp' +import { patchProp as defuPatchProp, patchBooleanProp } from '../patchProp' import { normalizeTexture } from '../utils' import { setObjectProperty, setPropertyValue, setSkipFirstValue } from './setter' import type { Renderer, RendererOptions } from './types' @@ -102,7 +102,7 @@ const BitmapTextRender: RendererOptions = { break case 'dirty': case 'roundPixels': - patchBoolProp(el, key, prev, next) + patchBooleanProp(el, key, prev, next) break default: defuPatchProp(el, key, prev, next) @@ -124,7 +124,7 @@ const TilingSpriteRender: RendererOptions = { setSkipFirstValue(el, key, () => el[key] = next) break case 'uvRespectAnchor': - patchBoolProp(el, key, prev, next) + patchBooleanProp(el, key, prev, next) break default: defuPatchProp(el, key, prev, next) @@ -157,7 +157,7 @@ const AnimatedSpriteRender: RendererOptions = { break case 'loop': case 'updateAnchor': - patchBoolProp(el, key, prev, next) + patchBooleanProp(el, key, prev, next) break case 'onComplete': case 'onFrameChange': @@ -187,7 +187,7 @@ const MeshRender: RendererOptions = { setSkipFirstValue(el, key, () => el[key] = next) break case 'roundPixels': - patchBoolProp(el, key, prev, next) + patchBooleanProp(el, key, prev, next) break default: defuPatchProp(el, key, prev, next) @@ -204,7 +204,7 @@ const NineSlicePlaneRender: RendererOptions = { switch (key) { case 'roundPixels': case 'autoResize': - patchBoolProp(el, key, prev, next) + patchBooleanProp(el, key, prev, next) break default: defuPatchProp(el, key, prev, next) diff --git a/packages/vue3-pixi/src/renderer/patchProp.ts b/packages/vue3-pixi/src/renderer/patchProp.ts index 3a7dfd0..6be69ae 100644 --- a/packages/vue3-pixi/src/renderer/patchProp.ts +++ b/packages/vue3-pixi/src/renderer/patchProp.ts @@ -21,7 +21,7 @@ export function patchProp( return if (defaultBooleanProps.includes(key)) - return patchBoolProp(el, key, prevValue, nextValue) + return patchBooleanProp(el, key, prevValue, nextValue) if (patchPointProp(el, key, prevValue, nextValue)) return @@ -74,7 +74,7 @@ export function patchEventProp(el: any, key: string, prevValue: any, nextValue: return true } -export function patchBoolProp( +export function patchBooleanProp( _el: Container, _key: string, _prevValue: any,