private void WidgetMouseWheelHandler(object sender, MouseWheelEventArgs e) { mouseScrollCumulation += e.Delta; int jumps = mouseScrollCumulation / 120; mouseScrollCumulation %= 120; var p = e.GetPosition(Widget); Context.InvokeUserCode(delegate { for (int i = 0; i < jumps; i++) { var a = new MouseScrolledEventArgs(e.Timestamp, p.X, p.Y, ScrollDirection.Up); eventSink.OnMouseScrolled(a); if (a.Handled) { e.Handled = true; } } for (int i = 0; i > jumps; i--) { var a = new MouseScrolledEventArgs(e.Timestamp, p.X, p.Y, ScrollDirection.Down); eventSink.OnMouseScrolled(a); if (a.Handled) { e.Handled = true; } } }); }
/// <summary> /// Creates the mouse wheel event arguments. /// </summary> /// <param name="args">The scroll event args.</param> /// <returns>Mouse event arguments.</returns> public static OxyMouseWheelEventArgs ToOxyMouseWheelEventArgs(this MouseScrolledEventArgs args) { return(new OxyMouseWheelEventArgs { Delta = args.Direction == ScrollDirection.Down ? -120 : 120, Position = new ScreenPoint(args.X, args.Y), ModifierKeys = OxyModifierKeys.None }); }
/// <summary> /// Called when the mouse wheel is scrolled. /// </summary> /// <param name="args">An instance that contains the event data.</param> protected override void OnMouseScrolled(MouseScrolledEventArgs args) { base.OnMouseScrolled(args); if (args.Handled) { return; } args.Handled = ActualController.HandleMouseWheel(this, args.ToOxyMouseWheelEventArgs()); }
protected override void OnMouseScrolled(MouseScrolledEventArgs args) { bool modified = false; foreach (Interaction interaction in plotCanvas.interactions) { modified |= interaction.OnMouseScrolled(args, plotCanvas); } CheckForRedraw(modified); }
void HandleScrollEvent(object o, Gtk.ScrollEventArgs args) { var direction = args.Event.Direction.ToXwtValue(); var a = new MouseScrolledEventArgs((long)args.Event.Time, args.Event.X, args.Event.Y, direction); ApplicationContext.InvokeUserCode(delegate { EventSink.OnMouseScrolled(a); }); if (a.Handled) { args.RetVal = true; } }
private void KFileList_MouseScrolled(object sender, MouseScrolledEventArgs e) { switch (e.Direction) { case ScrollDirection.Up: VScroll.Value--; break; case ScrollDirection.Down: VScroll.Value++; break; } VScroll_ValueChanged(null, null); }
void HandleScrollEvent(object o, Gtk.ScrollEventArgs args) { var sc = ConvertToScreenCoordinates(new Point(0, 0)); var direction = Util.ConvertScrollDirection(args.Event.Direction); var a = new MouseScrolledEventArgs((long)args.Event.Time, args.Event.XRoot - sc.X, args.Event.YRoot - sc.Y, direction); Toolkit.Invoke(delegate { EventSink.OnMouseScrolled(a); }); if (a.Handled) { args.RetVal = true; } }
protected override void OnMouseScrolled(MouseScrolledEventArgs args) { var alloc = Bounds; if ((args.Direction == ScrollDirection.Left || args.Direction == ScrollDirection.Right) && hScrollBar.Visible) { Hadjustment.AddValueClamped(args.Direction == ScrollDirection.Right ? 10 : -10); } if ((args.Direction == ScrollDirection.Up || args.Direction == ScrollDirection.Down) && vScrollBar.Visible) { Vadjustment.AddValueClamped(args.Direction == ScrollDirection.Down ? 10 : -10); } base.OnMouseScrolled(args); }
/// <summary> /// Mouse Scroll (wheel) method for PlotZoom interaction /// </summary> public override bool OnMouseScrolled(MouseScrolledEventArgs args, PlotCanvas pc) { double proportion = 0.1 * Sensitivity; // use initial zoom of 10% double focusX = 0.5, focusY = 0.5; // default focus point double direction = 1; if (args.Direction == ScrollDirection.Down) { direction = -1; } // Zoom direction is +1 for Up/ZoomIn, or -1 for Down/ZoomOut proportion *= -direction; // delete previous focusPoint drawing pc.Canvas.QueueDraw(focusRect); Rectangle area = pc.PlotAreaBoundingBoxCache; if (area.Contains(args.X, args.Y)) { focus.X = args.X; focus.Y = args.Y; focusX = (double)(args.X - area.Left) / (double)area.Width; focusY = (double)(area.Bottom - args.Y) / (double)area.Height; } // Zoom in/out for all defined axes pc.CacheAxes(); pc.ZoomXAxes(proportion, focusX); pc.ZoomYAxes(proportion, focusY); double x = focus.X - 32; double y = focus.Y - 32; focusRect = new Rectangle(x, y, 64, 64); // draw new focusRect pc.Canvas.QueueDraw(focusRect); return(true); }
private void OnCanvasMouseScroll(object sender, MouseScrolledEventArgs e) { int modifier; switch (e.Direction) { case ScrollDirection.Up: modifier = -1; break; case ScrollDirection.Down: modifier = 1; break; default: modifier = 0; break; } SetScrollbarValue(scrollbar.Value + scrollbar.StepIncrement * modifier); }
void HeavyScroller_MouseScrolled(object sender, MouseScrolledEventArgs e) { switch (e.Direction) { case ScrollDirection.Down: ScrollTo(OffsetY - 10); return; case ScrollDirection.Up: ScrollTo(OffsetY + 10); return; case ScrollDirection.Right: ScrollTo(null, OffsetX + 10); return; case ScrollDirection.Left: ScrollTo(null, OffsetX - 10); return; } }
void HandleMouseScrolled(object sender, MouseScrolledEventArgs e) { var msg = "Scrolled " + e.Direction; int incrUpDown = 0; if (e.Direction == ScrollDirection.Up) { incrUpDown++; } else if (e.Direction == ScrollDirection.Down) { incrUpDown--; } if (sender == la) { msg += " " + (laScrollCnt += incrUpDown); resLa.Text = msg; } if (sender == te) { resTe.Text = msg; } if (sender == spn) { msg += " " + (spnScrollCnt += incrUpDown); resSpn.Text = msg; } if (sender == btn) { msg += " " + (btnScrollCnt += incrUpDown); resBtn.Text = msg; } if (sender == canvas) { msg += " " + (canvasScrollCnt += incrUpDown); resCanvas.Text = msg; } Console.WriteLine("[" + sender + "] " + msg); }
private void WidgetMouseWheelHandler(object sender, MouseWheelEventArgs e) { mouseScrollCumulation += e.Delta; int jumps = mouseScrollCumulation / 120; mouseScrollCumulation %= 120; var p = e.GetPosition(Widget); Context.InvokeUserCode (delegate { for (int i = 0; i < jumps; i++) { var a = new MouseScrolledEventArgs(e.Timestamp, p.X, p.Y, ScrollDirection.Up); eventSink.OnMouseScrolled(a); if (a.Handled) e.Handled = true; } for (int i = 0; i > jumps; i--) { var a = new MouseScrolledEventArgs(e.Timestamp, p.X, p.Y, ScrollDirection.Down); eventSink.OnMouseScrolled(a); if (a.Handled) e.Handled = true; } }); }
public virtual bool OnMouseScrolled(MouseScrolledEventArgs args, PlotCanvas pc) { return(false); }
protected override void OnMouseScrolled(MouseScrolledEventArgs args) { base.OnMouseScrolled(args); List.CanvasMouseScrolled(args); }