Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Change default Shape Type when drawing or creating a node (Read 2474 times)
Davaaron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 12th, 2018
Change default Shape Type when drawing or creating a node
Sep 13th, 2018 at 2:03pm
Print Post  
Hi,

I saw that the LinkNodeBehavior calls the constructor of the ShapeNode. Whenever I draw a node or drop a node from the list view into the Diagram, I'd like to create a ContainerNode instead.
How could I achieve that?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3378
Joined: Oct 19th, 2005
Re: Change default Shape Type when drawing or creating a node
Reply #1 - Sep 14th, 2018 at 8:48am
Print Post  
Hi,

What instance is created when you draw with mouse depends on diagram.Behavior property value; try setting it to either DrawContainers or LinkContainers. As for "drop a node from the list view" part, it just clones whatever node instance you drag from the list, so add an actual ContainerNode there.

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


I Love MindFusion!

Posts: 42
Joined: Jul 12th, 2018
Re: Change default Shape Type when drawing or creating a node
Reply #2 - Sep 14th, 2018 at 11:55am
Print Post  
When I do that when listening on mousedown event, don't I interrupt the creation of controllers within the Behavior.createController?
If mousedown=true, wouldn't I need to distinguish between moving nodes or selecting them and drawing?

I created my own list view because I want to stay independent here.

Edit: Drawing a container node now works.
But somehow panning doesn't work. I even enable it setting Behavior.Pan. What could cause this issue? The canvas is offsetLet and Top but has a width of more than 4000px and height near to 3000px.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3378
Joined: Oct 19th, 2005
Re: Change default Shape Type when drawing or creating a node
Reply #3 - Sep 14th, 2018 at 2:53pm
Print Post  
Quote:
But somehow panning doesn't work.


Have you enabled overflow on the div that contains diagram's <canvas> element? Other than that, try adding a breakpoint on the 'return new PanController' line in your custom behavior code to verify if it's ever hit.
  
Back to top
 
IP Logged
 
Davaaron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 12th, 2018
Re: Change default Shape Type when drawing or creating a node
Reply #4 - Sep 17th, 2018 at 2:47pm
Print Post  
Yea I set it to true (scroll). I removed my custom behavior for now to avoid side effects.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint