miroiu / nodify

Highly performant and modular controls for node-based editors designed for data-binding and MVVM.
https://miroiu.github.io/nodify
MIT License
1.27k stars 205 forks source link

Fix the unintentional movement caused by snapping correction #75

Closed fantasydr closed 9 months ago

fantasydr commented 10 months ago

📝 Description of the Change

Check the actual movement before apply the snapping correction.

When the snapping correction is enabled, the graph attempts to align the nodes to the grids. However, even if a user merely selects a node, it might still move and snap to the grid. Furthermore, when using grouped nodes, such as comment in the playground example, selecting the comment can inadvertently select many nodes. This can lead to several unintentional movements.

🐛 Possible Drawbacks

Are there any possible side-effects or negative impacts with this code change?

I think not. Users who wish to adjust nodes based on grid size can easily nudge them slightly to achieve the desired alignment.

miroiu commented 10 months ago

Hi, thanks for your contribution, but the fix also has a side effect. It prevents the snapping when moving the selection only in one axis.

fantasydr commented 10 months ago

Hi, thanks for your contribution, but the fix also has a side effect. It prevents the snapping when moving the selection only in one axis.

Oh you're right, it should be || instead of &&. I just updated the branch.

miroiu commented 9 months ago

Looks good. Please update the changelog with the fix before I merge it. Thanks!

fantasydr commented 9 months ago

Looks good. Please update the changelog with the fix before I merge it. Thanks!

Thanks for the review. Updated the changelog file.