Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Canvas width issue when adding node in the canvas,canvas width changed (Read 1550 times)
reshma
Junior Member
**
Offline


I Love MindFusion!

Posts: 91
Joined: Jan 16th, 2018
Canvas width issue when adding node in the canvas,canvas width changed
Jun 3rd, 2020 at 11:54am
Print Post  
i have one div and that div width is as per  resolution and dynamically i am setting that div width to canvas ,but when i am dragging node on last point of canvas ,width get's increased that i do not want .In this case i do not want to allow add node in the canvas.
how to do this?

basically i want to add node only with current width not allow to change the width after adding node.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Canvas width issue when adding node in the canvas,canvas width changed
Reply #1 - Jun 3rd, 2020 at 11:58am
Print Post  
try Diagram.setAutoResize(AutoResize.None);
  
Back to top
 
IP Logged
 
reshma
Junior Member
**
Offline


I Love MindFusion!

Posts: 91
Joined: Jan 16th, 2018
Re: Canvas width issue when adding node in the canvas,canvas width changed
Reply #2 - Jun 5th, 2020 at 11:10am
Print Post  
At the starting i am getting below width,
For diagram
c.Rect {x: 0, y: 0, width: 210, height: 297, transform: M…n.D…g.Matrix, …}
and Canvas width set automatically to 793
Please let me know the calculation

In my case i have to apply canvas width to as per screen resolution but i also have to apply width to diagram on which calculation i have to assign,
eg.
suppose i have below diagram,
this.diagram = MindFusion.Diagramming.Diagram.create($('#diagram')[0]);
#diagram is my canvas
if i added
this.diagram.setBounds(new Rect(bounds.x, bounds.y, width=1394, bounds.height));
then
canvas width automatically set to 5268

Please let me know i want canvas width also 1394

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Canvas width issue when adding node in the canvas,canvas width changed
Reply #3 - Jun 5th, 2020 at 11:32am
Print Post  
You can convert pixels to diagram units using clientToDoc method, e.g. see https://mindfusion.eu/Forum/YaBB.pl?num=1536018389/6#6

You could as well change your MeasureUnit to pixels, but that will require adjusting various default values of other properties.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint