Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Selected Node Movement by Directional Keys (Read 1458 times)
khurramdbg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Mar 29th, 2010
Selected Node Movement by Directional Keys
Apr 16th, 2010 at 5:37am
Print Post  
Hi All,

I need the selected nodes on my diagram to move by pressing the directional keys on the keyboard.

The movement should be in sync of the directional key pressed.

Can someone please tell me how to do that
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Selected Node Movement by Directional Keys
Reply #1 - Apr 16th, 2010 at 12:14pm
Print Post  
Hi,

Set KeyDownScript="onKeyDown" for the DiagramView, and add a handler that checks the KeyCode argument:

Code
Select All
function onKeyDown(sender, args)
{
	if (args.getKeyCode() == 37)
	{
		// move left
	}
} 



The codes for left, up, right and down keys are 37, 38, 39 and 40 respectively. Moving selected nodes can be done by calling their getBounds() method, adding some offset to the coordinates of the returned rectangle and passing the modifiect rect to setBounds.

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