Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Get the node shape type using getShape() (Read 2366 times)
JaymeW
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Get the node shape type using getShape()
Oct 21st, 2021 at 5:42pm
Print Post  
Hello, I am trying get the node shape type using getShape(), however, I'm getting an answer [object Object]. For example: i want 'Decision' shape or 'Ellipse'. I am using the code:

Code (HTML)
Select All
for (let link of diagram.getLinks()) {
		var ori = link.getOrigin();
		var des = link.getDestination();
		'The node ' + `${ori.getText()} has the shape ${ori.getShape()}` + '\n';

	} 


Where ori.getShape() should be something like 'Decision' shape or 'Ellipse' for example.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Get the node shape type using getShape()
Reply #1 - Oct 21st, 2021 at 9:02pm
Print Post  
Hi,

Try node.getShape().getId();

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


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Re: Get the node shape type using getShape()
Reply #2 - Oct 21st, 2021 at 10:41pm
Print Post  
Oh, it worked. Thank you! I didn't expect to have to access the attribute via another function. When I used setShape(), I just needed to add what kind of shape I wanted.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Get the node shape type using getShape()
Reply #3 - Oct 22nd, 2021 at 5:54am
Print Post  
Hi,

So Shape is an object that defines the elements of node's geometry (and you could use to define your own shapes). It's what ShapeNode keeps internally, but maybe it's a bit misleading that setShape also accepts string argument as in ShapeNode.setShape(id), which is a shortcut to ShapeNode.setShape(Shape.fromId(id));

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint