feat: enhance UI with custom sort dropdown, resizable layouts, StackView DnD, and optimize slider/resize performance with layout fixes.

This commit is contained in:
2025-12-18 02:06:57 +01:00
parent ebfdfef5ae
commit db601048d9
13 changed files with 589 additions and 101 deletions

View File

@@ -0,0 +1,27 @@
# Work Plan - Optimize Resize Performance
## Request
The user reported that the resize functionality was laggy, slow, and inconsistent.
## Changes
- **Refactoring Strategy**:
- Removed React state updates from the `mousemove` event loop.
- Used `useRef` to track `sidebarWidth` and `poolHeight` values.
- Used `requestAnimationFrame` to throttle DOM updates directly during resizing.
- Only triggered React state updates (re-renders) on `mouseup`.
- **DraftView.tsx**:
- Implemented `resizingState` ref.
- Modified `handleMouseDown` to initiate direct DOM resizing.
- Modified `onMouseMove` to update element styles directly.
- Modified `onMouseUp` to sync final size to React state.
- Applied refs to Sidebar and Pool resizing areas.
- **DeckBuilderView.tsx**:
- Implemented identical ref-based + requestAnimationFrame resizing logic.
- Fixed several HTML nesting errors introduced during the complex refactoring process.
## Verification
- **Performance**: Resizing should now be smooth (60fps) as it avoids React reconciliation during the drag.
- **Consistency**: The handle should no longer "slip" because the visual update is faster.
- **Persistence**: The final size is still saved to `state` (and thus `localStorage`) after release.