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 sc = ConvertToScreenCoordinates (new Point (0, 0)); var direction = args.Event.Direction.ToXwtValue (); var a = new MouseScrolledEventArgs ((long) args.Event.Time, args.Event.XRoot - sc.X, args.Event.YRoot - sc.Y, direction); ApplicationContext.InvokeUserCode (delegate { EventSink.OnMouseScrolled(a); }); if (a.Handled) args.RetVal = true; }
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; }
protected override void OnMouseScrolled(MouseScrolledEventArgs args) { base.OnMouseScrolled(args); if (isEditMode) { mousePosition = new Point(args.X, args.Y); QueueDraw(); if (Keyboard.CurrentModifiers.HasFlag(ModifierKeys.Control) || Keyboard.CurrentModifiers.HasFlag(ModifierKeys.Command)) { if (args.Direction == ScrollDirection.Up) { pointerSize++; } else { pointerSize--; } args.Handled = true; } } }
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; }
public virtual bool OnMouseScrolled(MouseScrolledEventArgs args, PlotCanvas pc) { return false; }
/// <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); }
protected override void OnMouseScrolled(MouseScrolledEventArgs args) { //base.OnMouseScrolled(args); initialScrollPosition = Point.Zero; if (args.Direction == ScrollDirection.Down) { Scale(0.9); } else { Scale(1.1); } args.Handled = true; }
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); }
/// <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()); }
/// <summary> /// Resize preview image on scrolling /// </summary> /// <param name="e">Event args</param> private void OnPreviewZoom(MouseScrolledEventArgs e) { if (scanView != null) { if (e.Direction == ScrollDirection.Down) { scanView.Scale(0.9); } else { scanView.Scale(1.1); } } e.Handled = true; }
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; } }