Display hotspots only when zoomed in

  • Is there a simple way to limit hotspots to only show at specific zoom levels? I'm putting together a Gigapixel right now and I'd rather not show the hotspots when the user is fully zoomed out. Just wondering if anyone has done this and has an example. Thanks!

  • I havent tried it but I believe you can use the current field of view https://krpano.com/docu/xml/#view.fov to control a the visible variable so that it changes its value at a threshold of your choice https://krpano.com/docu/xml/#layer.visible .

    Roughly like:

    pardon the edits

    Edited 5 times, last by _Matthias_ (April 23, 2020 at 7:31 PM).

  • Try this code (not tested)

  • Getting this in the console with that code:
    ERROR: js_show_hs - SyntaxError: Unexpected identifier

    I've tried with a basic action to set the visibility, but it doesn't seem to update the status of the hotspot. I'm assuming maybe it's because nothing is reloading.

    Try this code (not tested)

  • I've tried with a basic action to "set" the visibility, but it doesn't seem to update on the fly.

    If you want to dig deeper, as to why your basic action fails to update the hotspot I recommend turning on debugmode, assigning a logkey and spreading some debugvar(varname) or also debugvar("yourstring") here and there so you can see what works and what doesn’t.


    I've tried (and updated) mine above and it works. It may impact rendering performance.

  • Thanks so much! When I used a trace with debug mode enabled, I confirmed my suspicion that since I am using a flat gigapixel, the FOV values were decimals. Once I had the right numbers, it started working as expected. I then added another action prior to the set to loop through all hotspots so that every spot in the scene turns off at the desired zoom level. Works great.

  • tested and works *thumbup*

    Code
    <events name="ev_show_hs" keep="true" onviewchange="show_hs()" />
      <action name="show_hs" scope="local" protect="true">
        for(set(i,0), i LT hotspot.count, inc(i), 
          if(global.view.fov LT 80,
            set(hotspot[get(i)].visible, true);
          ,
            set(hotspot[get(i)].visible, false);
          );
        );  
      </action>

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!