Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic JDiagram focus handling (Read 7519 times)
Jasef
YaBB Newbies
*
Offline



Posts: 26
Joined: Jul 17th, 2011
JDiagram focus handling
Jul 23rd, 2015 at 9:42pm
Print Post  
Hi,

I'm currently having behaviour issues with how focus is handled for overlapping nodes in a diagram.

Scenario (refer to attached image):
I have two nodes that have an overlap. (See 1)
I give focus to node 1 (See 2)
I click in the overlapping area (See star in 2)
Node 2 becomes the new selected node (See 3)

The same applies if you want to create a link between node 1 and a node 3.
It seems to use the z-order.
Can this be changed to prioritize selected nodes.


Cheers,
Jasef.
  

focus.png ( 8 KB | 226 Downloads )
focus.png
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: JDiagram focus handling
Reply #1 - Jul 24th, 2015 at 9:52am
Print Post  
Hi,

For time being add this to top of getNodeAt(Point2D) and getItemAt(Point2D, boolean, boolean) methods in Diagram:

Code
Select All
if (selectionOnTop)
{
	node = getSelectedNodeAt(point);
	if (node != null)
		return node;
} 



and

Code
Select All
DiagramNode getSelectedNodeAt(Point2D point)
{
	List<DiagramNode> selectedNodes = new ArrayList<DiagramNode>(selection.getNodes());
	java.util.Collections.reverse(selectedNodes);
	for (DiagramNode n : selectedNodes)
		if (n.containsPoint(point) && isItemInteractive(n))
			return n;

	return null;
} 



We might not keep it there for official release but move to hit-testing methods in behavior classes.

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



Posts: 26
Joined: Jul 17th, 2011
Re: JDiagram focus handling
Reply #2 - Jul 26th, 2015 at 8:08pm
Print Post  
That does the job.


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