feat: Add selectedAreaId prop to ImageDistortion
- 선택된 영역 ID를 ImageDistortion 컴포넌트에 추가했습니다. - selectedAreaId prop을 통해 특정 영역의 자동 애니메이션을 제외할 수 있습니다. - ImageDistortion 컴포넌트의 animationCallback 로직을 수정하여 selectedAreaId를 반영했습니다.
This commit is contained in:
parent
4bdae13f7f
commit
61952ce79c
2
dist/index.d.mts
vendored
2
dist/index.d.mts
vendored
@ -194,6 +194,8 @@ interface ImageDistortionProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
/** 마우스 인터랙션 설정 */
|
/** 마우스 인터랙션 설정 */
|
||||||
mouseInteraction?: MouseInteractionConfig;
|
mouseInteraction?: MouseInteractionConfig;
|
||||||
|
/** 선택된 영역 ID (이 영역은 자동 애니메이션 제외) */
|
||||||
|
selectedAreaId?: string | null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* GPU 가속 이미지 왜곡 컴포넌트
|
* GPU 가속 이미지 왜곡 컴포넌트
|
||||||
|
|||||||
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -194,6 +194,8 @@ interface ImageDistortionProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
/** 마우스 인터랙션 설정 */
|
/** 마우스 인터랙션 설정 */
|
||||||
mouseInteraction?: MouseInteractionConfig;
|
mouseInteraction?: MouseInteractionConfig;
|
||||||
|
/** 선택된 영역 ID (이 영역은 자동 애니메이션 제외) */
|
||||||
|
selectedAreaId?: string | null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* GPU 가속 이미지 왜곡 컴포넌트
|
* GPU 가속 이미지 왜곡 컴포넌트
|
||||||
|
|||||||
16
dist/index.js
vendored
16
dist/index.js
vendored
@ -791,7 +791,8 @@ var ImageDistortion = ({
|
|||||||
isPlaying = true,
|
isPlaying = true,
|
||||||
style,
|
style,
|
||||||
className,
|
className,
|
||||||
mouseInteraction
|
mouseInteraction,
|
||||||
|
selectedAreaId
|
||||||
}) => {
|
}) => {
|
||||||
const containerRef = (0, import_react4.useRef)(null);
|
const containerRef = (0, import_react4.useRef)(null);
|
||||||
const sceneRef = (0, import_react4.useRef)(null);
|
const sceneRef = (0, import_react4.useRef)(null);
|
||||||
@ -926,7 +927,16 @@ var ImageDistortion = ({
|
|||||||
let updatedAreas = prevAreas;
|
let updatedAreas = prevAreas;
|
||||||
if (!isDragging) {
|
if (!isDragging) {
|
||||||
updatedAreas = AnimationLoop.updateProgress(prevAreas, deltaTime);
|
updatedAreas = AnimationLoop.updateProgress(prevAreas, deltaTime);
|
||||||
updatedAreas = AnimationLoop.updateAreaDragVectors(updatedAreas);
|
updatedAreas = updatedAreas.map((area) => {
|
||||||
|
if (selectedAreaId && area.id === selectedAreaId) {
|
||||||
|
return {
|
||||||
|
...area,
|
||||||
|
dragVector: { x: 0, y: 0 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const updatedArea = AnimationLoop.updateAreaDragVectors([area]);
|
||||||
|
return updatedArea[0];
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
updatedAreas = prevAreas.map((area) => ({
|
updatedAreas = prevAreas.map((area) => ({
|
||||||
...area,
|
...area,
|
||||||
@ -938,7 +948,7 @@ var ImageDistortion = ({
|
|||||||
}
|
}
|
||||||
return updatedAreas;
|
return updatedAreas;
|
||||||
});
|
});
|
||||||
}, [isReady, mouseInteraction, mouseInteractionHook]);
|
}, [isReady, mouseInteraction, mouseInteractionHook, selectedAreaId]);
|
||||||
useAnimationFrame(animationCallback, isPlaying || mouseInteraction?.enabled || false);
|
useAnimationFrame(animationCallback, isPlaying || mouseInteraction?.enabled || false);
|
||||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||||
"div",
|
"div",
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
16
dist/index.mjs
vendored
16
dist/index.mjs
vendored
@ -740,7 +740,8 @@ var ImageDistortion = ({
|
|||||||
isPlaying = true,
|
isPlaying = true,
|
||||||
style,
|
style,
|
||||||
className,
|
className,
|
||||||
mouseInteraction
|
mouseInteraction,
|
||||||
|
selectedAreaId
|
||||||
}) => {
|
}) => {
|
||||||
const containerRef = useRef4(null);
|
const containerRef = useRef4(null);
|
||||||
const sceneRef = useRef4(null);
|
const sceneRef = useRef4(null);
|
||||||
@ -875,7 +876,16 @@ var ImageDistortion = ({
|
|||||||
let updatedAreas = prevAreas;
|
let updatedAreas = prevAreas;
|
||||||
if (!isDragging) {
|
if (!isDragging) {
|
||||||
updatedAreas = AnimationLoop.updateProgress(prevAreas, deltaTime);
|
updatedAreas = AnimationLoop.updateProgress(prevAreas, deltaTime);
|
||||||
updatedAreas = AnimationLoop.updateAreaDragVectors(updatedAreas);
|
updatedAreas = updatedAreas.map((area) => {
|
||||||
|
if (selectedAreaId && area.id === selectedAreaId) {
|
||||||
|
return {
|
||||||
|
...area,
|
||||||
|
dragVector: { x: 0, y: 0 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const updatedArea = AnimationLoop.updateAreaDragVectors([area]);
|
||||||
|
return updatedArea[0];
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
updatedAreas = prevAreas.map((area) => ({
|
updatedAreas = prevAreas.map((area) => ({
|
||||||
...area,
|
...area,
|
||||||
@ -887,7 +897,7 @@ var ImageDistortion = ({
|
|||||||
}
|
}
|
||||||
return updatedAreas;
|
return updatedAreas;
|
||||||
});
|
});
|
||||||
}, [isReady, mouseInteraction, mouseInteractionHook]);
|
}, [isReady, mouseInteraction, mouseInteractionHook, selectedAreaId]);
|
||||||
useAnimationFrame(animationCallback, isPlaying || mouseInteraction?.enabled || false);
|
useAnimationFrame(animationCallback, isPlaying || mouseInteraction?.enabled || false);
|
||||||
return /* @__PURE__ */ jsx(
|
return /* @__PURE__ */ jsx(
|
||||||
"div",
|
"div",
|
||||||
|
|||||||
2
dist/index.mjs.map
vendored
2
dist/index.mjs.map
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user