Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic when adding node in diagram diagram goes in top direction i have to restrict diagram to go top (Read 330 times)
reshma
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 48
Joined: Jan 16th, 2018
when adding node in diagram diagram goes in top direction i have to restrict diagram to go top
Jun 25th, 2020 at 12:38pm
Print Post  
Hi
I have diagram and adding container node in diagra when i am adding node in diagram diagram goes on top direction .
i have to restrict to go top direction please suggest.
  

Top_boundary.png ( 40 KB | 13 Downloads )
Top_boundary.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 2279
Joined: Oct 19th, 2005
Re: when adding node in diagram diagram goes in top direction i have to restrict diagram to go top
Reply #1 - Jun 26th, 2020 at 6:17am
Print Post  
Hi,

Try this if you need to prevent containers growing past diagram top, or switch to the commented this.bounds checks to prevent growing upwards altogether -

Code
Select All
ContainerNode.prototype.resizeToFitChildren = function (allowShrink, margin)
{
	var rect = this.getContentBounds(true);
	if (!rect)
		return;

	if (margin === undefined)
		margin = this.margin;

	rect = rect.inflate(margin);
	rect.y -= this.captionHeight;
	rect.height += this.captionHeight;
	if (!allowShrink)
		rect = rect.union(this.bounds);
	//if (rect.y < this.bounds.y)
	if (rect.y < this.parent.bounds.y)
	{
		//var dy = this.bounds.y - rect.y;
		//rect.y = this.bounds.y;
		var dy = this.parent.bounds.y - rect.y;
		rect.y = this.parent.bounds.y;
		rect.height -= dy;
	}
	this.setBoundsWithRules(rect, MindFusion.Diagramming.DiagramMediator.LinkRules);

	if (this.container)
		this.container.onChildModified(this, 0);
}; 



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