Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to override base custom behavior (canvas mode)? (Read 3910 times)
CrushJelly
Junior Member
**
Offline


I Love MindFusion!

Posts: 59
Joined: Oct 20th, 2016
How to override base custom behavior (canvas mode)?
Dec 8th, 2016 at 8:41am
Print Post  
Hey, so there is my question:

Can I override base custom behavior?, because in the Silverlight there is property CustomBehavior, but in the WebForms, there is no such property.

If it is not possible to override, then how can I make disabled node resizing, just selection and drawLinks?
« Last Edit: Dec 8th, 2016 at 10:14am by CrushJelly »  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: How to override base custom behavior (canvas mode)?
Reply #1 - Dec 8th, 2016 at 10:31am
Print Post  
Hi,

The standard Behavior.DrawLinks lets you select existing items and draw new links. You can disable resizing by setting nodes' EnabledHandles property to AdjustmentHandles.Move value, or by setting their HandlesStyle property to HandlesStyle.MoveOnly.

If you are still using custom link types, you will also need to replace this factory function with one creating your link class instances -

Code
Select All
DrawLinksBehavior.prototype.createLink = function (origin, point)
{
	var link = new mdiag.DiagramLink(this.diagram, origin, point);
	link.originConnection.chooseBestAnchorPoint(point);
	return link;
} 



You could as well create a complete class derived from BehaviorBase. There's not CustomBehavior public API declared as in Silverlight version, but you can still assign your instance to the Diagram.currentBehavior field.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
CrushJelly
Junior Member
**
Offline


I Love MindFusion!

Posts: 59
Joined: Oct 20th, 2016
Re: How to override base custom behavior (canvas mode)?
Reply #2 - Dec 8th, 2016 at 11:11am
Print Post  
Slavcho wrote on Dec 8th, 2016 at 10:31am:
Hi,

The standard Behavior.DrawLinks lets you select existing items and draw new links. You can disable resizing by setting nodes' EnabledHandles property to AdjustmentHandles.Move value, or by setting their HandlesStyle property to HandlesStyle.MoveOnly.

If you are still using custom link types, you will also need to replace this factory function with one creating your link class instances -

Code
Select All
DrawLinksBehavior.prototype.createLink = function (origin, point)
{
	var link = new mdiag.DiagramLink(this.diagram, origin, point);
	link.originConnection.chooseBestAnchorPoint(point);
	return link;
} 



You could as well create a complete class derived from BehaviorBase. There's not CustomBehavior public API declared as in Silverlight version, but you can still assign your instance to the Diagram.currentBehavior field.

Regards,
Slavcho



Can I set Handles color and how can I change Anchor Mark size?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: How to override base custom behavior (canvas mode)?
Reply #3 - Dec 8th, 2016 at 1:55pm
Print Post  
You can assign handles color to diagram.handleBrush from client code. You can specify mark size through AnchorPoint constructor; if you need to change it for a pre-defined pattern, loop over its points array and call AnchorPoint.setSize.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint