From 7e7577af1affdea6d24c4c36b7d324ae9f8dd5b7 Mon Sep 17 00:00:00 2001 From: justin212407 Date: Wed, 3 Sep 2025 15:28:43 +0530 Subject: [PATCH] DMP-2025 Week 08 update by Justin Charles Signed-off-by: justin212407 --- .../2025-07-27-dmp-25-justin212407-week08.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/constants/MarkdownFiles/posts/2025-07-27-dmp-25-justin212407-week08.md diff --git a/src/constants/MarkdownFiles/posts/2025-07-27-dmp-25-justin212407-week08.md b/src/constants/MarkdownFiles/posts/2025-07-27-dmp-25-justin212407-week08.md new file mode 100644 index 00000000..274c27cd --- /dev/null +++ b/src/constants/MarkdownFiles/posts/2025-07-27-dmp-25-justin212407-week08.md @@ -0,0 +1,94 @@ +--- +title: "DMP’25 Week 08 Update by Justin Charles" +excerpt: "Implemented brick disconnection logic for towers, enabling subtree detachment and independent movement of child groups" +category: "DEVELOPER NEWS" +date: "2025-07-27" +slug: "2025-07-27-dmp-25-justin212407-week08" +author: "@/constants/MarkdownFiles/authors/justin-charles.md" +tags: "dmp25,sugarlabs,week8,justin212407" +image: "assets/Images/c4gt_DMP.webp" +--- + + + +# Week 8 Progress Report by Justin Charles + +**Project:** Music Blocks 4 Masonry +**Mentors:** [Anindya Kundu](https://github.com/meganindya/), [Sumit Srivastava](https://github.com/sum2it) +**Assisting Mentors:** [Devin Ulibari](https://github.com/pikurasa/), [Walter Bender](https://github.com/walterbender) +**Reporting Period:** 2025-07-21 - 2025-07-27 + +--- + +## Goals for This Week + +- Extend tower drag logic by implementing brick disconnection +- Allow subtree detachment from parent towers when dragging out child bricks +- Maintain consistent state updates for both the parent and the detached subtree + +--- + +## This Week’s Highlights + +### 1. **Brick Disconnection Implementation** + +Expanded [PR #450](https://github.com/sugarlabs/musicblocks-v4/pull/450) to support brick disconnection: +- Enabled dragging of a child brick (and its subtree) out of a parent tower +- Ensured detached bricks retain hierarchy and become a new independent tower +- Updated `TowerModel` to support `detachSubtree` operation with proper ID remapping + +### 2. **State Management for Disconnected Bricks** + +- Synced Recoil state so detached subtrees re-register as new towers +- Updated reverse mapping utility to correctly track parent/child relations after split +- Maintained integrity of collision maps by removing and re-adding affected nodes + +### 3. **Improved Workspace Interactivity** + +- Added consistent cursor anchoring when pulling bricks from towers +- Ensured visual feedback during disconnection (brick shadows and offset updates) +- Prevented invalid states by blocking disconnection of non-draggable root nodes + +--- + +## Challenges & Solutions + +**Challenge:** Preventing partial subtree corruption during disconnection +**Solution:** Built a dedicated `detachSubtree()` method that clones and relocates the full hierarchy safely + +**Challenge:** Collision map desync when multiple towers updated at once +**Solution:** Batched tower re-registration to ensure atomic updates across maps + +--- + +## Key Learnings + +- **Subtree Logic** + Learned how to safely extract and reinitialize hierarchical structures without breaking references + +- **Tower Model Flexibility** + Deepened understanding of extending core tower APIs (`add`, `merge`, `detach`) for scalable interactions + +- **Collision Map Resilience** + Saw how batching state updates helps avoid flickers and false collisions in real-time rendering + +--- + +## Next Week’s Roadmap + +- Implement snapping of detached towers onto valid drop zones +- Introduce shadow previews for disconnection to guide user interaction +- Begin refining attach logic for merging detached towers back together + +--- + +## Resources & References + +- [musicblocks-v4 PR #450](https://github.com/sugarlabs/musicblocks-v4/pull/450) +- [musicblocks-v4 Repository](https://github.com/sugarlabs/musicblocks-v4) + +--- + +## Acknowledgments + +Thanks to my mentors for helping validate the disconnection workflow and ensuring robustness of the tower model.