@@ -4,6 +4,7 @@ import { Vector2 } from 'three'
44import { FishEyeEffect } from ' ./custom/fish-eye/index'
55import { makePropWatchers } from ' ../../util/prop'
66import { useEffectPmndrs } from ' ./composables/useEffectPmndrs'
7+ import { computed } from ' vue'
78
89export interface FishEyePmndrsProps {
910 /**
@@ -33,12 +34,20 @@ export interface FishEyePmndrsProps {
3334
3435const props = defineProps <FishEyePmndrsProps >()
3536
37+ const computedLensS = computed (() =>
38+ Array .isArray (props .lensS ) ? new Vector2 (... props .lensS ) : props .lensS ,
39+ )
40+ const computedLensF = computed (() =>
41+ Array .isArray (props .lensF ) ? new Vector2 (... props .lensF ) : props .lensF ,
42+ )
43+
3644const { pass, effect } = useEffectPmndrs (
37- () => new FishEyeEffect ({
38- ... props ,
39- lensS: Array .isArray (props .lensS ) ? new Vector2 (... props .lensS ) : props .lensS ,
40- lensF: Array .isArray (props .lensF ) ? new Vector2 (... props .lensF ) : props .lensF ,
41- }),
45+ () =>
46+ new FishEyeEffect ({
47+ ... props ,
48+ lensS: computedLensS .value ,
49+ lensF: computedLensF .value ,
50+ }),
4251 props ,
4352)
4453
@@ -47,8 +56,8 @@ defineExpose({ pass, effect })
4756makePropWatchers (
4857 [
4958 [() => props .blendFunction , ' blendMode.blendFunction' ],
50- [() => props . lensS , ' lensS' ],
51- [() => props . lensF , ' lensF' ],
59+ [() => computedLensS . value , ' lensS' ],
60+ [() => computedLensF . value , ' lensF' ],
5261 [() => props .scale , ' scale' ],
5362 ],
5463 effect ,
0 commit comments