Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Change Button Actions (Read 2047 times)
Davaaron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 12th, 2018
Change Button Actions
Sep 11th, 2018 at 1:48pm
Print Post  
Hi,

how can I bind Panning to the left button and creating new nodes to ALT + left button and keep the CTRL + left for selecting multiple nodes?

(Is there any way I can select nodes which are not detected by the CTRL + left like children of containernodes?)

Thanks in advance.  Smiley
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Change Button Actions
Reply #1 - Sep 11th, 2018 at 4:57pm
Print Post  
Hi,

You can do that by creating a custom BehaviorBase-derived class and assigning its instance to diagram.currentBehavior field, or just replace createController method of default behavior class like this -

Code
Select All
var mdiag = MindFusion.Diagramming;
diagram.getModifierKeyActions().setAlt(
	mdiag.ModifierKeyAction.None);

var createController = mdiag.LinkNodesBehavior.prototype.createController;
mdiag.LinkNodesBehavior.prototype.createController = function (state)
{
	var diagram = this.diagram;

	var kb = mdiag.Keyboard.state;

	if (kb.altKey)
		return createController.apply(this, [ state ]);

	if (kb.ctrlKey)
		return new mdiag.CreateSelectionController(diagram.selection);

	return new mdiag.PanController(diagram);
}; 



The Selection class runs its selectItemsInRect(rect) method when you stop drawing selection lasso, so you could replace Selection.prototype.selectItemsInRect with your own version that calls item.setSelected(true) for the items you want selected.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Davaaron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 12th, 2018
Re: Change Button Actions
Reply #2 - Sep 11th, 2018 at 6:00pm
Print Post  
The following types do not exist
  1. Keyboard
  2. CreateSelectionController
  3. PanController
  4. LinkNodesBehavior


in typescript. Um, are there equivalents?
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Change Button Actions
Reply #3 - Sep 12th, 2018 at 12:56pm
Print Post  
Hi,

We will add those to the definitions file in the following days.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Change Button Actions
Reply #4 - Sep 17th, 2018 at 1:39pm
Print Post  
Hi,

Please find attached the updated definitions file.

Regards,
Lyubo
  

jsdiag_d_ts.zip ( 39 KB | 106 Downloads )
Back to top
 
IP Logged
 
Davaaron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 12th, 2018
Re: Change Button Actions
Reply #5 - Sep 19th, 2018 at 7:06am
Print Post  
Thanks  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint