Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic RotationAngle and EnabledHandles (Read 3074 times)
Thomas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 29th, 2010
RotationAngle and EnabledHandles
Jan 17th, 2011 at 2:35pm
Print Post  
It seems that RotationAngle totally mess up the EnabledHandles settings?

I have EnabledHandles = AdjustmentHandles.Move, however if RotationAngle = 90 the handles are still shown correct but they work totally wrong.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: RotationAngle and EnabledHandles
Reply #1 - Jan 17th, 2011 at 2:57pm
Print Post  
If you set EnabledHandles to Move, the resize handles should be disabled and you can only move the node, right? So are you getting something totally wrong when moving rotated nodes?
  
Back to top
 
IP Logged
 
Thomas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 29th, 2010
Re: RotationAngle and EnabledHandles
Reply #2 - Jan 18th, 2011 at 7:53am
Print Post  
Without rotation I have a circle in the middle where I can draw connections from (the remaining "space" is for moving).
With 90 rotation, the circle is still there. But I cannot draw connections from the middle anymore. The drawing/moving hotspots are messed up.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: RotationAngle and EnabledHandles
Reply #3 - Jan 18th, 2011 at 10:01am
Print Post  
Are you using the "EasyMove" HandlesStyle? The following settings work fine in my test project:

shapeNode.HandlesStyle = HandlesStyle.EasyMove;
shapeNode.RotationAngle = 90;
shapeNode.EnabledHandles = AdjustmentHandles.Move;

What other properties have you set on the node?
  
Back to top
 
IP Logged
 
Thomas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 29th, 2010
Re: RotationAngle and EnabledHandles
Reply #4 - Jan 18th, 2011 at 1:45pm
Print Post  
I found that the problem comes with SizeSyncMode.Measure, and because I'm changing the Bounds (I do that to be able to snap-allign it to my other nodes that are 100x80 and not rotated).

This illustrates my problem:

[color=Blue]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MindFusion.Diagramming.Wpf;

namespace MindFusionCase
{

/// <summary>

/// Interaction logic for MainWindow.xaml

/// </summary>

public partial class MainWindow : Window

{


private DiagramNodeAdapter node;



public MainWindow()


{



InitializeComponent();




StackPanel panel = new StackPanel();



Button button = new Button() { Content = "Click" };



button.Click += new RoutedEventHandler(button_Click);



panel.Children.Add(button);



Diagram diagram = new Diagram();



diagram.ModificationStart = ModificationStart.AutoHandles;



diagram.AlignToGrid = true;



diagram.GridSizeX = 20;



diagram.GridSizeY = 20;



panel.Children.Add(diagram);



this.Content = panel;




this.node = new DiagramNodeAdapter(new Canvas() { Width = 65, Height = 80, Background = Brushes.Red });



this.node.EnabledHandles = AdjustmentHandles.Move;



this.node.HandlesStyle = HandlesStyle.EasyMove;



this.node.SizeSyncMode = SizeSyncMode.Measure;



this.node.Bounds = new Rect(0, 0, 65, 80);



diagram.Nodes.Add(this.node);


}



void button_Click(object sender, RoutedEventArgs e)


{



this.node.RotationAngle = 90;



this.node.Bounds = new Rect(this.node.Bounds.X, this.node.Bounds.Y, 100, 80);


}

}
}
[/color]

I've found a workaround for my program. But maybe you can fix it at some point anyway.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: RotationAngle and EnabledHandles
Reply #5 - Jan 19th, 2011 at 8:13am
Print Post  
It seems the control does  not expect node.Bounds to be assigned to when SizeSyncMode is measure, but you should resize the hosted element instead:

Code
Select All
var canvas = (Canvas)node.UIElement;
canvas.Width = 100;
canvas.Height = 80;

node.RotationAngle = 90; 



What happens otherwise is that the hit-testing code continues to use the measured size, but the handle rendering code in the base DiagramNode class uses the value you assign to Bounds. I suppose we can fix this specific case by using the Bounds value instead of the measured size when hit-testing too, but then that might have some unexpected consequences for hosted elements with changing size when you would expect SizeSyncMode to use their current dimensions. And if you need your nodes to have fixed size, maybe you should not use the Measure mode at all...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Thomas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 29th, 2010
Re: RotationAngle and EnabledHandles
Reply #6 - Jan 19th, 2011 at 10:10am
Print Post  
Thanks. You're probably right
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint