mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-16 17:55:55 -05:00
This PR implements a minimum movement threshold of 50 pixels for node position changes before they are logged to the history system. This prevents the undo/redo history from being cluttered with minor, unintentional movements that occur when users interact with block inputs or accidentally nudge nodes. ### Changes 🏗️ - **Added movement threshold for history tracking**: Implemented a 50px minimum movement requirement before logging node position changes to history - **Prevents history spam**: Stops small, unintentional movements (like clicking on inputs inside blocks) from cluttering the undo/redo history - **Tracks drag start positions**: Maintains initial positions when dragging begins to accurately calculate total movement distance - **Improved history management**: Only significant node movements are now recorded, matching the behavior of the old builder - **Memory efficient**: Cleans up tracked positions after drag operations complete ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Drag a node less than 50px and verify no history entry is created - [x] Drag a node more than 50px and verify history entry is created - [x] Click on inputs inside blocks and verify no history entries are created - [x] Test undo/redo functionality works correctly with the threshold - [x] Verify adding/removing nodes still creates history entries - [x] Test multiple nodes being dragged simultaneously