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

Friday, June 1st 2018, 5:07pm

How to unload dynamicaly loaded <style> in Krpano?

Hi there,

How can I unload <style> added to <hotspot> dynamically?

When I assign style to hotspot I use

Source code

1
hotspot.loadstyle( @style_name@);
method, but how can I remove/unload this style without deleting or replacing hotspot itself?

Thanks, looking forwad to get reply from you.
Regards,
Maksim

2

Friday, June 1st 2018, 5:38pm

when a style is applied to an element (i.e. hotspot)
all its attributes are copied to the target, except for attributes already set on the target.
there is no unloadstyle() because it is impossible to know what was set on the original hotspot after this procedure.

but to go back to the original state you could maybe backup and restore your hotspot
something like...

copy(hotspot[example_bak], hotspot[example]);
set(hotspot[example_bak], visible, false);
hotspot[example].loadstyle(style_name);
...
copy(hotspot[example], hotspot[example_bak]);
set(hotspot[example], visible, true);
delete(hotspot[example_bak]);


... completely untested *rolleyes*

3

Wednesday, June 20th 2018, 1:39pm

when a style is applied to an element (i.e. hotspot)
all its attributes are copied to the target, except for attributes already set on the target.
there is no unloadstyle() because it is impossible to know what was set on the original hotspot after this procedure.

but to go back to the original state you could maybe backup and restore your hotspot
something like...

copy(hotspot[example_bak], hotspot[example]);
set(hotspot[example_bak], visible, false);
hotspot[example].loadstyle(style_name);
...
copy(hotspot[example], hotspot[example_bak]);
set(hotspot[example], visible, true);
delete(hotspot[example_bak]);


... completely untested *rolleyes*
Thanks for your suggestion, I did it a little bit different but algorithm is closed to yours. But unfortunetely, when I remove previous hotspot and replace it with new one it blinks for a couple of mileseconds. Do you have any ideas, how can I get rid of this side effect, I mean the blink itself?
Regards,
Maksim