Skip to content

애니메이션 시스템 최적화:Zoom 상태 유지 및 UI 통일#99

Merged
Danto7632 merged 1 commit intomainfrom
dongjun
Oct 19, 2025
Merged

애니메이션 시스템 최적화:Zoom 상태 유지 및 UI 통일#99
Danto7632 merged 1 commit intomainfrom
dongjun

Conversation

@yoon1017
Copy link
Copy Markdown
Contributor

🎨 애니메이션 시스템 최적화: Zoom 상태 유지 및 UI 통일

📋 요약

모든 애니메이션 컴포넌트에서 Zoom/Pan 상태가 단계 이동 시에도 유지되도록 개선하고, 초기 빈 상태 UI를 통일했습니다.

🔥 핵심 문제 및 해결

1. 컴포넌트 재마운트 문제

문제: AnimationFactory에서 Date.now()를 key로 사용해 매 단계마다 컴포넌트가 완전히 재생성됨

// Before
key: `animation-${normalizedType}-${Date.now()}`

// After  
key: `animation-${normalizedType}`

결과: React가 컴포넌트를 재마운트하지 않고 props만 업데이트 → 상태 유지 가능

2. Zoom 상태 유지

구현: 모든 애니메이션에 useRef로 Transform 저장 및 복원

const currentTransformRef = useRef(d3.zoomIdentity);

// Zoom 이벤트에서 저장
.on('zoom', (event) => {
    currentTransformRef.current = event.transform;
})

// 렌더링 시 복원
svg.call(zoom.transform, currentTransformRef.current);

3. 그래프 튀는 현상 해결

문제: D3 Force Simulation이 매 단계마다 재시작되어 노드들이 통통 튐
해결: Force Simulation 제거 → 정적 원형 레이아웃 사용
효과: 안정적이고 예측 가능한 그래프 표시

4. 초기 상태 UI 통일

변경 전: 컴포넌트마다 다른 빈 상태 (텍스트 메시지, 아무것도 없음 등)
변경 후: 모든 애니메이션이 빈 SVG 캔버스 + 비활성화된 Zoom 컨트롤 표시

📁 수정된 파일

핵심 파일

  • AnimationFactory.js - key 생성 로직 수정
  • VisualizationModal.jsx - 컴포넌트 메모이제이션 개선

애니메이션 컴포넌트 (6개 모두 수정)

  • SortAnimation.jsx - SVG 변환, Zoom 유지, 빈 캔버스
  • GraphAnimation.jsx - Force Simulation 제거, 정적 레이아웃
  • HeapAnimation.jsx - Zoom 유지, 빈 캔버스
  • BinaryTreeAnimation.jsx - Zoom 유지, 빈 캔버스
  • LinkedListAnimation.jsx - SVG 변환, Zoom 유지
  • RecursionAnimation.jsx - 기존 양호 (참고용으로만 사용)

✅ 개선 사항

기능

  • ✅ 단계 이동 시 Zoom/Pan 상태 유지
  • ✅ 그래프 노드 튀는 현상 완전 제거
  • ✅ 모든 애니메이션 초기 상태 통일
  • ✅ 모달 헤더의 중복 Zoom 컨트롤 제거

성능

  • ✅ 컴포넌트 재마운트 방지로 렌더링 성능 향상
  • ✅ Force Simulation 제거로 CPU 사용량 감소
  • ✅ 부드러운 단계 전환

UX

  • ✅ 일관된 사용자 경험
  • ✅ 예측 가능한 시각화
  • ✅ 깜빡임/움찔거림 없음

🧪 테스트 완료

  • Zoom 상태 유지 (다음/이전 단계)
  • Pan(드래그) 위치 유지
  • 초기 빈 캔버스 표시
  • 그래프 안정적 표시
  • 모든 Zoom 컨트롤 정상 작동

📊 영향도

  • Breaking Changes: 없음
  • Migration: 불필요
  • Performance: 개선

Type: Enhancement | Priority: High | Component: Visualization System

@Danto7632 Danto7632 merged commit fc0b1d5 into main Oct 19, 2025
@yoon1017 yoon1017 deleted the dongjun branch October 21, 2025 03:45
@yoon1017 yoon1017 restored the dongjun branch October 21, 2025 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants