Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Node selection behaviour (Read 4939 times)
dittu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 20
Joined: Feb 6th, 2015
Node selection behaviour
Apr 17th, 2015 at 7:02am
Print Post  
Hi Stoyo,

Can you please help me out on following duagramming issues:

1.) Is there an anyway to handle click event on canvas and not on node, as onnodeclicked event gets fired when node is selected, clicking on canvas, deselects that node. So, either I need is onnode deselect event or on click on canvas but not on other node?

2.) I have selected  "SelectOnly" Behaviour, how can I get hand cursor on mouseover of nodes?

3.) On selection, I want to change the colour of AdjustmentHandles which appear. Is there a way to do so?

Thanks a lot in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Node selection behaviour
Reply #1 - Apr 17th, 2015 at 7:41am
Print Post  
Hi,

Quote:
1.) Is there an anyway to handle click event on canvas and not on node, as onnodeclicked event gets fired when node is selected, clicking on canvas, deselects that node. So, either I need is onnode deselect event or on click on canvas but not on other node?


There are events raised both for diagram-click and deselect node actions:

Code
Select All
var Events = MindFusion.Diagramming.Events;

diagram.addEventListener(Events.nodeDeselected, function (sender, args)
{
	console.log("node deselected");
});

diagram.addEventListener(Events.clicked, function (sender, args)
{
	console.log("diagram clicked");
}); 



You can find all supported events listed here:
http://www.mindfusion.eu/onlinehelp/jsdiagram/index.htm?T_MindFusion_Diagramming...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Node selection behaviour
Reply #2 - Apr 17th, 2015 at 7:53am
Print Post  
Quote:
2.) I have selected  "SelectOnly" Behaviour, how can I get hand cursor on mouseover of nodes?


Try this:

Code
Select All
var SelectOnlyBehavior = MindFusion.Diagramming.SelectOnlyBehavior;
SelectOnlyBehavior.prototype.setMouseCursor = function (point)
{
	var node = this.diagram.getNodeAt(point);
	return node ? "pointer" : "default";
}  



Quote:
3.) On selection, I want to change the colour of AdjustmentHandles which appear. Is there a way to do so?


Set the Diagram.handleBrush field:
diagram.handleBrush = '#4488CC';

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


I Love MindFusion!

Posts: 20
Joined: Feb 6th, 2015
Re: Node selection behaviour
Reply #3 - Apr 23rd, 2015 at 11:21am
Print Post  
Thanks Stoyo, everything worked.
But in case of Adjustment Handler on Chrome, sometimes (initially) I'm getting distorted circular handlers after some clicks here and there those get converted to square ones. Is this a know issue or any kind of workaround?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Node selection behaviour
Reply #4 - Apr 23rd, 2015 at 4:28pm
Print Post  
There are round handles drawn for nodes with HandlesStyle.RoundAndSquare or for some control points of Bezier links, so you could see them change if you set node.HandlesStyle or link.Shape properties from click handlers. I can't see any distortions in Chrome though, could you attach a screenshot?
  
Back to top
 
IP Logged
 
dittu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 20
Joined: Feb 6th, 2015
Re: Node selection behaviour
Reply #5 - Apr 24th, 2015 at 8:48am
Print Post  
Hi Stoyo,

PFA AdjustmentHandlers getting changed automatically.

Thanks
  

DifferentAdjustmentHandlers.png ( 11 KB | 168 Downloads )
DifferentAdjustmentHandlers.png
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Node selection behaviour
Reply #6 - Apr 24th, 2015 at 6:07pm
Print Post  
Hi,

I was able to reproduce this after setting node's StrokeDashStyle to non-solid style. Apparently the handles rendering code isn't resetting context's LineDash before drawing, and if handles happen to draw immediately after dashed border, they are rendered dashed too (even if your node's pen is set to "transparent"). So you could either set StrokeDashStyle to Solid, or fix the rendering code like this for time being:

Code
Select All
var HandleUtils = MindFusion.Diagramming.HandleUtils;
var originalDrawHandles = HandleUtils.drawSquareHandles;
HandleUtils.drawSquareHandles = function (context, item)
{
	if (context.setLineDash)
		context.setLineDash([]);
	originalDrawHandles.apply(null, [context, item]);
}; 



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