You are not logged in.

HansNyb

Professional

  • "HansNyb" started this thread

Posts: 1,063

Location: Denmark

Occupation: Photographer

  • Send private message

1

Friday, December 31st 2010, 10:49am

Autorotate stop/start

I added a button for stopping and starting autorotate.
Found this code.
onclick="switch(autorotate,false,true);invalidatescreen();"

1. Why is the invalidatescreen();" needed for this? It does not work without and I can not see any connection in the documentation at all with autorotate.

2. The autorotate function is added as a global function, but still it starts every time I change pano.
I assumed that by adding it globally I could also control it globally.

If I ad a button with onclick="switch(hotspot.visible);" it works for all scenes so why is not the switch autorotate work for all.


Another thing. When you use the switch for stop/start autorotate it should of course override the wait time set in the Autorotate code but it does not.

Hans

Tuur

Sage

Posts: 3,839

Location: Netherlands

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

  • Send private message

2

Friday, December 31st 2010, 11:04am

try:

onclick="switch(autorotate.enabled);"

hope it helps.

Tuur *thumbsup*

HansNyb

Professional

  • "HansNyb" started this thread

Posts: 1,063

Location: Denmark

Occupation: Photographer

  • Send private message

3

Friday, December 31st 2010, 11:34am

try:

onclick="switch(autorotate.enabled);"

hope it helps.

Tuur *thumbsup*


Thanks. works perfect now. Also without the invalidatescreen();"

Now Klaus can you tell me where in the documentation you can find this. This is very basic settings and should be described very basic also the difference and why it is a difference.

Hans

Tuur

Sage

Posts: 3,839

Location: Netherlands

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

  • Send private message

4

Friday, December 31st 2010, 1:36pm

well hans it's here:
http://www.krpano.com/docu/actions/#switch

and especialy here:

Quoted

When only the variable itself without value parameters will be given, then the variable will be switched between true and false.


also in the example..

Cheers Tuur and all the best for 2011 *thumbsup*

HansNyb

Professional

  • "HansNyb" started this thread

Posts: 1,063

Location: Denmark

Occupation: Photographer

  • Send private message

5

Friday, December 31st 2010, 2:01pm

When only the variable itself without value parameters will be given, then the variable will be switched between true and false.


Does not say anything to me.
And does not explain my actual question. Why is the true/false option only changing it for the viewed pan while the enable is stopping and starting it globally.

Those are the things which has to be explained for us users and it should be done by examples in connection with the autorotate code.

Hans

Tuur

Sage

Posts: 3,839

Location: Netherlands

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

  • Send private message

6

Friday, December 31st 2010, 3:13pm

He Hans,

Quoted

And does not explain my actual question. Why is the true/false option only changing it for the viewed pan while the enable is stopping and starting it globally.


it is not, when you click rotate, that it spins, it stays like that until you say enabled false or switch again, (also in other pano's).. what does the same.
Enabled is the variable..

Tuur *thumbsup*

VN2009

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

7

Friday, December 31st 2010, 5:24pm

onclick="switch(autorotate.enabled);"

yes that means on each click you will toggle the state enabled. if you were do add the editor so you can see the xml you can see that autorotate is off by default then when clickedd you could go back into the xml editor and see that the state has changed to enabled="true" or you could add a trace to that state and it would be reported back to you in the debug dialog

8

Monday, January 3rd 2011, 1:37pm

Hi,
Does not say anything to me.
And does not explain my actual question. Why is the true/false option only changing it for the viewed pan while the enable is stopping and starting it globally.
"autorotate.enabled" is the full name of the setting (variable) that controls if the auto-rotation is enabled or not,
that setting (variable) can have two states (values) - true or false - and when using the "switch" action this setting will automatically switch between this two states,

in your code:

Source code

1
onclick="switch(autorotate,false,true);invalidatescreen();"

you are trying to switch a variable called "autorotate" but such variable doesn't exist directly,

see in the xml reference the "full variable name" entries for the variable names:
http://krpano.com/docu/xml/#autorotate

best regards,
Klaus

HansNyb

Professional

  • "HansNyb" started this thread

Posts: 1,063

Location: Denmark

Occupation: Photographer

  • Send private message

9

Monday, January 3rd 2011, 2:38pm

Well I did not "invent" that code. Got it from an example somewhere.

So you mean that if you should use it that way it should say

onclick="switch(autorotate.enabled ,false,true);invalidatescreen();"

I just want to know how to do it both globally and locally on 1 scene only as the onclick="switch(autorotate.enabled);" only works for all panos.

Hans

10

Monday, January 3rd 2011, 8:29pm

Hi,
So you mean that if you should use it that way it should say

onclick="switch(autorotate.enabled ,false,true);invalidatescreen();"
partially yes, it would work, but the false and true options and invalidatescreen call were not needed,
just:

Source code

1
switch(autorotate.enabled);
would be the best way,


I just want to know how to do it both globally and locally on 1 scene only as the onclick="switch(autorotate.enabled);" only works for all panos.
there is no globally or locally in krpano, you can only change the current state of the auto rotation,
but you can define a own <autorotate> tag for each <scene> with independed settings and when that
scene will be loaded that settings will be applied,

best regards,
Klaus

HansNyb

Professional

  • "HansNyb" started this thread

Posts: 1,063

Location: Denmark

Occupation: Photographer

  • Send private message

11

Monday, January 3rd 2011, 9:33pm

Well the switch(autorotate.enabled);
works for all scenes for me. If I stop the rotation I can load as many panos I want and it will not start until I click the button again.

The other option only stopped it until I load a new pano.

Hans

VN2009

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

12

Monday, January 3rd 2011, 10:48pm

hans if you add this to your onxmlcomplete it will fix the issue you are having. if it is disable when loading a new pano it will be reenabled.

IF(autorotate.enabled == false, switch(autorotate.enabled));

leif

Beginner

Posts: 20

Location: Oersta, Norway

  • Send private message

13

Saturday, May 14th 2011, 11:43pm

people are using skins including a start/stop autorotate button. I want to do it as well.
but why do everyone have to write it from scratch ?
it should be included in defaultskin.

leif