Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Regarding zoom factor (Read 1399 times)
Mukesh
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Nov 25th, 2008
Regarding zoom factor
May 21st, 2009 at 5:15am
Print Post  
In my application, I create Node on the context menu click, basically user's right clicked position we use for creation of new Node. It is working fine in 100% zoom of diagram. However in our application we have 110% default zooming, where when I try to add node by right clicking, it is been created at some distance to the point where right click is made. When I drag diagram to expand it in right and down direction, the more I go right and down........ the more distance I observe between the point where right click is made and the point where the node is created. I want the node creation to happen at the position where right click is made, regardless of the zoom factor.

I use the following code in the context menu item's click handler, to get the position where context menu is created.
Code
Select All
System.Windows.Controls.MenuItem menuItem = sender as System.Windows.Controls.MenuItem;
System.Windows.Controls.ContextMenu menu = menuItem.Parent as System.Windows.Controls.ContextMenu;
Point newPosition = menu.TranslatePoint(new Point(), diagram);
 



Now this newPosition I use to create new node.

Kindly let me know, how I should handle the above situation?
  
Back to top
 
IP Logged
 
Mukesh
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Nov 25th, 2008
Re: Regarding zoom factor
Reply #1 - May 21st, 2009 at 6:48am
Print Post  
I had mailed the same thing to MindFusion support team, and got the instant and perfect solution, here it comes.


Hi Mukesh,

Use the ClientToDoc method to convert from pixels to logical coordinates,
adjusted for the zoom factor and scroll position.

Regards,
Iva
MindFusion


I tried it, it's working as expected.

Thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint