|
| 1 | +--- |
| 2 | +title: "DMP’25 Week 07 Update by Justin Charles" |
| 3 | +excerpt: "Implemented tower-level dragging in the workspace, enabling grouped brick movement and refining state synchronization across collisions" |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-07-20" |
| 6 | +slug: "2025-07-20-dmp-25-justin212407-week07" |
| 7 | +author: "@/constants/MarkdownFiles/authors/justin-charles.md" |
| 8 | +tags: "dmp25,sugarlabs,week7,justin212407" |
| 9 | +image: "assets/Images/c4gt_DMP.webp" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 7 Progress Report by Justin Charles |
| 15 | + |
| 16 | +**Project:** Music Blocks 4 Masonry |
| 17 | +**Mentors:** [Anindya Kundu](https://github.com/meganindya/), [Sumit Srivastava](https://github.com/sum2it) |
| 18 | +**Assisting Mentors:** [Devin Ulibari](https://github.com/pikurasa/), [Walter Bender](https://github.com/walterbender) |
| 19 | +**Reporting Period:** 2025-07-12 - 2025-07-20 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Goals for This Week |
| 24 | + |
| 25 | +- Implement tower-level dragging for grouped bricks in the workspace |
| 26 | +- Ensure consistent updates to brick positions during drag |
| 27 | +- Synchronize tower state with collision maps in real-time |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## This Week’s Highlights |
| 32 | + |
| 33 | +### 1. **Tower Dragging Implementation** |
| 34 | + |
| 35 | +Worked on [PR #450](https://github.com/sugarlabs/musicblocks-v4/pull/450) to add tower-level dragging: |
| 36 | +- Enabled movement of entire towers (root brick + children) as a single unit |
| 37 | +- Preserved parent-child hierarchy when updating positions |
| 38 | +- Improved drag responsiveness by recalculating bounding boxes during movement |
| 39 | + |
| 40 | +### 2. **State Synchronization Across Towers** |
| 41 | + |
| 42 | +- Updated `TowerModel` to handle bulk position updates for all bricks within a tower |
| 43 | +- Integrated with collision maps so towers temporarily unregister during drag and re-register on drop |
| 44 | +- Enhanced React state management for smoother rendering of large tower movements |
| 45 | + |
| 46 | +### 3. **User Interaction Improvements** |
| 47 | + |
| 48 | +- Introduced proper offset handling to keep drag anchor consistent regardless of tower size |
| 49 | +- Added visual feedback for tower movement, ensuring alignment with cursor |
| 50 | +- Prepared groundwork for snapping logic to align towers when dropped near others |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## Challenges & Solutions |
| 55 | + |
| 56 | +**Challenge:** Dragging large towers caused lag due to repeated state updates |
| 57 | +**Solution:** Batched updates at the tower level and minimized per-brick re-renders |
| 58 | + |
| 59 | +**Challenge:** Maintaining relative brick positions while dragging |
| 60 | +**Solution:** Used stored subtree offsets to apply uniform translation during movement |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Key Learnings |
| 65 | + |
| 66 | +- **Tower-Level Abstractions** |
| 67 | + Learned how to extend single-brick drag logic to tower hierarchies without breaking child alignment |
| 68 | + |
| 69 | +- **Batching Updates** |
| 70 | + Saw the importance of batching atom updates in Recoil to avoid UI jank in React |
| 71 | + |
| 72 | +- **Collision Integration** |
| 73 | + Understood how temporary removal from collision maps avoids false positives during active drag |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Next Week’s Roadmap |
| 78 | + |
| 79 | +- Implement snapping between towers using collision hints |
| 80 | +- Add shadow previews during drag for better visual guidance |
| 81 | +- Begin refining detach/attach logic for bricks when splitting or merging towers |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## Resources & References |
| 86 | + |
| 87 | +- [musicblocks-v4 PR #450](https://github.com/sugarlabs/musicblocks-v4/pull/450) |
| 88 | +- [musicblocks-v4 Repository](https://github.com/sugarlabs/musicblocks-v4) |
| 89 | +--- |
| 90 | + |
| 91 | +## Acknowledgments |
| 92 | + |
| 93 | +Thanks to my mentors for guiding me through scaling drag logic from bricks to full towers. |
0 commit comments