Displaying the zoom level

  • I'm trying to add some simple code to display the current zoom level when the user zooms in or out. I'm simply capturing the mousewheel event and then converting the view.fov to a percentage to display. My problem is that in the mousewheel event the fov will be the starting fov instead of the final fov. For example if I start out with an fov of 120 and then zoom out, the code will display an fov of 120 even though it will end up higher like 125. Is there any way to determine what the value of fov will be after the transition of zooming finishes? I looked at the wheeldata and wheeldata_raw variables but I'm not sure how you can convert these numbers into the actual change in the fov.

    Any help would be much appreciated.

    Thanks!

  • Thanks for the reply. I think I could use the onviewchanged event as mentioned in that thread to make it work. This isn't exactly what I'm after though as if I do that method, when I zoom in it would show, 100% 101% 102%... and change constantly as the event is fired until reaching its final value. Ideally I would want it to immediately display the final zoom value so say 105% instead repeatedly updating after a zoom. Is there any way I can get that final zoom value beforehand? I really just want to mimic what krpano is doing internally to determine what the resulting fov will be after a mousewheel event.

  • Doesn't krpano have to determine how much to change the fov every time there is a mousewheel event? The reason I have to use the mousehweel event is that I only want the value to display when the user zooms in or out and then fade out after a second, similar to what happens when you zoom in or out in your browser. However, if that's not possible then I think the method you are both describing is a good compromise. Thanks for the advice!

  • you can combine that...
    have a layer and update the % display value in the viewchanged event
    in the mouse event you only control fading in or out the layer

    edit:
    in the mousewheel event you would have to set a variable, maybe with a time stamp
    and in a separately running renderloop you'd have to constantly check the variable,
    and if it didnt change for some time, fade the layer out.
    possible but quite complex for a fov % value *whistling*

Participate now!

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