# The option to lock node positions in the designer

**URL:** <https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092>\
**Category:** Feature Requests\
**Created:** [12 September 2018 21:28 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092 "2018-09-12T21:28:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alacritous](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Alacritous](https://discourse.nodered.org/u/Alacritous)\
**Post date:** [12 September 2018 21:28 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/1 "2018-09-12T21:28:47Z")

</div>

I hate it when I accidentally shift something out of place. So have a setting to lock the nodes in place. The only way to move them would be when you place a new one from the palette. Or by holding down the ctrl key while clicking and dragging to move a node and have it snap to grid or hold shift and drag to move one to not snap to grid.

Just my thoughts.

Regards,

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 September 2018 21:57 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/2 "2018-09-12T21:57:40Z")

</div>

ctrl-z will undo the move for you of course...

---

<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:** [12 September 2018 22:34 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/3 "2018-09-12T22:34:46Z")

</div>

There is already a snap-to-grid option in the view settings dialog.

---

<div class="post-metadata">

**Author:** ![Alacritous](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Alacritous](https://discourse.nodered.org/u/Alacritous)\
**Post date:** [12 September 2018 22:40 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/4 "2018-09-12T22:40:01Z")

</div>

I know that. The holding ctrl or shift is ancillary to the main locking idea.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [23 September 2018 23:15 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/5 "2018-09-23T23:15:09Z")

</div>

I like this proposal except for the idea that a setting would lock all node positions at once. Instead, it would be nice to be able to select one or more nodes and use a keyboard shortcut to lock or unlock the positions of just those nodes. Probably a lot of programming effort for a small benefit, but something possibly worth considering if a major overhaul of the flow editor is in the works.

---

<div class="post-metadata">

**Author:** ![Alacritous](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Alacritous](https://discourse.nodered.org/u/Alacritous)\
**Post date:** [1 October 2018 17:56 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/6 "2018-10-01T17:56:49Z")

</div>

I'm not sure how they've done it under the hood, but I'd imagine that you'd just need to add one more meta property to the node objects and an extra if ... and (is !locked) to the click and drag event. If I were a better programmer, I'd try it myself. I just might anyways, but the results won't be pretty.

---

<div class="post-metadata">

**Author:** ![JayDickson](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jaydickson/32/90592_2.png) [@JayDickson](https://discourse.nodered.org/u/JayDickson)\
**Post date:** [1 October 2018 18:22 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/7 "2018-10-01T18:22:09Z")

</div>

To throw in my own unprompted input: Perhaps this could be further augmented by allowing nodes to be given a "parent" node to which they are anchored and the ability to lock a node to a relative position to the parent. This would be downright amazing if used in conjunction with comment nodes. (My mental image is of a comment node being used to label a functional group and also serve as the handle to drag it around by.)

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [3 October 2018 18:21 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/8 "2018-10-03T18:21:19Z")

</div>

@JayDickson This sounds a lot like a suggestion I made a couple of years ago, [https://groups.google.com/forum/#!topic/node-red/\_qn6mwHFX9g](https://groups.google.com/forum/#!topic/node-red/_qn6mwHFX9g). At the time there seemed to be an interest in improving the (self-) documentation of flows, but not in that particular approach.

---

<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:** [3 October 2018 20:17 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/9 "2018-10-03T20:17:35Z")

</div>

Dave and I talked through this idea a bit today over a coffee. It has come up a handful of times and there are certainly use interesting use cases for it.

But of course, the devil is in the details and there are a wide range of uses cases to consider.

Here's what we came up with as a starter for the approach. I will say up front, this doesn't mean we'll drop what we're working on to deliver this. But having a thought through design is the first step to it happening at some point in the future.

This is focused on the user experience of the feature rather than any specifics of how it would be implemented.

1. A node that is 'locked' cannot be moved.
  - if you select multiple nodes including a locked one, the selection cannot be moved
  - if a locked node is imported, it can be moved during the initial import, but once placed, it cannot move

2. Double-clicking on the node will open its edit dialog, but the Done button is unavailable.
  - this allows a user to examine a node's configuration but not change it
  - _somewhere_ in the edit dialog is a toggle to lock/unlock the node. Unlocking the node will enable the Done button. If the node is then relocked, the Done button remains active to save any changes.

3. A Flow can be locked.
  - this will lock all nodes in the flow and the flow's properties.
  - double-clicking on a node in a locked flow will open its edit dialog, with the Done button unavailable
  - the dialog will _not_ provide an unlock option - that must be done at the flow level

Some open questions:

1. can a locked node be copy/pasted?
2. can a locked node be exported?
3. should a node have any visual indication that its locked?
  - Maybe something that only appears when the node is selected (similar to the Link node behaviour)

4. should there be a keyboard-click combo that allows a locked node to be moved?

Some other half-baked thoughts:

1. should there be a specific 'unlock-nodes' (name very much tbd) permission - this would allow for a setup where one user (lets call them, Teacher) can setup some flows with missing pieces, and another user (lets call them Student) can fill in those missing parts without being able to modify the existing parts.

---

<div class="post-metadata">

**Author:** ![tilleul](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tilleul/32/78_2.png) [@tilleul](https://discourse.nodered.org/u/tilleul)\
**Post date:** [3 October 2018 20:42 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/10 "2018-10-03T20:42:11Z")

</div>

all these suggestions look great !  
Open questions:  
1- yes, a locked node should be copiable  
2- yes, a locked node should be exportable  
3- yes, either a small lock icon as a badge or a different color/style for the stroke  
4- yes

Unlock-nodes permission: this seem like a good idea as well !

😃

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [3 October 2018 20:53 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/11 "2018-10-03T20:53:11Z")

</div>

Wow! This has taken on a life of its own (like NR 🙂). The original idea was just to lock the position of a node in the editor window. Locking the configuration dialog and other features opens up a lot of possibilities. 👍

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [3 October 2018 21:04 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/12 "2018-10-03T21:04:26Z")

</div>

If a flow can be locked, and that locks the properties, should that also apply to the debug state?  
I can see where in a lesson you might want to start with a locked flow, but still be able to toggle debug nodes on and off.

---

<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:** [3 October 2018 21:07 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/13 "2018-10-03T21:07:03Z")

</div>

> [@ukmoose](#):
>
> If a flow can be locked, and that locks the properties, should that also apply to the debug state?  
> I can see where in a lesson you might want to start with a locked flow, but still be able to toggle debug nodes on and off.

Similarly whether a locked Inject node can be triggered or not....

How about...

1. a locked debug node can be toggled, but doing so doesn't change the node's config in the editor - ie you can't persist that change.
2. a locked inject node can be triggered

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [3 October 2018 21:38 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/14 "2018-10-03T21:38:12Z")

</div>

Please keep those little things as intuitive for user as possible. This kind of hidden treasures are cool only if they dont harm the main purpose of editor - being supportive for users to bring their ideas to real life.  
I think the locking by group might be useful if there is option to unlock things with one click procedure. By struggle with lock here and other lock somewhere else will be just losing the focus from main thing - to create your desired solution. 😉

---

<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:** [3 October 2018 21:41 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/15 "2018-10-03T21:41:54Z")

</div>

Absolutely. I don't see 'regular' users as the main audience for this feature, so it needs to be unobtrusive.

---

<div class="post-metadata">

**Author:** ![Alacritous](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Alacritous](https://discourse.nodered.org/u/Alacritous)\
**Post date:** [3 October 2018 21:56 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/16 "2018-10-03T21:56:59Z")

</div>

I was just envisioning the locking mechanism as a way to prevent accidental modification, not as a security feature.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [3 October 2018 21:59 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/17 "2018-10-03T21:59:44Z")

</div>

If I import a flow (say from [flows.nodered.org](http://flows.nodered.org)) and someone has locked several of the nodes... I would then have to go round unlocking them all before I could do something... uurgh. But then in the teacher/pupil scenario you wouldn't want unlocking... but how can teacher A share with teacher B.

Dare I say... what about subflows... I guess things "locked" inside subflows would have no effect out side the subflow.

---

<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:** [3 October 2018 22:01 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/18 "2018-10-03T22:01:36Z")

</div>

> [@Alacritous](#):
>
> I was just envisioning the locking mechanism as a way to prevent accidental modification, not as a security feature.

Yup - that's understood. But as you can see, there are other use-cases for us to consider!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 October 2018 23:27 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/19 "2018-10-03T23:27:33Z")

</div>

Anotehr thing to think about, would/should you be able to add a wire to the input or output of a locked node/flows?

---

<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:** [3 October 2018 23:46 UTC](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092/20 "2018-10-03T23:46:11Z")

</div>

> [@zenofmud](#):
>
> Anotehr thing to think about, would/should you be able to add a wire to the input or output of a locked node/flows?

Ah yes.... Forgot to cover that.

1. A locked node may have wires added or removed,
2. A possible exception: a wire joining two locked nodes may not be deleted

We are _not_ going to introduce locking of individual wires - the flow file format does not support wire properties and this won't be the feature that leads us to change that.

[Next page](https://discourse.nodered.org/t/the-option-to-lock-node-positions-in-the-designer/3092.md?page=2)
