-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(page-editor): add visual feedback during page reordering #6289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ import HoverActionMenu, { | |||||
| } from "@app/components/shared/HoverActionMenu"; | ||||||
| import { StirlingFileStub } from "@app/types/fileContext"; | ||||||
| import { PrivateContent } from "@app/components/shared/PrivateContent"; | ||||||
| import { useDndContext } from "@dnd-kit/core"; | ||||||
|
|
||||||
| interface PageThumbnailProps { | ||||||
| page: PDFPage; | ||||||
|
|
@@ -121,6 +122,9 @@ const PageThumbnail: React.FC<PageThumbnailProps> = ({ | |||||
| // Check if this page is currently being dragged | ||||||
| const isDragging = activeDragIds.includes(page.id); | ||||||
|
|
||||||
| const { over } = useDndContext(); | ||||||
| const isOver = over?.id === page.id; | ||||||
|
|
||||||
| // Calculate document aspect ratio from first non-blank page | ||||||
| const getDocumentAspectRatio = useCallback(() => { | ||||||
| // Find first non-blank page with a thumbnail to get aspect ratio | ||||||
|
|
@@ -554,8 +558,8 @@ const PageThumbnail: React.FC<PageThumbnailProps> = ({ | |||||
| background: "rgba(162, 201, 255, 0.8)", | ||||||
| padding: "6px 8px", | ||||||
| borderRadius: 8, | ||||||
| zIndex: 2, | ||||||
| opacity: 0, | ||||||
| zIndex: 20, | ||||||
| opacity: isHovered || isOver ? 0.6 : 0, | ||||||
|
||||||
| opacity: isHovered || isOver ? 0.6 : 0, | |
| opacity: isHovered || (isOver && !isDragging) ? 0.6 : 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useDndContext()inside everyPageThumbnailwill subscribe each thumbnail to DnD context updates (e.g.,overchanges during pointer move). This can cause many thumbnails to re-render on every drag movement, undermining the memoization/virtualization work inDragDropGridand potentially hurting performance on large PDFs. Prefer passing the current drop target id (or a per-itemisOverboolean fromuseDroppable) down via props so only the relevant items update.