Skip to content

Fixed face inconsistency after folder removal #572

Closed
DecodeX15 wants to merge 5 commits intoAOSSIE-Org:mainfrom
DecodeX15:bug/face_count_fix
Closed

Fixed face inconsistency after folder removal #572
DecodeX15 wants to merge 5 commits intoAOSSIE-Org:mainfrom
DecodeX15:bug/face_count_fix

Conversation

@DecodeX15
Copy link
Contributor

@DecodeX15 DecodeX15 commented Oct 7, 2025

Title:
fix(#569): remove clusters with zero face_count from persisted face data

Description:
This PR filters out clusters where face_count === 0 before updating the main array.

Uploading Recording 2025-10-07 095004.mp4…

Summary by CodeRabbit

  • New Features
    • Added mouse wheel zoom in the media viewer with smooth, cursor-centered scaling.
  • Bug Fixes
    • Excludes empty face clusters from display to improve relevance.
  • Refactor
    • Simplified cluster state updates by running population logic during render when data is available.
  • Style
    • Improved image rendering: constrained to container (max-width/height 100%), preserves aspect ratio (contain), non-selectable, and uses top-left transform origin for predictable zoom behavior.

@DecodeX15 DecodeX15 closed this Oct 7, 2025
@DecodeX15 DecodeX15 deleted the bug/face_count_fix branch October 7, 2025 04:25
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds wheel-based zoom handling to media viewer, updates image styling constraints, and adjusts FaceCollections to filter zero-face clusters and dispatch during render instead of useEffect.

Changes

Cohort / File(s) Summary
FaceCollections render-time dispatch and filtering
frontend/src/components/FaceCollections.tsx
Removes useEffect; dispatches clusters during render when data ready; filters out clusters with face_count == 0 before setClusters.
Image viewer styling constraints
frontend/src/components/Media/ImageViewer.tsx
Replaces className with inline styles: transformOrigin top-left, maxWidth/Height 100%, userSelect none, objectFit contain.
Wheel zoom integration in media view
frontend/src/components/Media/MediaView.tsx
Adds onWheel handler to container calling handlers.handleWheelZoom with event and bounding rect; minor comment-only addition.
Image view controls: wheel-zoom handler
frontend/src/hooks/useImageViewControls.ts
Adds handleWheelZoom(e, containerRect): prevents default, computes mouse-relative zoom with clamped scale, repositions to keep cursor focal, updates state; exposes in returned handlers.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant MV as MediaView (container)
  participant HC as useImageViewControls (handlers)
  participant IV as ImageViewer (image)

  U->>MV: Mouse wheel event
  MV->>HC: handlers.handleWheelZoom(e, container.getBoundingClientRect())
  activate HC
  HC->>HC: Prevent default, calc mouse pos, clamp scale
  HC->>HC: Adjust pan to keep cursor focal point
  HC-->>MV: Update view state (scale, x, y)
  deactivate HC
  MV->>IV: Rerender with updated transform/style
  IV-->>U: Image zooms around cursor
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nudge the wheel—zoom zoom!—what fun,
A carrot-cursor, on the run. 🥕
Faces sifted, zeros gone,
Images snug, with borders drawn.
I twitch my ears, approve the view—
Hop, pan, rotate—brand-new zoom, woohoo!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20d16e5 and 811768e.

📒 Files selected for processing (4)
  • frontend/src/components/FaceCollections.tsx (1 hunks)
  • frontend/src/components/Media/ImageViewer.tsx (1 hunks)
  • frontend/src/components/Media/MediaView.tsx (2 hunks)
  • frontend/src/hooks/useImageViewControls.ts (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant

Comments