WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Mouse zoom (https://forum.worldviz.com/showthread.php?t=3009)

Renato Lima 10-08-2010 12:58 PM

Mouse zoom
 
I am using camera = vizcam.PivotNavigate(center=[0, 2, 2], distance=2.5)

The mouse wheel reduces the zoom factor exponentially as I zoom into some object. How do I make it stop or change this behavior?

farshizzo 10-08-2010 01:18 PM

Create your own class that inherits from PivotNavigate and override the mouse wheel behavior:
Code:

class MyPivotNavigate(vizcam.PivotNavigate):

        def _camMouseWheel(self,e):

                # Compute new distance base on mouse wheel
                dist = self.getDistance() - e.dir

                # Make sure distance does not drop below zero
                dist = max(dist,0.01)

                # Apply new distance
                self.setDistance(dist)

cam = MyPivotNavigate()


kovitch 05-04-2012 08:06 AM

Hi,

Is there a way to override mouse wheel in the Panorama Camera class?

All I want is a Panorama Camera with the zoom in and zoom out capabilities.

Best regards,

Alex.

kovitch 05-04-2012 10:02 AM

Solved. Changing the Field of View is enough for my purposes.

For those who care:

Code:

def onMouseWheel(dir):
        if dir == 1:
                viz.fov(40,1.3333)
        else:
                viz.fov(70,1.3333)
viz.callback(viz.MOUSEWHEEL_EVENT,onMouseWheel)



All times are GMT -7. The time now is 06:47 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC