public static PointD ToCairoPointD(this MonoReports.Model.Point p) { return(new PointD(p.X, p.Y)); }
public override void OnMouseMove() { if (designService.IsPressed && designService.IsMoving && designService.SelectedControl != null) { var control = designService.SelectedControl; var location = control.ControlModel.Location; if (designService.IsMoving) { double w, h, x, y; if (!isResizing) { x = Math.Max(0, location.X + designService.DeltaPoint.X); y = Math.Max(0, location.Y + designService.DeltaPoint.Y); x = Math.Min(control.ParentSection.Section.Width - control.ControlModel.Width, x); y = Math.Min(control.ParentSection.Section.Height - control.ControlModel.Height, y); var point = new MonoReports.Model.Point(x, y); control.ControlModel.Location = point; } else { switch (gripperType) { case GripperType.NE: w = Math.Min(Math.Abs(control.ControlModel.Size.Width + designService.DeltaPoint.X), control.ParentSection.Section.Width); h = Math.Min(Math.Abs(control.ControlModel.Size.Height - designService.DeltaPoint.Y), control.ParentSection.Section.Height); y = Math.Max(location.Y + designService.DeltaPoint.Y, 0); control.ControlModel.Size = new Size(w, h); control.ControlModel.Location = new MonoReports.Model.Point(location.X, y); break; case GripperType.SE: w = Math.Min(Math.Abs(control.ControlModel.Size.Width + designService.DeltaPoint.X), control.ParentSection.Section.Width); h = Math.Min(Math.Abs(control.ControlModel.Size.Height + designService.DeltaPoint.Y), control.ParentSection.Section.Height - control.ControlModel.Location.Y); control.ControlModel.Size = new Size(w, h); break; case GripperType.SW: w = Math.Min(Math.Abs(control.ControlModel.Size.Width - designService.DeltaPoint.X), control.ParentSection.Section.Width); h = Math.Min(Math.Abs(control.ControlModel.Size.Height + designService.DeltaPoint.Y), control.ParentSection.Section.Height - control.ControlModel.Location.Y); x = Math.Max(location.X + designService.DeltaPoint.X, 0); control.ControlModel.Size = new Size(w, h); control.ControlModel.Location = new MonoReports.Model.Point(x, location.Y); break; case GripperType.NW: w = Math.Min(Math.Abs(control.ControlModel.Size.Width - designService.DeltaPoint.X), control.ParentSection.Section.Width); h = Math.Min(Math.Abs(control.ControlModel.Size.Height - designService.DeltaPoint.Y), control.ParentSection.Section.Height - control.ControlModel.Location.Y); x = Math.Max(location.X + designService.DeltaPoint.X, 0); y = Math.Max(location.Y + designService.DeltaPoint.Y, 0); control.ControlModel.Size = new Size(w, h); control.ControlModel.Location = new MonoReports.Model.Point(x, y); break; default: break; } } } } }
public override void OnMouseMove() { if (designService.IsPressed && designService.IsMoving && designService.SelectedControl != null) { var control = designService.SelectedControl; var location = control.ControlModel.Location; cx = location.X; cy = location.Y; cw = control.ControlModel.Size.Width; ch = control.ControlModel.Size.Height; sw = control.ParentSection.Section.Width; sh = control.ParentSection.Section.Height; if (designService.IsMoving) { double w,h,x,y; if (!isResizing) { x = Math.Max(0, cx + designService.DeltaPoint.X); y = Math.Max(0, cy + designService.DeltaPoint.Y); x = Math.Min(sw-cw,x); y = Math.Min(sh-ch,y); var point = new MonoReports.Model.Point (x,y); control.ControlModel.Location = point; } else { switch (gripperType) { case GripperType.NE: w = Math.Min( Math.Abs (cw + designService.DeltaPoint.X) , sw); h = Math.Min( Math.Abs (ch - designService.DeltaPoint.Y) , sh); y = Math.Max( cy + designService.DeltaPoint.Y,0); control.ControlModel.Size = new Size (w, h); control.ControlModel.Location = new MonoReports.Model.Point (cx, y); break; case GripperType.SE: w = Math.Min( Math.Abs (cw + designService.DeltaPoint.X) , sw); h = Math.Min( Math.Abs (ch + designService.DeltaPoint.Y) , sh - cy); control.ControlModel.Size = new Size (w,h); break; case GripperType.SW: w = Math.Min( Math.Abs (cw - designService.DeltaPoint.X) , sw); h = Math.Min( Math.Abs (ch + designService.DeltaPoint.Y) , sh - cy); x = Math.Max( location.X + designService.DeltaPoint.X,0); control.ControlModel.Size = new Size (w,h); control.ControlModel.Location = new MonoReports.Model.Point (x, location.Y); break; case GripperType.NW: w = Math.Min( Math.Abs (cw - designService.DeltaPoint.X) , sw); h = Math.Min( Math.Abs (ch - designService.DeltaPoint.Y) , sh - cy); x = Math.Max( location.X + designService.DeltaPoint.X,0); y = Math.Max( location.Y + designService.DeltaPoint.Y,0); control.ControlModel.Size = new Size (w,h); control.ControlModel.Location = new MonoReports.Model.Point (x,y); break; default: break; } } } } }