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 there a way to restrict drag of individual node from pallette

 Hi,

Can we disable drag for a specific node within the nodepanel?

Regards,
Sudhanshu

8 Replies

SG Shyam G Syncfusion Team November 18, 2019 05:03 AM UTC

Hi Sudhanshu, 
 
We suspect that you need to disable drag for a specific node in the group. If so, please remove NodeConstraints Drag from the NodeConstraints Default to achieve your requirement. Please refer to a code example and sample below. If we misunderstood your requirement, please share us more details such as elaborate your requirement in detail with screenshot? 
 
Code example: 
let nodes = [{ 
  id: "rectangle1", 
  offsetX: 100, 
  offsetY: 100, 
  width: 100, 
  height: 100, 
  annotations: [{ 
    content: 'rectangle1' 
  }] 
}, { 
  id: "rectangle2", 
  offsetX: 200, 
  offsetY: 200, 
  width: 100, 
  height: 100, 
  //remove drag constraints 
  constraints: NodeConstraints.Default & ~NodeConstraints.Drag, 
  annotations: [{ 
    content: 'rectangle2' 
  }] 
}, 
//create group element 
{ 
  id: 'group2', 
  children: ['rectangle1', 'rectangle2'] 
} 
]; 
 
 
 
Regards, 
Shyam G 



SJ Sudhanshu Jain November 18, 2019 08:31 AM UTC

Hi Shyam,

I was referring to Symbol palette nodes, not within canvas. Please let me know regarding restriction of drag of a specific node within Symbol palette.

Thanks


SG Shyam G Syncfusion Team November 19, 2019 08:40 AM UTC

Hi Sudhanshu, 
 
In the symbol palette component we can restrict dragging of all shapes, not an individual shape. To prevent dragging of the shape from the symbol palette, please set allowDrag property as false.. Please refer to a code example and sample below. 

Code example: 
<SymbolPaletteComponent id="symbolpalette" expandMode="Multiple" allowDrag={false}/> 
 

 
Regards, 
Shyam G 



SJ Sudhanshu Jain November 19, 2019 09:09 AM UTC

Hi Shyam,

Yes, i had check allowDrag property but i want to restrict the drag of individual node/shape within symbol palette.
Please let me know if the same can be handled.

Thanks


SG Shyam G Syncfusion Team November 20, 2019 05:07 AM UTC

Hi Sudhanshu, 

We don’t have an option to restrict individual shape in the symbol palette. Please share your scenario why you need to restrict individual shapes in the symbol palette. So that we can validate it further and provide an update on it. 

Regards, 
Shyam G 



SJ Sudhanshu Jain November 20, 2019 08:18 AM UTC

Hi Shyam,

In a flow , we can not have more than one start/end node. So if those nodes already exists then we want to display start and end node in the symbol palette but we want to restrict the drag of that node.

Thanks


SG Shyam G Syncfusion Team November 21, 2019 07:09 AM UTC

Hi Sudhanshu, 

On analyzing your scenario, we suggest you to use diagram collectionChange event in which we can set args.cancel=true for a particular node to prevent it from dropping onto the diagram. We have an issue in it and logged “Unable to remove connectors that are drawn at runtime in the collectionChange” a defect report. The fix for this issue is estimated to be available on 3rd December, 2019. 
 
You can track the status of the issue from the below feedback link. 
 

Regards, 
Shyam G 



SG Shyam G Syncfusion Team December 5, 2019 12:00 PM UTC

Hi Sudhanshu,  
  
Reported Issue : Unable to remove connectors that are drawn at runtime in the collectionChange. 
  
We are glad to announce that our patch release (v17.3.29) is rolled out successfully and In that release, we have added the fix for reported issue.      
       
Please upgrade to the latest version packages to resolve this issue.       
 
Regards,  
Shyam G  


Loader.
Up arrow icon