private static void HandleZoomByWheelAndCtrl(IPlotView view, OxyMouseWheelEventArgs args, double factor = 1) { var m = new CustomZoomStepManipulator(view, EAxisDescription.Y) { Step = args.Delta * 0.001 * factor }; m.Started(args); }
/// <summary> /// Zooms the view by the mouse wheel delta in the specified <see cref="OxyKeyEventArgs" />. /// </summary> /// <param name="view">The view.</param> /// <param name="args">The <see cref="OxyMouseWheelEventArgs" /> instance containing the event data.</param> /// <param name="factor">The zoom speed factor. Default value is 1.</param> private static void HandleZoomByWheel(IPlotView view, OxyMouseWheelEventArgs args, double factor = 1) { var m = new ZoomStepManipulator(view) { Step = args.Delta * 0.001 * factor, FineControl = args.IsControlDown }; m.Started(args); }
public override bool HandleMouseWheel(IView view, OxyMouseWheelEventArgs args) { var plotView = view as PlotView; if (plotView == null) { return(base.HandleMouseWheel(view, args)); } var model = plotView.ActualModel; if (model == null) { return(base.HandleMouseWheel(view, args)); } if (args.IsControlDown) { if (args.IsShiftDown) { model.DefaultXAxis.Zoom(model.DefaultXAxis.Scale * (args.Delta > 0 ? 1.2 : 0.8)); plotView.InvalidatePlot(false); return(true); } Axis xAxis, yAxis; model.GetAxesFromPoint(args.Position, out xAxis, out yAxis); if (yAxis == null) { return(base.HandleMouseWheel(view, args)); } double y = yAxis.InverseTransform(args.Position.Y); yAxis.ZoomAt(args.Delta > 0 ? 1.2 : 0.8, y); plotView.InvalidatePlot(false); return(true); } if (args.IsShiftDown) { plotView.Model.DefaultXAxis.Pan((double)args.Delta / 3); plotView.InvalidatePlot(false); return(true); } return(base.HandleMouseWheel(view, args)); }