Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Mirror Container Node and all Content (Read 1903 times)
benjamin huser
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Oct 23rd, 2014
Mirror Container Node and all Content
Oct 11th, 2016 at 6:13am
Print Post  
Hi there

I was wondering if it is possible to mirror a Container Node and all its content. By mirroring i mean flip it vertically/horizontally.
I tried to achieve this via xaml RenderTransform but it did not seem to have any effect...

Thanks for your help
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3378
Joined: Oct 19th, 2005
Re: Mirror Container Node and all Content
Reply #1 - Oct 11th, 2016 at 9:08am
Print Post  
Hi,

You will have to set symmetric child nodes' positions around the container's center -

Code
Select All
void SetCenter(DiagramNode node, Point center)
{
	var c = node.GetCenter();
	var r = node.Bounds;
	r.X += center.X - c.X;
	r.Y += center.Y - c.Y;
	node.SetBounds(r, false, false);
}

void FlipChildrenX(ContainerNode container)
{
	var bounds = container.Bounds;
	bounds.Y += container.CaptionHeight;
	bounds.Height -=container.CaptionHeight;

	foreach (DiagramNode child in container.SubordinateGroup.AttachedNodes)
	{
		var newChildCenterX = bounds.Right - (child.GetCenter().X - bounds.Left);
		SetCenter(child, new Point(newChildCenterX, child.GetCenter().Y));
	}
} 



A RenderTransform will not affect child nodes because they are not a part of container's visual tree. It's not likely you'd like the result anyway because it also flips the nodes texts making them unreadable. If that's what you are after, you could still apply mirror transform to individual child nodes.

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


I Love MindFusion!

Posts: 26
Joined: Oct 23rd, 2014
Re: Mirror Container Node and all Content
Reply #2 - Oct 11th, 2016 at 10:54am
Print Post  
Hi Slavcho

thanks for the clarification and the sample code.
I will test it right away  Smiley

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