public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // Only start scaling if mouse is inside plot area (excluding axes) Rectangle area = pc.PlotAreaBoundingBoxCache; if (area.Contains(args.Position)) { scaling = true; lastPoint = new Point(args.X, args.Y); if (args.Button == PointerButton.Left) { if (Horizontal) { ; //pc.plotCursor = CursorType.LeftRight; } if (Vertical) { ; //pc.plotCursor = CursorType.UpDown; } if (Horizontal && Vertical) { ; //pc.plotCursor = CursorType.Zoom; } } // evaluate focusPoint about which axis is expanded focusX = (double)(args.X - area.Left) / (double)area.Width; focusY = (double)(area.Bottom - args.Y) / (double)area.Height; } return(false); }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { Rectangle area = pc.PlotAreaBoundingBoxCache; if (dragging && physicalAxis != null) { pc.CacheAxes(); double dX = args.X - lastPoint.X; double dY = args.Y - lastPoint.Y; lastPoint = new Point(args.X, args.Y); double length = physicalAxis.PhysicalLength; if (translateX) { double xShift = -dX / length; pc.TranslateXAxes(xShift); } if (translateY) { double yShift = +dY / length; pc.TranslateYAxes(yShift); } return(true); } return(false); }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { double X = args.X; double Y = args.Y; if (selectionActive) { // note last selection rectangle Rectangle lastSelection = selection; Rectangle bounds = pc.PlotAreaBoundingBoxCache; // clip selection rectangle to PlotArea X = Math.Max(X, bounds.Left); X = Math.Min(X, bounds.Right); Y = Math.Max(Y, bounds.Top); Y = Math.Min(Y, bounds.Bottom); endPoint.X = X; endPoint.Y = Y; selection = FromPoints(startPoint, endPoint); pc.Canvas.QueueDraw(lastSelection); //Console.WriteLine ("Erase: {0} {1} {2} {3} ", lastSelection.X, lastSelection.Y, lastSelection.Width, lastSelection.Height); pc.Canvas.QueueDraw(selection); } return(false); }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { Rectangle area = pc.PlotAreaBoundingBoxCache; if (dragging) { pc.CacheAxes(); double dX = args.X - lastPoint.X; // distance mouse has moved double dY = args.Y - lastPoint.Y; lastPoint = new Point(args.X, args.Y); // Axis translation required double xShift = -dX / area.Width; double yShift = +dY / area.Height; if (Horizontal) { pc.TranslateXAxes(xShift); } if (Vertical) { pc.TranslateYAxes(yShift); } return(true); } return(false); }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { Rectangle area = pc.PlotAreaBoundingBoxCache; if (scaling) { pc.CacheAxes(); double dX = args.X - lastPoint.X; // distance mouse has moved double dY = args.Y - lastPoint.Y; lastPoint = new Point(args.X, args.Y); // Alt key reduces sensitivity double factor = Sensitivity; if (key == Key.AltLeft || key == Key.AltRight) { factor *= 0.25; // arbitrary change } double xProportion = +dX * factor / area.Width; double yProportion = -dY * factor / area.Height; if (Horizontal) { pc.ZoomXAxes(xProportion, focusX); } if (Vertical) { pc.ZoomYAxes(yProportion, focusY); } return(true); } return(false); }
public override bool OnMouseExited(EventArgs args, PlotCanvas pc) { if (selectionActive) { pc.Canvas.QueueDraw(selection); selectionActive = false; } return(false); }
public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { if (scaling) { lastPoint = unset; scaling = false; //pc.plotCursor = CursorType.LeftPointer; } return(false); }
/// <summary> /// OnButtonPressed method for AxisScale interaction /// </summary> public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // if the mouse is inside the plot area (the tick marks may be here, // and are counted as part of the axis), then *don't* invoke scaling if (pc.PlotAreaBoundingBoxCache.Contains(args.X, args.Y)) { return(false); } if (args.Button == PointerButton.Left) { // see if hit with axis. NB Only one axis object will be returned ArrayList objects = pc.HitTest(new Point(args.X, args.Y)); foreach (object o in objects) { if (o is Axis) { dragging = true; axis = (Axis)o; if (pc.PhysicalXAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis1Cache; //pc.plotCursor = CursorType.LeftRight; } else if (pc.PhysicalXAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis2Cache; //ps.plotCursor = CursorType.LeftRight; } else if (pc.PhysicalYAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis1Cache; //pc.plotCursor = CursorType.UpDown; } else if (pc.PhysicalYAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis2Cache; //pc.plotCursor = CursorType.UpDown; } startPoint = new Point(args.X, args.Y); lastPoint = startPoint; // evaluate focusRatio about which axis is expanded double x = startPoint.X - physicalAxis.PhysicalMin.X; double y = startPoint.Y - physicalAxis.PhysicalMin.Y; double r = Math.Sqrt(x * x + y * y); focusRatio = r / physicalAxis.PhysicalLength; return(false); } } } return(false); }
/// <summary> /// OnButtonReleased method for AxisDrag interaction /// </summary> public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { if (dragging) { physicalAxis = null; lastPoint = unset; dragging = false; translateX = false; translateY = false; } return(false); }
/// <summary> /// OnButtonReleased method for AxisScale interaction /// </summary> public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { if (dragging) { dragging = false; axis = null; physicalAxis = null; lastPoint = new Point(); //pc.plotCursor = CursorType.LeftPointer; } return(false); }
public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // Only start selection if mouse is inside plot area (excluding axes) Rectangle area = pc.PlotAreaBoundingBoxCache; if (args.Button == PointerButton.Left && area.Contains(args.Position)) { selectionActive = true; startPoint.X = args.X; startPoint.Y = args.Y; endPoint = startPoint; } return(false); }
/// <summary> /// Handler for KeyPressed events /// </summary> /// <param name="args">the Xwt.KeyEventArgs</param> /// <param name="pc">the PlotCanvas</param> /// <returns> /// true if the underlying (cached) plot requires redrawing, otherwise false /// </returns> public override bool OnKeyPressed(KeyEventArgs args, PlotCanvas pc) { double factor = Sensitivity; Key key = args.Key; ModifierKeys modifiers = args.Modifiers; if ((modifiers & ModifierKeys.Alt) != 0) { factor = Sensitivity * altFactor; } if (key == Key.Home || key == Key.NumPadHome) { pc.SetOriginalDimensions (); return true; } if (key == Key.Left || key == Key.NumPadLeft) { pc.CacheAxes(); pc.TranslateXAxes (factor * left); return true; } if (key == Key.Right || key == Key.NumPadRight) { pc.CacheAxes(); pc.TranslateXAxes (factor*right); return true; } if (key == Key.Up || key == Key.NumPadUp) { pc.CacheAxes (); pc.TranslateYAxes (factor*up); return true; } if (key == Key.Down || key == Key.NumPadDown) { pc.CacheAxes (); pc.TranslateYAxes (factor*down); return true; } if (key == Key.Plus || key == Key.NumPadAdd) { pc.CacheAxes (); pc.ZoomXAxes (zoomIn*factor, symmetrical); pc.ZoomYAxes (zoomIn*factor, symmetrical); return true; } if (key == Key.Minus || key == Key.NumPadSubtract) { pc.CacheAxes (); pc.ZoomXAxes (zoomOut*factor, symmetrical); pc.ZoomYAxes (zoomOut*factor, symmetrical); return true; } return false; }
/// <summary> /// OnButtonPressed method for AxisDrag interaction /// </summary> public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // if the mouse is inside the plot area (the tick marks may be here, // and are counted as part of the axis), then *don't* invoke scaling if (pc.PlotAreaBoundingBoxCache.Contains(args.X, args.Y)) { return(false); } if (args.Button == PointerButton.Left) { // see if hit with axis. NB Only one axis object will be returned ArrayList objects = pc.HitTest(new Point(args.X, args.Y)); foreach (object o in objects) { if (o is Axis) { dragging = true; Axis axis = (Axis)o; if (pc.PhysicalXAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis1Cache; translateX = true; } else if (pc.PhysicalXAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis2Cache; translateX = true; } else if (pc.PhysicalYAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis1Cache; translateY = true; } else if (pc.PhysicalYAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis2Cache; translateY = true; } lastPoint = new Point(args.X, args.Y); return(false); } } } return(false); }
public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // Only start drag if mouse is inside plot area (excluding axes) Rectangle area = pc.PlotAreaBoundingBoxCache; if (area.Contains(args.Position)) { dragging = true; lastPoint = new Point(args.X, args.Y); if (args.Button == PointerButton.Left) { if (Horizontal || Vertical) { //pc.plotCursor = CursorType.Hand; } } } 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); }
/// <summary> /// OnMouseMoved method for AxisScale interaction /// </summary> public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { if (dragging && physicalAxis != null) { pc.CacheAxes(); double dX = (args.X - lastPoint.X); double dY = (args.Y - lastPoint.Y); lastPoint = new Point(args.X, args.Y); // In case the physical axis is not horizontal/vertical, combine dX and dY // in a way which preserves their sign and intuitive axis zoom sense, ie // because the physical origin is top-left, expand with +ve dX, but -ve dY double distance = dX - dY; double proportion = distance * Sensitivity / physicalAxis.PhysicalLength; axis.IncreaseRange(proportion, focusRatio); return(true); } return(false); }
public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { bool modified = false; // delete previous overlay rectangle pc.Canvas.QueueDraw(selection); if (selectionActive) { selectionActive = false; Rectangle bounds = pc.PlotAreaBoundingBoxCache; if (!bounds.Contains(endPoint)) { // MouseUp outside plotArea - cancel selection modified = false; } else { pc.CacheAxes(); // Redefine range based on selection. The proportions for // Min and Max do not require Min < Max, since they will // be re-ordered by Axis.DefineRange if necessary double xMin = startPoint.X - bounds.Left; double yMin = bounds.Bottom - startPoint.Y; double xMax = endPoint.X - bounds.Left; double yMax = bounds.Bottom - endPoint.Y; double xMinProp = xMin / bounds.Width; double xMaxProp = xMax / bounds.Width; double yMinProp = yMin / bounds.Height; double yMaxProp = yMax / bounds.Height; pc.DefineXAxes(xMinProp, xMaxProp); pc.DefineYAxes(yMinProp, yMaxProp); modified = true; } } return(modified); }
/// <summary> /// OnButtonPressed method for AxisDrag interaction /// </summary> public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // if the mouse is inside the plot area (the tick marks may be here, // and are counted as part of the axis), then *don't* invoke scaling if (pc.PlotAreaBoundingBoxCache.Contains(args.X, args.Y)) { return false; } if (args.Button == PointerButton.Left) { // see if hit with axis. NB Only one axis object will be returned ArrayList objects = pc.HitTest (new Point(args.X, args.Y)); foreach (object o in objects) { if (o is Axis) { dragging = true; Axis axis = (Axis)o; if (pc.PhysicalXAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis1Cache; translateX = true; } else if (pc.PhysicalXAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis2Cache; translateX = true; } else if (pc.PhysicalYAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis1Cache; translateY = true; } else if (pc.PhysicalYAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis2Cache; translateY = true; } lastPoint = new Point (args.X, args.Y); return false; } } } return false; }
/// <summary> /// MouseMove method for PlotScroll /// </summary> public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { // delete previous focusPoint drawing pc.Canvas.QueueDraw(focusRect); return(false); }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { Rectangle area = pc.PlotAreaBoundingBoxCache; if (scaling) { pc.CacheAxes(); double dX = args.X - lastPoint.X; // distance mouse has moved double dY = args.Y - lastPoint.Y; lastPoint = new Point (args.X, args.Y); // Alt key reduces sensitivity double factor = Sensitivity; if (key == Key.AltLeft || key == Key.AltRight) { factor *= 0.25; // arbitrary change } double xProportion = +dX*factor/area.Width; double yProportion = -dY*factor/area.Height; if (Horizontal) { pc.ZoomXAxes (xProportion, focusX); } if (Vertical) { pc.ZoomYAxes (yProportion, focusY); } return true; } return false; }
public override bool OnKeyReleased(KeyEventArgs args, PlotCanvas pc) { key = args.Key; return false; }
public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // Only start scaling if mouse is inside plot area (excluding axes) Rectangle area = pc.PlotAreaBoundingBoxCache; if (area.Contains (args.Position)) { scaling = true; lastPoint = new Point (args.X, args.Y); if (args.Button == PointerButton.Left) { if (Horizontal) { ;//pc.plotCursor = CursorType.LeftRight; } if (Vertical) { ;//pc.plotCursor = CursorType.UpDown; } if (Horizontal && Vertical) { ;//pc.plotCursor = CursorType.Zoom; } } // evaluate focusPoint about which axis is expanded focusX = (double)(args.X - area.Left)/(double)area.Width; focusY = (double)(area.Bottom - args.Y)/(double)area.Height; } return false; }
public override bool OnMouseExited(EventArgs args, PlotCanvas pc) { if (selectionActive) { pc.Canvas.QueueDraw (selection); selectionActive = false; } return false; }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { Rectangle area = pc.PlotAreaBoundingBoxCache; if (dragging && physicalAxis != null) { pc.CacheAxes(); double dX = args.X - lastPoint.X; double dY = args.Y - lastPoint.Y; lastPoint = new Point (args.X, args.Y); double length = physicalAxis.PhysicalLength; if (translateX) { double xShift = -dX / length; pc.TranslateXAxes (xShift); } if (translateY) { double yShift = +dY / length; pc.TranslateYAxes (yShift); } return true; } return false; }
/// <summary> /// MouseMove method for PlotScroll /// </summary> public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { // delete previous focusPoint drawing pc.Canvas.QueueDraw (focusRect); return false; }
public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // Only start selection if mouse is inside plot area (excluding axes) Rectangle area = pc.PlotAreaBoundingBoxCache; if (args.Button == PointerButton.Left && area.Contains (args.Position)) { selectionActive = true; startPoint.X = args.X; startPoint.Y = args.Y; endPoint = startPoint; } return false; }
public virtual bool OnMouseScrolled(MouseScrolledEventArgs args, PlotCanvas pc) { return(false); }
public virtual bool OnMouseExited(EventArgs args, PlotCanvas pc) { return(false); }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { double X = args.X; double Y = args.Y; if (selectionActive) { // note last selection rectangle Rectangle lastSelection = selection; Rectangle bounds = pc.PlotAreaBoundingBoxCache; // clip selection rectangle to PlotArea X = Math.Max(X, bounds.Left); X = Math.Min(X, bounds.Right); Y = Math.Max(Y, bounds.Top); Y = Math.Min(Y, bounds.Bottom); endPoint.X = X; endPoint.Y = Y; selection = FromPoints (startPoint, endPoint); pc.Canvas.QueueDraw (lastSelection); //Console.WriteLine ("Erase: {0} {1} {2} {3} ", lastSelection.X, lastSelection.Y, lastSelection.Width, lastSelection.Height); pc.Canvas.QueueDraw (selection); } 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); }
/// <summary> /// Handler for KeyRelease events /// </summary> /// <param name="key">the NPlot key enumeration</param> /// <param name="pc">the PlotCanvas</param> /// <returns></returns> public override bool OnKeyReleased(KeyEventArgs args, PlotCanvas pc) { return false; }
/// <summary> /// OnButtonReleased method for AxisScale interaction /// </summary> public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { if (dragging) { dragging = false; axis = null; physicalAxis = null; lastPoint = new Point(); //pc.plotCursor = CursorType.LeftPointer; } return false; }
/// <summary> /// OnButtonReleased method for AxisDrag interaction /// </summary> public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { if (dragging) { physicalAxis = null; lastPoint = unset; dragging = false; translateX = false; translateY = false; } return false; }
public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { bool modified = false; // delete previous overlay rectangle pc.Canvas.QueueDraw (selection); if (selectionActive) { selectionActive = false; Rectangle bounds = pc.PlotAreaBoundingBoxCache; if (!bounds.Contains(endPoint)) { // MouseUp outside plotArea - cancel selection modified = false; } else { pc.CacheAxes(); // Redefine range based on selection. The proportions for // Min and Max do not require Min < Max, since they will // be re-ordered by Axis.DefineRange if necessary double xMin = startPoint.X - bounds.Left; double yMin = bounds.Bottom - startPoint.Y; double xMax = endPoint.X - bounds.Left; double yMax = bounds.Bottom - endPoint.Y; double xMinProp = xMin/bounds.Width; double xMaxProp = xMax/bounds.Width; double yMinProp = yMin/bounds.Height; double yMaxProp = yMax/bounds.Height; pc.DefineXAxes (xMinProp, xMaxProp); pc.DefineYAxes (yMinProp, yMaxProp); modified = true; } } return modified; }
PlotCanvas plotCanvas; // To allow access to parent PlotCanvas /// <summary> /// Creates a new DrawingSurface and saves a reference to the PlotSurface /// </summary> internal DrawingSurface(PlotCanvas pc) : base() { plotCanvas = pc; }
public virtual bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { return(false); }
public override bool OnKeyReleased(KeyEventArgs args, PlotCanvas pc) { key = args.Key; return(false); }
public virtual bool OnKeyReleased(KeyEventArgs args, PlotCanvas pc) { return(false); }
/// <summary> /// OnButtonPressed method for AxisScale interaction /// </summary> public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // if the mouse is inside the plot area (the tick marks may be here, // and are counted as part of the axis), then *don't* invoke scaling if (pc.PlotAreaBoundingBoxCache.Contains(args.X, args.Y)) { return false; } if (args.Button == PointerButton.Left) { // see if hit with axis. NB Only one axis object will be returned ArrayList objects = pc.HitTest (new Point(args.X, args.Y)); foreach (object o in objects) { if (o is Axis) { dragging = true; axis = (Axis)o; if (pc.PhysicalXAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis1Cache; //pc.plotCursor = CursorType.LeftRight; } else if (pc.PhysicalXAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalXAxis2Cache; //ps.plotCursor = CursorType.LeftRight; } else if (pc.PhysicalYAxis1Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis1Cache; //pc.plotCursor = CursorType.UpDown; } else if (pc.PhysicalYAxis2Cache.Axis == axis) { physicalAxis = pc.PhysicalYAxis2Cache; //pc.plotCursor = CursorType.UpDown; } startPoint = new Point (args.X, args.Y); lastPoint = startPoint; // evaluate focusRatio about which axis is expanded double x = startPoint.X - physicalAxis.PhysicalMin.X; double y = startPoint.Y - physicalAxis.PhysicalMin.Y; double r = Math.Sqrt(x*x + y*y); focusRatio = r/physicalAxis.PhysicalLength; return false; } } } return false; }
/// <summary> /// OnMouseMoved method for AxisScale interaction /// </summary> public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { if (dragging && physicalAxis != null) { pc.CacheAxes(); double dX = (args.X - lastPoint.X); double dY = (args.Y - lastPoint.Y); lastPoint = new Point (args.X, args.Y); // In case the physical axis is not horizontal/vertical, combine dX and dY // in a way which preserves their sign and intuitive axis zoom sense, ie // because the physical origin is top-left, expand with +ve dX, but -ve dY double distance = dX - dY; double proportion = distance*Sensitivity /physicalAxis.PhysicalLength; axis.IncreaseRange (proportion, focusRatio); return true; } return false; }
public override bool OnMouseMoved(MouseMovedEventArgs args, PlotCanvas pc) { Rectangle area = pc.PlotAreaBoundingBoxCache; if (dragging) { pc.CacheAxes(); double dX = args.X - lastPoint.X; // distance mouse has moved double dY = args.Y - lastPoint.Y; lastPoint = new Point (args.X, args.Y); // Axis translation required double xShift = -dX / area.Width; double yShift = +dY / area.Height; if (Horizontal) { pc.TranslateXAxes (xShift); } if (Vertical) { pc.TranslateYAxes (yShift); } return true; } return false; }
public override bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { if (dragging) { lastPoint = unset; dragging = false; //pc.plotCursor = CursorType.LeftPointer; } return false; }
public virtual bool OnMouseScrolled(MouseScrolledEventArgs args, PlotCanvas pc) { return false; }
public override bool OnButtonPressed(ButtonEventArgs args, PlotCanvas pc) { // Only start drag if mouse is inside plot area (excluding axes) Rectangle area = pc.PlotAreaBoundingBoxCache; if (area.Contains (args.Position)) { dragging = true; lastPoint = new Point (args.X, args.Y); if (args.Button == PointerButton.Left) { if (Horizontal || Vertical) { //pc.plotCursor = CursorType.Hand; } } } return false; }
public virtual bool OnButtonReleased(ButtonEventArgs args, PlotCanvas pc) { return false; }
public virtual bool OnKeyReleased(KeyEventArgs args, PlotCanvas pc) { return false; }
public virtual bool OnMouseEntered(EventArgs args, PlotCanvas pc) { return false; }
PlotCanvas plotCanvas; // To allow access to parent PlotCanvas #endregion Fields #region Constructors /// <summary> /// Creates a new DrawingSurface and saves a reference to the PlotSurface /// </summary> internal DrawingSurface(PlotCanvas pc) : base() { plotCanvas = pc; }