/// <summary> /// MouseMove method for Guidelines /// </summary> /// <param name="X">mouse X position</param> /// <param name="Y"> mouse Y position</param> /// <param name="keys"> mouse and keyboard modifiers</param> /// <param name="ps">the InteractivePlotSurface2D</param> public override bool DoMouseMove(int X, int Y, Modifier keys, InteractivePlotSurface2D ps) { Rectangle plotArea = ps.PlotAreaBoundingBoxCache; Rectangle lineExtent = Rectangle.Empty; if (vertical_) { if (xPos_ != -1) { // set extents to erase current vertical guideline //lineExtent = new Rectangle (yStart_.X, yStart_.Y, 1, (int)Math.Abs (yEnd_.Y - yStart_.Y)); ps.DrawOverlayLine(yStart_, yEnd_, lineColor_, false); } // Only display guideline when mouse is within the plotArea if (plotArea.Contains(X,Y)) { xPos_ = X; yStart_ = new Point(X, plotArea.Top); yEnd_ = new Point(X, plotArea.Bottom); ps.DrawOverlayLine(yStart_, yEnd_, lineColor_, true); } else { xPos_ = -1; } //if (xPos_ != -1) { // // Invalidate line extents, then DoDraw will request a new line to be drawn // ps.QueueDraw (lineExtent); //} } if (horizontal_) { if (yPos_ != -1) { // set extents to erase current vertical guideline //lineExtent = new Rectangle (xStart_.X, xStart_.Y, (int)Math.Abs (xEnd_.X - xStart_.X), 1); ps.DrawOverlayLine(xStart_, xEnd_, lineColor_, false); } // Only display guideline when mouse is within the plotArea if (plotArea.Contains(X,Y)) { yPos_ = Y; xStart_ = new Point(plotArea.Left,Y); xEnd_ = new Point(plotArea.Right,Y); ps.DrawOverlayLine(xStart_, xEnd_, lineColor_, true); } else { yPos_ = -1; } //if (yPos_ != -1) { // // Invalidate line extents, then DoDraw will request a new line to be drawn // ps.QueueDraw (lineExtent); //} } return false; }
/// <summary> /// MouseLeave method for Guidelines /// </summary> /// <param name="ps">the InteractivePlotSurface2D</param> public override bool DoMouseLeave(InteractivePlotSurface2D ps) { Rectangle lineExtent = Rectangle.Empty; if (vertical_) { if (xPos_ != -1) { // set extents to erase current vertical guideline lineExtent = new Rectangle (yStart_.X, yStart_.Y, 1, (int)Math.Abs (yEnd_.Y - yStart_.Y)); ps.DrawOverlayLine(yStart_, yEnd_, lineColor_, false); } xPos_ = -1; } if (horizontal_) { if (yPos_ != -1) { // set extents to erase current vertical guideline lineExtent = new Rectangle (xStart_.X, xStart_.Y, (int)Math.Abs (xEnd_.X - xStart_.X), 1); ps.DrawOverlayLine(xStart_, xEnd_, lineColor_, false); } yPos_ = -1; } return false; }