Sie sind nicht angemeldet.

HansNyb

Profi

  • »HansNyb« ist der Autor dieses Themas

Beiträge: 1 063

Wohnort: Denmark

Beruf: Photographer

  • Nachricht senden

1

Freitag, 31. Dezember 2010, 10:49

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

2

Freitag, 31. Dezember 2010, 11:04

try:

onclick="switch(autorotate.enabled);"

hope it helps.

Tuur *thumbsup*

HansNyb

Profi

  • »HansNyb« ist der Autor dieses Themas

Beiträge: 1 063

Wohnort: Denmark

Beruf: Photographer

  • Nachricht senden

3

Freitag, 31. Dezember 2010, 11:34

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

4

Freitag, 31. Dezember 2010, 13:36

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

and especialy here:

Zitat

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

Profi

  • »HansNyb« ist der Autor dieses Themas

Beiträge: 1 063

Wohnort: Denmark

Beruf: Photographer

  • Nachricht senden

5

Freitag, 31. Dezember 2010, 14:01

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

6

Freitag, 31. Dezember 2010, 15:13

He Hans,

Zitat

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*

7

Freitag, 31. Dezember 2010, 17:24

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

Montag, 3. Januar 2011, 13:37

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:

Quellcode

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

Profi

  • »HansNyb« ist der Autor dieses Themas

Beiträge: 1 063

Wohnort: Denmark

Beruf: Photographer

  • Nachricht senden

9

Montag, 3. Januar 2011, 14:38

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

Montag, 3. Januar 2011, 20:29

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:

Quellcode

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

Profi

  • »HansNyb« ist der Autor dieses Themas

Beiträge: 1 063

Wohnort: Denmark

Beruf: Photographer

  • Nachricht senden

11

Montag, 3. Januar 2011, 21:33

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

12

Montag, 3. Januar 2011, 22:48

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

Anfänger

Beiträge: 20

Wohnort: Oersta, Norway

  • Nachricht senden

13

Samstag, 14. Mai 2011, 23:43

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