retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
9.86k stars 647 forks source link

Position snap #144

Closed christian-alejandre-mllrdev closed 5 years ago

christian-alejandre-mllrdev commented 6 years ago

Hi there @Ni55aN how is it possible to place a node into the nearest round of x and y position? to arrange the node so easily into a grid. like it snaps everytime I drag or create a node. version use: v0.7.4 https://codepen.io/pierrebleroux/pen/gGpvxJ

Ni55aN commented 6 years ago

I'm not sure if this can be done without changing the code of the library itself in v0.7.4, but on version 1 it will look like this https://jsfiddle.net/Ni55aN/6fd7hy0v/

christian-alejandre-mllrdev commented 6 years ago

I tried changing the library (v0.7.4), it works, but it doesn't work well when dragging the node and it has some bugs like it doesn't follow mouse pointer when in zooming out.

christian-alejandre-mllrdev commented 5 years ago

Still unresolved issue on v0.7.4.

Ni55aN commented 5 years ago

IMHO it makes sense after a while to go to version 1, since the previous one will not be supported

AreaPlugin for v1.0.0 has been updated https://github.com/retejs/area-plugin/commit/b5892012152537bc63835ecc69024483c765f277

editor.use(AreaPlugin, {snap: {size: 64. dynamic: true}});