Control Zoom in/out

Aug 7, 2014 at 10:11 AM
I can zoom in/out using mouse wheel. But it goes infinity. How to prevent the zoom in/out at a particular position?
IsZoomEnabled option is disabled the zoom in/out, but I want prevent the user from zoom in/out infinitely.
Is there any way to do this...?
Aug 7, 2014 at 11:31 PM
You can try to disabling the zoom (IsZoomEnabled) when the camera is further than a specific value, there is a property that indicates you the Camera Distance. Create an event for the wheel and play with the delta. I'm not sure about this as I've never tried it. Good luck!
Aug 8, 2014 at 6:31 AM
Thanks for the answer, the problem is IsZoomEnabled stops the camera distance then when should we enable the zoom.
we can disable based on the camera movements, once disabled the camera won't move then when that should be enabled.
Aug 8, 2014 at 7:47 AM
I done that using PreviewMouseWheel event of view port 3d (MouseWheel event doesn't trigger on helix view port 3d)
        private void viewPort3D_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (viewPort3D.Camera.LookDirection.Length >= 800 && e.Delta<0)
            {
                e.Handled = true;
            }

            if (viewPort3D.Camera.LookDirection.Length <= 15 && e.Delta > 0)
            {
                e.Handled = true;
            }
        }
Marked as answer by veerammalkumaran on 8/8/2014 at 12:48 AM