Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Flip Node derived from DiagramNodeAdapter (Read 1289 times)
benjamin huser
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 26
Joined: Oct 23rd, 2014
Flip Node derived from DiagramNodeAdapter
Aug 21st, 2018 at 3:01pm
Print Post  
Hi

we have a requirement that we should allow our nodes that are displayed to be flipped horizontally and/or vertically.
I saw in the docs that this seems possible for ShapeNodes (https://www.mindfusion.eu/onlinehelp/wpfdiagram/index.htm) but our implementation is deriving from the DiagramNodeAdapter where I could not find any flip related property like AllowFlip, FlipX and FlipY.

Did I miss the respective properties or is this currently not possible?

Best Regards
Benjamin
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Flip Node derived from DiagramNodeAdapter
Reply #1 - Aug 23rd, 2018 at 6:23am
Print Post  
Hi,

Properties are only available for ShapeNodes and they apply only to the shape geometries.

If you need to flip all graphic elements of adapted components, you can implement it easily by setting -1 horizontal or vertical scale through their RenderTransform. If you need it only for some parts (say keep text and icons in straight direction), you might have to reorganize your components a bit. E.g. create flippable-graphics container for some graphics elements and unflippable one, and apply the scale transform on former.

If you need to let users flip interactively, you will have to override the UpdateModify method. The ShapeNode implementation does this -

Code
Select All
base.UpdateModify(current, ist);

if (allowFlip && ist.AdjustmentHandle.IsResizeHandle() &&
	ist.OriginalStates.ContainsKey(this))
{
	var state = (ShapeNodeState)ist.OriginalStates[this];
	bool oldFlipX = flipX;
	bool oldFlipY = flipY;
	flipX = ist.negativeWidth ?
		!state.FlipX : state.FlipX;
	flipY = ist.negativeHeight ?
		!state.FlipY : state.FlipY;
	if (flipX != oldFlipX || flipY != oldFlipY)
		UpdateShapePoints();
} 



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