We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to lock individual nodes/connectors (instead of the entire layer)?

Hello Syncfusion Team,

Per the documentation, I know it is possible to lock an entire layer of a diagramComponent.

However I just wanted to check whether individual nodes/connectors could be locked without utilizing layers. 

If not, I plan to create a new layer simply to hold "locked" objects. 

Just wondering if there is a simpler way? 

PS: Something like a diagramComponent.nodes[0].lock() method would have been ideal.

Thanks,
Mithun

3 Replies

SG Shyam G Syncfusion Team December 18, 2019 06:56 AM UTC

Hi Mithun, 

Please set NodeConstraints None to lock an individual node and NodeConstraints Default to unlock an individual  node. Similarly, you can set ConnectorConstraints None and Default to lock and unlock a connector Please refer to a code example, sample and help documentation below. 

Code example: 
  lockObject() { 
     let node: NodeModel = this.diagram.getObject("firstNode"); 
     //disable node interaction 
     node.constraints = NodeConstraints.None; 
  

   unlockObject() { 
      let node: NodeModel = this.diagram.getObject("firstNode"); 
      //enable node interaction 
     node.constraints = NodeConstraints.Default; 
  





Regards, 
Shyam G 



MI Mithun December 18, 2019 07:18 AM UTC

Thanks Shyam! This is exactly what I was looking for. 

Thanks,
- Mithun


SG Shyam G Syncfusion Team December 18, 2019 07:26 AM UTC

Hi Mithun, 
Thanks for your update. 
Regards, 
Shyam G 


Loader.
Up arrow icon