Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to set node height if (Read 1931 times)
oxzorxxo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Nov 26th, 2018
how to set node height if
Nov 30th, 2018 at 1:07pm
Print Post  
how to set node height if it's circle ...
or let's say i want to draw oval shape or add it to mindfusioin library
using javascript
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3148
Joined: Oct 19th, 2005
Re: how to set node height if
Reply #1 - Nov 30th, 2018 at 2:48pm
Print Post  
You can draw oval shapes with mouse by setting -

Code
Select All
diagram.setDefaultShape(
	Shape.fromId("Ellipse")); 



Change node's height by calling -

Code
Select All
var r = node.getBounds();
r.height = ...;
node.setBounds(r); 



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


I Love MindFusion!

Posts: 13
Joined: Nov 26th, 2018
Re: how to set node height if
Reply #2 - Nov 30th, 2018 at 5:13pm
Print Post  
thank you .... but how to get if created shape is circle
i used

for (var shapeId in Shape.shapes) {
var shape = Shape.shapes[shapeId];
if (shapeId == "Circle")
but didn't work
thank you in advance
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: how to set node height if
Reply #3 - Dec 3rd, 2018 at 7:56am
Print Post  
Hi,

What is not working? You don't find the shape, or there is a syntax error?

Have you created a local variable for the Shape object? If not, add the following to your code:
Code (Javascript)
Select All
var Shape = MindFusion.Diagramming.Shape; 



If you want to access a node's shape id, you can handle the nodeCreated event and get it then:
Code (Javascript)
Select All
diagram.addEventListener(MindFusion.Diagramming.Events.nodeCreated, function (sender, args) {
    var node = args.getNode();
    if (!MindFusion.AbstractionLayer.isInstanceOfType(MindFusion.Diagramming.ShapeNode, node))
        return;
    var shapeId = node.getShape().getId();
    // Continuecode logic with the shape id ...
}); 



Regards,
Lyubo
« Last Edit: Dec 3rd, 2018 at 9:44am by Lyubo »  
Back to top
 
IP Logged
 
oxzorxxo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Nov 26th, 2018
Re: how to set node height if
Reply #4 - Dec 6th, 2018 at 7:48am
Print Post  
thank you ...
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint