Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Selection bounds (Read 1820 times)
j poz
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
Selection bounds
Mar 7th, 2014 at 6:47pm
Print Post  
How do I get the /actual/ bounds of a selection? What I want to figure out is it a container's bounds are inside of a selection's bounds, but the selection's bounds don't return the current visible selection, instead they return the maximum bounds of all selected items..
  
Back to top
 
IP Logged
 
j poz
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
Re: Selection bounds
Reply #1 - Mar 7th, 2014 at 6:51pm
Print Post  
Or more generally... Selection.IncludeItemsIfIntersect is true, but I don't want this to apply to Containers, so I am trying to deselect them in the SelectionChanged event but don't have the bounds of the user-drawn selection...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Selection bounds
Reply #2 - Mar 7th, 2014 at 8:24pm
Print Post  
When SelectionChanged is raised, Selection.Bounds is already updated to match selected items. Selection.Bounds should correspond to the currently drawn rectangle in NodeSelecting event handler. So instead of deselecting containers from  SelectionChanged, try setting e.Cancel = true in NodeSelecting:

Code
Select All
private void diagram_NodeSelecting(object sender, NodeValidationEventArgs e)
{
	var ctr = e.Node as ContainerNode;
	if (ctr != null && !diagram.Selection.Bounds.Contains(ctr.Bounds))
		e.Cancel = true;
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint