Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drawing SvgNode in react (Read 1063 times)
Kamil
YaBB Newbies
*
Offline



Posts: 22
Joined: Aug 22nd, 2024
Drawing SvgNode in react
Oct 8th, 2024 at 9:26am
Print Post  
Hi there! I'm trying achieve the following funcionality in react: a user clicks on a diagram and while holding the mouse button and dragging they draw an SVG node.

I've set customNodeType to have the same type as mfDiagramming.SvgNode:

Code (Javascript)
Select All
    diagram.customNodeType = typeof mfDiagramming.SvgNode;
 



And I've passed the following function to DiagraView onNodeCreating property:

Code (Javascript)
Select All
    function onNodeCreating (diagram: mfDiagram.Diagram, nodeEventArgs: mfDiagram.NodeEventArgs) {
        debugger;
    } 


     
But when the debugger pauses the code, we can observe that created node is a ShapeNode and not SvgNode (please see the attachment). I wanted to assign node.content (an svg) inside onNodeCreating event but I'm not sure if it is a correct approach.

Am I doing something wrong here? Could you advise me on how to achieve the desired functionality?
  

Zrzut_ekranu_2024-10-08_111200.png ( 46 KB | 91 Downloads )
Zrzut_ekranu_2024-10-08_111200.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Drawing SvgNode in react
Reply #1 - Oct 8th, 2024 at 10:47am
Print Post  
Hi!

Try setting DiagramView.behavior to DrawSvgNodes or LinkSvgNodes. customNodeType should work too if you set behavior = Custom;

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Kamil
YaBB Newbies
*
Offline



Posts: 22
Joined: Aug 22nd, 2024
Re: Drawing SvgNode in react
Reply #2 - Oct 9th, 2024 at 10:29am
Print Post  
Works like a charm! Thanks Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint