Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Right Click Position When Zoomed (Read 3886 times)
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Right Click Position When Zoomed
Sep 2nd, 2014 at 2:53pm
Print Post  
When a user right clicks in the diagram when it is zoomed, the mouse position does not match the coordinates of the diagram.

Code
Select All
Point p = context.MousePosition;
pastePoint = new Point(zoomFact * p.X, zoomFact * p.Y);

DiagramNode clickedItem3 = currentDiagram.GetNodeAt(pastePoint, false, true);
CustomDiagramLink clickedItem4 = (CustomDiagramLink)currentDiagram.GetLinkAt(pastePoint, 5, true); 


I tried using the zoom factor as a modifier to find the object on the diagram but that doesn't work either. The original version of this method just used the mouse position as the pastePoint and that works fine when not zoomed. How should I handle finding the object that is right clicked so that the context menu can be modified depending on what the user clicks on.

PS this is a deployed application and the version can't be changed. It is currently using version 2.3.0.16766.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Right Click Position When Zoomed
Reply #1 - Sep 3rd, 2014 at 6:11am
Print Post  
Is that code from a Diagram.Clicked event handler? The EventArgs.MousePosition should be scaled accordingly then for ZoomFactor.

If context is your own object that stores position reported by Silverlight's Control.MouseRightButton* events, change its value to MouseButtonEventArgs.GetPosition(diagram.DoumentPlane). If you prefer multiplying the coordinates yourself, note that ZoomFactor specifies percents, so you might also have to divide the result by 100.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: Right Click Position When Zoomed
Reply #2 - Sep 5th, 2014 at 1:55pm
Print Post  
It was not in a click handler (Was in the menu open event handler) but your suggestion allowed me to set the value before we get to that handler and that did work for me. Thanks for the suggestion.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint