You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, October 3rd 2011, 9:43am

Changing default keys for zoom in/out etc..

I am looking to change the zoom in key (command) to the spacebar. is this possible? I figure it is in the .swf file, and can not figure out see the code.

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

2

Monday, October 3rd 2011, 3:41pm

look at the documentation page for the onkeydown event and find the correct key code for space bar. just replicate the action that is tied to the zoom in button in that event.

3

Monday, October 3rd 2011, 10:32pm

This is good for enabling the spacebar to function but I can't see a way to actually change the command for the "command" key.

All i can think is something that would be like

onkeydown(control.command,off)

Thanks VN2011 for the help

Tuur

Sage

Posts: 3,173

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

4

Tuesday, October 4th 2011, 2:12am

did you try

if(keycode == 32, action(zoom));

but also

if(keycode == 17, action(do nothing));

?

hope it helps

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

5

Wednesday, October 5th 2011, 4:36pm

Hi,

right, with the onkeydown, onkeyup and the keycode custom key actions can be defined,

but the default zooming keys can be changed here:
http://krpano.com/docu/xml/#control.keycodesin
http://krpano.com/docu/xml/#control.keycodesout

the keycode for space is 32,

btw - to find out the key codes from keys add that code in the xml:

Source code

1
<events onkeydown="showlog(); trace('keycode=',keycode);" />


and to add the space-key for zooming-in add that code in the xml:

Source code

1
<control keycodesin=""16,65,107,32" />


best regards,
Klaus

6

Wednesday, October 5th 2011, 11:40pm

Klaus and Tuur, Thank You!

This works, unfortunately my goal was to make refreshing the page possible by hitting Command R, but this seems to still be disabled even though the command key is no longer a zoomout key. any thoughts, or is this just not possible?

Thanks for the help everyone.

7

Saturday, October 8th 2011, 12:07pm

Hi,

key combinations often return special key codes,

try to find out if your combination returns a special value:

Source code

1
<events onkeydown="showlog(); trace('keycode=',keycode); " />


alternatively you can try to store the information is a key is pressed or released in variables and check for them,
e.g. this code checks if the A and B key are pressed together:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<events onkeydown="keydown()" onkeyup="keyup()" />
	
<action name="keydown">
  trace('keydown - ',keycode);
  if(keycode == 65, set(key_a_down,true));
  if(keycode == 66, set(key_b_down,true));
  if(key_a_down, if(key_b_down, trace('key A and B pressed')));
</action>
	
<action name="keyup">
  trace('keyup - ',keycode);
  if(keycode == 65, set(key_a_down,false));
  if(keycode == 66, set(key_b_down,false));
</action>


best regards,
Klaus

Similar threads