PDA

View Full Version : Mouse zoom


Renato Lima
10-08-2010, 12:58 PM
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: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:


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