Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to select a node under transparent image node? (Read 3617 times)
shapi
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Aug 3rd, 2012
How to select a node under transparent image node?
Aug 3rd, 2012 at 3:46am
Print Post  
There is a node under a node with transparent image. How to select the node without move away the image node?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to select a node under transparent image node?
Reply #1 - Aug 3rd, 2012 at 7:14am
Print Post  
Set Locked = true for the image node and the diagram will select the node behind it. If you don't wish to lock it, you could change the selection from the NodeClicked event handler if e.Node is the image node.

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


I Love MindFusion!

Posts: 9
Joined: Aug 3rd, 2012
Re: How to select a node under transparent image node?
Reply #2 - Aug 3rd, 2012 at 9:49am
Print Post  
The NodeClicked event cann't return the position of mouse. I need to check if the position of image I clicked is transparent or not.
Any other solution? What about to override DrawNodesBehavior?
Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to select a node under transparent image node?
Reply #3 - Aug 3rd, 2012 at 11:15am
Print Post  
When NodeClicked is raised, e.MousePosition gives you the mouse position in diagram coordinates. You can subtract the origin of e.Node.Bounds from it to find the mouse position relative to the node. Then you should be able to find the position of the image pixel from the node-relative point depending on the ImageAlign value you are using. E.g. if ImageAlign is Stretch, the image pixel should be (image.Width * nodePoint.X / node.Bounds.Width, image.Height * nodePoint.Y / node.Bounds.Height).

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


I Love MindFusion!

Posts: 9
Joined: Aug 3rd, 2012
Re: How to select a node under transparent image node?
Reply #4 - Aug 7th, 2012 at 8:49am
Print Post  
Good.

And how to change the selection of node? When click the transparent part of image, I can unselect it with (e.Node.Selected=false). But how to allow select the node under the transparent image?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to select a node under transparent image node?
Reply #5 - Aug 7th, 2012 at 10:04am
Print Post  
Call GetNodesAt to get a list of all nodes at the specified position. They are sorted in reverse Z order, so the transparent node should be at index 0, and the one below it at index 1. If your application allows stacking many transparent nodes on top of each other, I suppose you could loop over the returned collection until finding a non-transparent node to select.

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


I Love MindFusion!

Posts: 9
Joined: Aug 3rd, 2012
Re: How to select a node under transparent image node?
Reply #6 - Aug 8th, 2012 at 12:52am
Print Post  
Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint