# Snap to grid, all - shortcut

**URL:** https://discourse.nodered.org/t/snap-to-grid-all-shortcut/14130
**Category:** Feature Requests
**Created:** [8 August 2019 08:53 UTC](https://discourse.nodered.org/t/snap-to-grid-all-shortcut/14130 "2019-08-08T08:53:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [8 August 2019 08:53 UTC](https://discourse.nodered.org/t/snap-to-grid-all-shortcut/14130/1 "2019-08-08T08:53:25Z")

</div>

There is a snap to grid option, which applies to individual nodes.

I understand it might be a complex implementation, but it would be nice if there would a shortcut to snap all selected nodes to the grid, it is cumbersome to move them individually, especially after changing the grid size. Node alignment options would also be nice addition.

---

<div class="post-metadata">

### Author: ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)
#### Post date: [8 August 2019 09:22 UTC](https://discourse.nodered.org/t/snap-to-grid-all-shortcut/14130/2 "2019-08-08T09:22:59Z")

</div>

That would be a nice feature. 😀

To go even one step further... automatic layout of the flow graph. 🙊

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [8 August 2019 09:50 UTC](https://discourse.nodered.org/t/snap-to-grid-all-shortcut/14130/3 "2019-08-08T09:50:50Z")

</div>

If you look under the keyboard shortcuts dialog, you'll see there is already an action called 'Align Selection To Grid'. It doesn't have a default keyboard shortcut assigned, but you are free to do so.

> [@kuema](#):
>
> To go even one step further... automatic layout of the flow graph.

I've played around with that, but it is a very hard problem to do well. I found a graph layout algorithm that came close to being okay, but it added about 1Mb of javascript to the editor and was very slow. Maybe something that could be done in native code using WebAssembly to improve performance.... but not high on my todo list.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [8 August 2019 10:01 UTC](https://discourse.nodered.org/t/snap-to-grid-all-shortcut/14130/4 "2019-08-08T10:01:37Z")

</div>

> If you look under the keyboard shortcuts dialog, you'll see there is already an action called 'Align Selection To Grid'. It doesn't have a default keyboard shortcut assigned, but you are free to do so.

I knew before I made the topic that I have probably overlooked it somewhere 🤯  
thanks once again.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [8 August 2019 10:26 UTC](https://discourse.nodered.org/t/snap-to-grid-all-shortcut/14130/5 "2019-08-08T10:26:24Z")

</div>

> [@knolleary](#):
>
> I found a graph layout algorithm that came close to being okay

Hi Nick (@knolleary), solely for my personal curiosity. Would be nice if you could share a link to what you found. PS. Don't panic now, I will not wrap it into a contribution 🤣
