private void RadShapeEditorControl_MouseUp(object sender, MouseEventArgs e) { this.Cursor = Cursors.Arrow; if (!this.mouseDown) { return; } this.mouseDown = false; Rectangle rectangle = new Rectangle(this.downPoint.X < this.curPoint.X ? this.downPoint.X : this.curPoint.X, this.downPoint.Y < this.curPoint.Y ? this.downPoint.Y : this.curPoint.Y, Math.Abs(this.downPoint.X - this.curPoint.X), Math.Abs(this.downPoint.Y - this.curPoint.Y)); rectangle.X = (int)Math.Round((double)rectangle.X / Math.Pow((double)this.zoomFactor, 2.0)) + this.xOverflowOffset; rectangle.Y = (int)Math.Round((double)rectangle.Y / Math.Pow((double)this.zoomFactor, 2.0)) + this.yOverflowOffset; rectangle.Width = (int)Math.Round((double)rectangle.Width / (double)this.zoomFactor); rectangle.Height = (int)Math.Round((double)rectangle.Height / (double)this.zoomFactor); foreach (ShapePoint point in this.points) { point.Selected = this.point == null && rectangle.Contains(point.GetPoint()); if (point.Bezier) { point.ControlPoint1.Selected = this.point == null && rectangle.Contains(point.ControlPoint1.GetPoint()); point.ControlPoint2.Selected = this.point == null && rectangle.Contains(point.ControlPoint2.GetPoint()); } else { point.ControlPoint1.Selected = false; point.ControlPoint2.Selected = false; } } this.Refresh(); }
private Point GetRealFromVirtualPoint(ShapePointBase pt) { return(new Point((int)Math.Round((double)(pt.GetPoint().X - this.xOverflowOffset) * (double)this.zoomFactor), (int)Math.Round((double)(pt.GetPoint().Y - this.yOverflowOffset) * (double)this.zoomFactor))); }
/// <summary> /// Translates a point in accordance with the offsets due to scrolling /// </summary> /// <param name="pt"></param> /// <returns></returns> private Point GetRealFromVirtualPoint(ShapePointBase pt) { return(new Point( (int)Math.Round((pt.GetPoint().X - xOverflowOffset) * zoomFactor), (int)Math.Round((pt.GetPoint().Y - yOverflowOffset) * zoomFactor))); }