Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ControlMouseAction vs ModificationStart problem (Read 3824 times)
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
ControlMouseAction vs ModificationStart problem
Jul 27th, 2009 at 2:54pm
Print Post  
I need AutoHandles behavior - the possibility to move nodes on a first click- click+move does select and instant moving, but if I want to modify some link, that is over a node header or over any other link, focus is switched to underlying control and that something I don't want.
How to do that - instant click+move and not automatic selection of underlying nodes?
thanks

Basically I need onmousedown to cause selection, not mouseover event. Also if any other item is selected and I am clicking on it, no other underlying item should be selected in this case - simple.

Also, is there a method in DiagramView for hittesting if some nodes/links are under current mouse cursor?
Any help will be appretiated.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ControlMouseAction vs ModificationStart proble
Reply #1 - Jul 27th, 2009 at 3:27pm
Print Post  
What happens if you also set HitTestPriority = ZOrder?
  
Back to top
 
IP Logged
 
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
Re: ControlMouseAction vs ModificationStart proble
Reply #2 - Jul 27th, 2009 at 3:47pm
Print Post  
Well, that solved half of my problem, thanks.
The other problem is quite complicated to explain:
Let's have parent node and two child nodes, also two links from parent to child. Both links starts at the same point in parent node. If I select the bottom link an I want to change it's parent location, I cant. Even with ZOrder priority the topmost link is selected?
The ideal priority in my opinion should be
selected objects > objects in z order > bottom

Also SelectionOnTop property is ignored, when I set it to true, strange.


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ControlMouseAction vs ModificationStart proble
Reply #3 - Jul 27th, 2009 at 4:12pm
Print Post  
We'll change the priority for the next release. Now you might try one of the following:

* handle MouseMove and set ModificationStart = SelectedOnly if diagram.ActiveItem.HitTestHandle() returns some handle index at the current mouse position.

or

* set DiagramLink.HandlesStyle = Custom, handle the HitTestHandles event and return -1 if e.Link is not selected but diagram.ActiveItem is under the mouse pointer.
  
Back to top
 
IP Logged
 
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
Re: ControlMouseAction vs ModificationStart proble
Reply #4 - Jul 28th, 2009 at 9:06am
Print Post  
I've tried these methods, but non of them worked. It looks like the other link is pre-selected(diagram.ActiveItem is changed) when mouse cursor reaches some near distance to it, before I even reach the link node.

I guess the right approach is to keep original link selected, when cursor is near, or when calculating proximity to nearest object keep the selected one on the first position.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ControlMouseAction vs ModificationStart proble
Reply #5 - Jul 28th, 2009 at 10:03am
Print Post  
This worked for me:

Code
Select All
private void diagramView_MouseMove(object sender, MouseEventArgs e)
{
	PointF mousePos = diagramView.ClientToDoc(e.Location);
	int activeItemHandle = -1;
	if (diagram.ActiveItem != null)
		diagram.ActiveItem.HitTestHandle(mousePos, ref activeItemHandle);
	diagramView.ModificationStart = activeItemHandle == -1 ?
		ModificationStart.AutoHandles : ModificationStart.SelectedOnly;
}
 



Stoyan
  
Back to top
 
IP Logged
 
Necroman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 49
Joined: Jul 27th, 2009
Re: ControlMouseAction vs ModificationStart proble
Reply #6 - Jul 28th, 2009 at 12:07pm
Print Post  
Well, that helped, thanks Smiley
I didn't used the ClientToDoc transformation before...
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint