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

On hover of nodes can we have icons above node which supports few other functionalities like edit and delete.

Hi,

On hover of nodes can we have icons above node which supports few other functionalities like edit and delete?

Regards,
Sudhanshu

3 Replies

SG Shyam G Syncfusion Team November 6, 2019 12:52 PM UTC

Hi Sudhanshu, 
 
When we mouse hover on nodes, the diagram mouseOver event gets triggered. In this event, you can create an icon with your own custom logic. 
 
Code example: 
  <DiagramComponent 
         id="diagram"     
       mouseOver={(args: IMouseEventArgs) => { 
        // do your own logic 
    }}/> 
 
 
 
Regards, 
Shyam G 



SJ Sudhanshu Jain November 21, 2019 01:11 PM UTC

Hi Shyam,

I have used userhandle for this issue but is there a way to set visibility of this userhandle to false on drag of the shapes from symbol palette. 
I require the userhandle to be visible only on selection of shapes in canvas. In rest of the time like drag drop of shapes from symbol palette the userhandle should not be visible.

Please let me know on same.
Thanks


SG Shyam G Syncfusion Team November 22, 2019 11:50 AM UTC

Hi Sudhanshu, 
 
We have created a sample in which we have shown user handle in selectionChange event and hidden it in the positionChange and collectionChange event. So, the user handle will be visible only when you select a node in the diagram. 
 
Code example: 
<DiagramComponent 
collectionChange={(args) => { 
                showHideUserhandles(false); 
              }} 
              selectionChange={(args) => { 
                showHideUserhandles(true); 
              }} 
              positionChange={(args) => { 
                showHideUserhandles(false); 
              }}/> 
 
function showHideUserhandles(visiblity) { 
  // Iterate an handles 
  for (let i = 0; i < diagramInstance.selectedItems.userHandles.length; i++) { 
    let userHandle = diagramInstance.selectedItems.userHandles[i]; 
    //show/hide the userhandle 
    userHandle.visible = visiblity; 
  } 
}  
 

Regards, 
Shyam G 


Loader.
Live Chat Icon For mobile
Up arrow icon