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, July 20th 2015, 1:59pm

Change gyro button style when gyro is enabled

Hi,



i've got a problem with the gyro-plugin. I'm using it on the mobile version and it's working great. I'm trying to change the style of the gyro button if gyro is enabled. I'm not shure how to do this. I've tried to get the effect with the code below, but i'm not shure where to place the code. At the plugin? Or at the button?

Source code

1
if(plugin[skin_gyro].enabled == true, set(layer[skin_btn_gyro].crop, '128|291|64|64'));"





It would be great if someone could help me!

Posts: 1,852

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Monday, July 20th 2015, 4:52pm

Source code

1
2
3
4
5
6
7
<plugin name="gyro" devices="html5" keep="true"
        url="gyro2.js" 
        enabled="true"
        sensor_mode="1"
        onavailable="set(layer[skin_btn_gyro].crop, '128|291|64|64');"
        onunavailable=""
        />
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Monday, July 20th 2015, 9:01pm

Hi,

thanks for your help, but this was not what i was looking for. I would like to change the style of the button only when the plugin is enabled, not when it is available. The goal is to show the user whether the plugin is turned on or off. Any idea how to do this?

Posts: 1,852

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

4

Tuesday, July 21st 2015, 12:07am

Source code

1
2
3
4
5
6
7
8
<plugin name="gyro" devices="html5" keep="true"
        url="gyro2.js" 
        enabled="true"
        sensor_mode="1"
        onavailable=""
        onunavailable=""
        />
<layer name="skin_btn_gyro" onclick="switch(layer[gyro].enabled;switch(layer[skin_btn_gyro].crop, '128|291|64|64|other4cropvalues');"


You're starting to get into programming territory. It's helpful here to look at all the examples in the examples folders to see how things work.

Switch works by keeping track of the arguments in the function and what the current value is vs the order.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

5

Tuesday, July 21st 2015, 12:35pm

Hi,

thanks for your help. I think you did not get my problem. I am using the gyro button like in the examples. When you are viewing the examples and you activate the gyro plugin by clicking on the button, the gyro plugin gets enabled but the stlye of the button doesn't change. To improve the usability i would like to show the user that the plugin is activated by changing the style of the button. Is this possible?

Posts: 1,852

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

6

Tuesday, July 21st 2015, 7:00pm

To improve the usability i would like to show the user that the plugin is activated by changing the style of the button. Is this possible?


How did the above not do exactly this?

Just about anything is possible with krpano.

This tour works as you described. When you click the gyro, the crop changes.

http://www.seeit360.com/360-virtual-tour…ing-panama-city
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

7

Tuesday, July 21st 2015, 9:42pm

Hi,

i'm sorry! Actually i din't got your answer. Now i got it and it's working great!

Thank you so much :-)

8

Tuesday, August 25th 2015, 4:58pm

Do I Have Something Wrong?

I like this idea. Tried to implement it, but it doesn't seem to work for me.
I'm using it to change the appearance of a Rotate On/Off icon, instead of the gyro.

The rotation does switch on/off, but the icon does not change.

Does anyone see an error in the code? It looks good to me. Thanks.



Source code

1
2
<layer name="skin_btn_rotate"       style="skin_base|skin_glow" crop="0|510|64|64" align="left"    keep="true"    x="90"   y="0"  scale="0.55" onclick="switch
(autorotate.enabled); switch(layer[skin_btn_rotate].crop, '0|510|64|64|64|510|64|64'); "  />

Posts: 1,852

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

9

Tuesday, August 25th 2015, 5:00pm

onclick="switch
(autorotate.enabled); switch(layer[skin_btn_rotate].crop, '0|510|64|64|64|510|64|64'); "



Source code

1
2
onclick="switch
(autorotate.enabled); switch(layer[skin_btn_rotate].crop, '0|510|64|64','64|510|64|64'); "
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

10

Tuesday, August 25th 2015, 5:29pm

Yep, that does it!
Thank you.

v