Add snap-to-volume mode with continuous dragging for skeleton editing#79
Add snap-to-volume mode with continuous dragging for skeleton editing#79
Conversation
…en parent bone is transformed Co-authored-by: scottpetrovic <2573552+scottpetrovic@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
mesh2motion-app | 7005ba6 | Commit Preview URL Branch Preview URL |
Dec 08 2025, 10:00 PM |
… at volume center Co-authored-by: scottpetrovic <2573552+scottpetrovic@users.noreply.github.com>
…l, and extract magic number Co-authored-by: scottpetrovic <2573552+scottpetrovic@users.noreply.github.com>
|
@copilot I think we need to remove the "move-only joint" mode functionality. That is too much for this PR. Additionally we need to work on the "snap-to-volume" user interaction. When you drag a joint with mouse down, the joint should move until you do a mouse up event. Currently this dragging doesn't happen when I move the joint around to snap to a new volume point |
…r snap-to-volume mode Co-authored-by: scottpetrovic <2573552+scottpetrovic@users.noreply.github.com>
Done! Changes made in commit 444ff19:
The snap-to-volume mode now works like a drag operation where the joint smoothly follows your cursor across the mesh surface. |
src/Mesh2MotionEngine.ts
Outdated
| /** | ||
| * Handle mouse down in snap to volume mode - start dragging | ||
| */ | ||
| private handle_snap_to_volume_mouse_down (mouse_event: MouseEvent): void { |
There was a problem hiding this comment.
Can you move this functionality to an external class for the transform controls. I feel like we have too much code in the main Mesh2Motion engine class.
There was a problem hiding this comment.
Done in commit 7005ba6. Created SnapToVolumeHandler class in src/lib/SnapToVolumeHandler.ts that encapsulates all snap-to-volume functionality (~250 lines). The Mesh2MotionEngine now delegates to this handler, keeping the main engine class cleaner and more focused on orchestration.
|
@copilot I have written a couple of comments on the pull request. Can you take those into account and refactor your code? |
… class Co-authored-by: scottpetrovic <2573552+scottpetrovic@users.noreply.github.com>

Updated Implementation for Issue #34: Snap to Volume Center
This PR implements a snap-to-volume feature with improved code organization.
✨ Feature: Snap to Volume Center
Description: A new transform mode that allows users to drag joints continuously across the mesh, with the joint automatically positioning at the volume center of the mesh area under the cursor.
How it works:
Interaction Model:
🏗️ Code Architecture
SnapToVolumeHandler Class (
src/lib/SnapToVolumeHandler.ts)handle_mouse_down()- Initiates dragginghandle_dragging()- Updates bone position during draghandle_mouse_up()- Finalizes position and cleanupcalculate_local_volume_center()- Computes volume center from nearby verticesIntegration with Mesh2MotionEngine
is_snap_to_volume_dragging()- Check drag statehandle_snap_to_volume_dragging()- Handle mouse movehandle_snap_to_volume_mouse_up()- Handle mouse upBenefits of Refactoring:
🎨 UI Changes
Transform Section:
✅ Technical Implementation
📝 Code Quality
🎯 Related Issue
Addresses #34
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.