Skip to content

Commit 106237f

Browse files
committed
feat: 리사이징, 이동 중 css 애니메이션 비활성화
1 parent b4dc21e commit 106237f

6 files changed

Lines changed: 60 additions & 0 deletions

File tree

src/renderer/components/Key.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { toCssRgba } from "@utils/colorUtils";
1515
import { useSmartGuidesElements } from "@hooks/Grid";
1616
import { useSmartGuidesStore } from "@stores/useSmartGuidesStore";
1717
import { useSettingsStore } from "@stores/useSettingsStore";
18+
import { useGridSelectionStore } from "@stores/useGridSelectionStore";
1819
import {
1920
calculateBounds,
2021
calculateSnapPoints,
@@ -57,6 +58,11 @@ export default function DraggableKey({
5758
// 스마트 가이드를 위한 다른 요소들의 bounds 가져오기
5859
const { getOtherElements } = useSmartGuidesElements();
5960

61+
// 드래그/리사이즈 중인 상태 (CSS 애니메이션 비활성화용)
62+
const isDraggingOrResizing = useGridSelectionStore(
63+
(state) => state.isDraggingOrResizing
64+
);
65+
6066
// 다중 선택 드래그 상태
6167
const multiDragRef = useRef({ isDragging: false, startX: 0, startY: 0 });
6268
const nodeRef = useRef(null);
@@ -97,6 +103,9 @@ export default function DraggableKey({
97103
// 드래그 시작 전 기존 스마트 가이드 클리어 (이전 드래그가 정상 종료되지 않은 경우 대비)
98104
useSmartGuidesStore.getState().clearGuides();
99105

106+
// 드래그 시작 시 애니메이션 비활성화
107+
useGridSelectionStore.getState().setDraggingOrResizing(true);
108+
100109
// 드래그 시작 시 히스토리 저장
101110
onMultiDragStart?.();
102111

@@ -326,6 +335,8 @@ export default function DraggableKey({
326335
window.removeEventListener("blur", handleMouseUp);
327336
// 스마트 가이드 클리어
328337
useSmartGuidesStore.getState().clearGuides();
338+
// 드래그 종료 시 애니메이션 복원
339+
useGridSelectionStore.getState().setDraggingOrResizing(false);
329340
// 드래그 종료 시 오버레이 동기화
330341
onMultiDragEnd?.();
331342
};
@@ -449,6 +460,7 @@ export default function DraggableKey({
449460
} ${className || ""}`}
450461
style={keyStyle}
451462
data-state="inactive"
463+
data-editing={isDraggingOrResizing ? "true" : undefined}
452464
onClick={handleClick}
453465
onMouseDown={isSelectionMode ? handleSelectionDragMouseDown : undefined}
454466
onContextMenu={handleContextMenu}

src/renderer/components/PluginElement.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@ export const PluginElement: React.FC<PluginElementProps> = ({
427427
// 선택된 상태면 선택 모드 활성화
428428
const isSelectionMode = isSelected;
429429

430+
// 드래그/리사이즈 중인 상태 (CSS 애니메이션 비활성화용, main 윈도우에서만)
431+
const isDraggingOrResizing = useGridSelectionStore(
432+
(state) => (windowType === "main" ? state.isDraggingOrResizing : false)
433+
);
434+
430435
// 드래그 지원 (main 윈도우에서만)
431436
const draggable = useDraggable({
432437
gridSize: GRID_SNAP,
@@ -476,6 +481,9 @@ export const PluginElement: React.FC<PluginElementProps> = ({
476481
// 드래그 시작 전 기존 스마트 가이드 클리어 (이전 드래그가 정상 종료되지 않은 경우 대비)
477482
useSmartGuidesStore.getState().clearGuides();
478483

484+
// 드래그 시작 시 애니메이션 비활성화
485+
useGridSelectionStore.getState().setDraggingOrResizing(true);
486+
479487
// 드래그 시작 시 히스토리 저장
480488
onMultiDragStart?.();
481489

@@ -703,6 +711,8 @@ export const PluginElement: React.FC<PluginElementProps> = ({
703711
window.removeEventListener("blur", handleMouseUp);
704712
// 스마트 가이드 클리어
705713
useSmartGuidesStore.getState().clearGuides();
714+
// 드래그 종료 시 애니메이션 복원
715+
useGridSelectionStore.getState().setDraggingOrResizing(false);
706716
// 드래그 종료 시 오버레이 동기화
707717
onMultiDragEnd?.();
708718
};
@@ -1468,6 +1478,7 @@ export const PluginElement: React.FC<PluginElementProps> = ({
14681478
data-plugin-element={element.fullId}
14691479
data-plugin-id={element.pluginId}
14701480
data-tauri-drag-region={windowType === "overlay" ? true : undefined}
1481+
data-editing={isDraggingOrResizing ? "true" : undefined}
14711482
onClick={handleClick}
14721483
onMouseDown={
14731484
isSelectionMode

src/renderer/hooks/Grid/useDraggable.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ export const useDraggable = ({
160160
// 실제 드래그가 시작될 때만 최적화 적용
161161
node.style.pointerEvents = "none";
162162
node.style.userSelect = "none";
163+
// 드래그 시작 시 애니메이션 비활성화
164+
useGridSelectionStore.getState().setDraggingOrResizing(true);
163165
// 드래그 시작 콜백 호출 (히스토리 저장용)
164166
onDragStart?.();
165167

@@ -333,6 +335,8 @@ export const useDraggable = ({
333335
node.style.cursor = "grab";
334336
node.style.pointerEvents = "auto";
335337
node.style.userSelect = "auto";
338+
// 드래그 종료 시 애니메이션 복원
339+
useGridSelectionStore.getState().setDraggingOrResizing(false);
336340

337341
// 최종 위치만 부모에 커밋
338342
const { dx: finalDx, dy: finalDy } = lastSnappedRef.current;

src/renderer/hooks/Grid/useGridResize.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
calculateSizeSnap,
1111
} from "@utils/smartGuides";
1212
import type { SelectedElement } from "@stores/useGridSelectionStore";
13+
import { useGridSelectionStore } from "@stores/useGridSelectionStore";
1314
import type { KeyPositions } from "@src/types/keys";
1415
import type { ElementBounds } from "@utils/smartGuides";
1516

@@ -82,6 +83,9 @@ export function useGridResize({
8283
// 기존 스마트 가이드 클리어
8384
useSmartGuidesStore.getState().clearGuides();
8485

86+
// 리사이즈 시작 시 애니메이션 비활성화
87+
useGridSelectionStore.getState().setDraggingOrResizing(true);
88+
8589
const currentPositions = useKeyStore.getState().positions;
8690
const currentPluginElements =
8791
usePluginDisplayElementStore.getState().elements;
@@ -525,6 +529,9 @@ export function useGridResize({
525529
// 스마트 가이드 클리어
526530
useSmartGuidesStore.getState().clearGuides();
527531

532+
// 리사이즈 종료 시 애니메이션 복원
533+
useGridSelectionStore.getState().setDraggingOrResizing(false);
534+
528535
// 최종 bounds를 실제 요소에 적용
529536
const finalBounds = finalBoundsRef.current;
530537
if (finalBounds && selectedElements.length === 1) {
@@ -592,6 +599,9 @@ export function useGridResize({
592599
// 스마트 가이드 클리어
593600
useSmartGuidesStore.getState().clearGuides();
594601

602+
// 리사이즈 종료 시 애니메이션 복원
603+
useGridSelectionStore.getState().setDraggingOrResizing(false);
604+
595605
const finalData = finalGroupBoundsRef.current;
596606
if (finalData && finalData.elementBounds.length > 0) {
597607
const positions = useKeyStore.getState().positions;

src/renderer/stores/useGridSelectionStore.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ interface GridSelectionState {
4040
// 미들 버튼 드래그 상태
4141
isMiddleButtonDragging: boolean;
4242

43+
// 드래그/리사이즈 중인 상태 (CSS 애니메이션 비활성화용)
44+
isDraggingOrResizing: boolean;
45+
4346
// Actions
4447
selectElement: (element: SelectedElement, addToSelection?: boolean) => void;
4548
toggleSelection: (element: SelectedElement) => void;
@@ -60,6 +63,9 @@ interface GridSelectionState {
6063
// 미들 버튼 드래그 Actions
6164
setMiddleButtonDragging: (isDragging: boolean) => void;
6265

66+
// 드래그/리사이즈 상태 설정
67+
setDraggingOrResizing: (isDragging: boolean) => void;
68+
6369
// 선택된 요소들 일괄 이동
6470
moveSelectedElements: (deltaX: number, deltaY: number) => void;
6571
}
@@ -71,6 +77,7 @@ export const useGridSelectionStore = create<GridSelectionState>((set, get) => ({
7177
marqueeStart: null,
7278
marqueeEnd: null,
7379
isMiddleButtonDragging: false,
80+
isDraggingOrResizing: false,
7481

7582
selectElement: (element, addToSelection = false) => {
7683
set((state) => {
@@ -168,6 +175,10 @@ export const useGridSelectionStore = create<GridSelectionState>((set, get) => ({
168175
set({ isMiddleButtonDragging: isDragging });
169176
},
170177

178+
setDraggingOrResizing: (isDragging) => {
179+
set({ isDraggingOrResizing: isDragging });
180+
},
181+
171182
moveSelectedElements: (_deltaX, _deltaY) => {
172183
// 실제 이동 로직은 Grid 컴포넌트에서 처리
173184
// 이 함수는 외부에서 호출될 콜백을 위한 placeholder

src/renderer/styles/global.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,15 @@ body.dmn-custom-cursor,
281281
body.dmn-custom-cursor * {
282282
cursor: none !important;
283283
}
284+
285+
/*
286+
* 드래그/리사이즈 중 애니메이션 비활성화
287+
* 커스텀 CSS에서 transition이나 animation이 적용된 경우,
288+
* 메인 창 그리드에서 키/플러그인 요소를 드래그하거나 크기 조절할 때
289+
* 애니메이션이 적용되어 흐물흐물하게 움직이는 것을 방지
290+
*/
291+
[data-editing="true"],
292+
[data-editing="true"] * {
293+
transition: none !important;
294+
animation: none !important;
295+
}

0 commit comments

Comments
 (0)