Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic GetItemAt when diagram is zoomed (Read 2472 times)
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
GetItemAt when diagram is zoomed
Mar 1st, 2011 at 9:31pm
Print Post  
I seem to be having an issue getting the object that is clicked on when the diagram is zoomed. This is to pop up a context menu and select the item under the mouse when a user right clicks in the diagram. The following code works fine when not zoomed but does not work if the zoom factor is set to anything other than 100. Is this correct or is there another way?

[code] Double xPos = ((pastePoint.X + xScroll) * (currentDiagram.ZoomFactor / 100)) - xDiagOffset;
Double yPos = ((pastePoint.Y + yScroll) * (currentDiagram.ZoomFactor / 100)) - yDiagOffset;
Point checkPoint = new Point(xPos, yPos);

DiagramItem clickedItem = currentDiagram.GetItemAt(checkPoint, false, true);[/code]

TIA

Don
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: GetItemAt when diagram is zoomed
Reply #1 - Mar 1st, 2011 at 10:33pm
Print Post  
If you have the pastePoint value relative to some Silverlight element, call element.TransformToVisual(diagram.DocumentPlane).Transform(pastePoint) to get the respective diagram coordinates.

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



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: GetItemAt when diagram is zoomed
Reply #2 - Mar 2nd, 2011 at 2:09pm
Print Post  
Can I call this on the diagram? The point I have is relative to the Silverlight application and not the diagram.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: GetItemAt when diagram is zoomed
Reply #3 - Mar 2nd, 2011 at 2:33pm
Print Post  
Try calling it on the Application.Current.RootVisual object.
  
Back to top
 
IP Logged
 
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: GetItemAt when diagram is zoomed
Reply #4 - Mar 3rd, 2011 at 8:50pm
Print Post  
Thanks Stoyo. That does work. Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint