Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic RenderTransform does not work on SvgNode. (Read 791 times)
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 118
Joined: Aug 25th, 2022
RenderTransform does not work on SvgNode.
Oct 22nd, 2024 at 11:06am
Print Post  
Hello, MindFusion Team!
It seems that in version 4.0, setting the RenderTransform property on an SvgNode does not affect the rendering of the element. In the previous version, I could change the position, rotation, and scale of the SvgNode using this property, and I would like to see this in the new version as well.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3340
Joined: Oct 19th, 2005
Re: RenderTransform does not work on SvgNode.
Reply #1 - Oct 23rd, 2024 at 10:56am
Print Post  
Hi,

Could you post a sample transform of yours? We are not sure if it will work the same as in v3 if we just bind new item-view's RenderTransform to the node's RenderTransform. We might have to add a new property for a more- local transform instead.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 118
Joined: Aug 25th, 2022
Re: RenderTransform does not work on SvgNode.
Reply #2 - Oct 24th, 2024 at 4:20am
Print Post  
Here I use RenderTransform to apply rotation and scale to my SvgNode
  

RenderTransformIssues.zip ( 438 KB | 29 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3340
Joined: Oct 19th, 2005
Re: RenderTransform does not work on SvgNode.
Reply #3 - Oct 24th, 2024 at 1:54pm
Print Post  
imageNode doesn't show at all if we downgrade this project to v3.9.5, unless also commenting out the imageNode.RenderTransform = matrixTransform assignment.

Anyway we aren't sure we can directly bind to RenderTransform from our new separate item presenters now, and also plan to remove the FrameworkElement base of DiagramItem (v5 when we also remove support for standalone Diagram control), so RenderTransform would disappear then. We'll try to add DiagramItem's own Transform property instead; hopefully it will work for your scenario.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3340
Joined: Oct 19th, 2005
Re: RenderTransform does not work on SvgNode.
Reply #4 - Oct 24th, 2024 at 4:11pm
Print Post  
Please check if the new DiagramItem.Transform property here works for you -

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.1.4-rc4

Since we couldn't see the RenderTransform-ed node with v3 in the test project, we aren't sure if Transform works exactly the same - locality could be different, where the new transform is applied relative to the node-presenter visual created by DiagramView. Anyway if you need to apply some transient transforms or animations, it shouldn't be much trouble to adapt to item-relative ones.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 118
Joined: Aug 25th, 2022
Re: RenderTransform does not work on SvgNode.
Reply #5 - Oct 25th, 2024 at 1:09pm
Print Post  
Here in this demo I use RenderTransform to reflect node horizontally/vertically. I found out that in newer version vertical reflection does not seem to work (if using Transform property)
  

ReflectItems.zip ( 437 KB | 49 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3340
Joined: Oct 19th, 2005
Re: RenderTransform does not work on SvgNode.
Reply #6 - Oct 28th, 2024 at 11:15am
Print Post  
Reflection itself works from what we can see (project with v4 diagram attached), but transform locality is different from RenderTransform. You no longer have to translate by node's origin:

Code
Select All
private void ReflectHorizontally(object sender, RoutedEventArgs e)
{
    var matrixTransform = new MatrixTransform();
    var trs = CreateTRSMatrix(new Vector2(0, 0), rotation: 0, new Vector2(-1, 1));
    matrixTransform.Matrix = new Matrix(trs.M11, trs.M12, trs.M21, trs.M22, trs.M31, trs.M32);

    var imageNode = diagram.Nodes.First();

    imageNode.Transform = matrixTransform;
}

private void ReflectVertically(object sender, RoutedEventArgs e)
{
    var matrixTransform = new MatrixTransform();
    var trs = CreateTRSMatrix(new Vector2(0, 0), rotation: 0, new Vector2(1, -1));
    matrixTransform.Matrix = new Matrix(trs.M11, trs.M12, trs.M21, trs.M22, trs.M31, trs.M32);

    var imageNode = diagram.Nodes.First();

    imageNode.Transform = matrixTransform;
} 



Regards,
Slavcho
Mindfusion
  

ReflectItems_001.zip ( 426 KB | 28 Downloads )
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 118
Joined: Aug 25th, 2022
Re: RenderTransform does not work on SvgNode.
Reply #7 - Dec 13th, 2024 at 10:26am
Print Post  
It seems like Transform property is not reliably working when setting DevFlags.LightweightPresenters to true;
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3340
Joined: Oct 19th, 2005
Re: RenderTransform does not work on SvgNode.
Reply #8 - Dec 16th, 2024 at 8:17am
Print Post  
Transform + LightweightPresenters should work with new build here -

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.1.5-rc2

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 118
Joined: Aug 25th, 2022
Re: RenderTransform does not work on SvgNode.
Reply #9 - Dec 16th, 2024 at 9:08am
Print Post  
Yeah, it works on the new build, thank you!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint