Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Display menu when clicked on node (Read 2987 times)
krantir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Jan 25th, 2012
Display menu when clicked on node
Feb 7th, 2012 at 2:25pm
Print Post  
Hi,
I am trying to display a menu when clicked on node at the mouse clicked position. When i use the node clicked event i am capturing coordinates using
args.mousePosition["x"]
args.mousePosition["y"] but that is not the desired position.
I have my menu in the div tag.
Can you please suggest a better way to get the coordinates when clicked on a node to display the menu. Iam able to get the correct coordinates using canvas click event
  var x = e.pageX;  var y = e.pageY;  var o = {left: x,
top: y };  $("#maindiv").offset(o);

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Display menu when clicked on node
Reply #1 - Feb 7th, 2012 at 3:55pm
Print Post  
Hi,

You could call diagram.docToClient to convert mousePosition to canvas-relative pixel coordinates. Then if you need them relative to the page, add canvas.offsetLeft/Top to the point. Alternatively, store the pageX/Y values from the last mouseMove/mouseDown handler and use them in nodeClicked.

Perhaps we should add a rawEvent member to NodeEventArgs, similar to what the MS.Ajax library does for mouse events - that will let you inspect the original pageX/Y or clientX/Y values. I'm not sure if our developers will be able to make it for v1.3 though, we are very close to release now.

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