public override void DoOffsetOther(float offsetX, float offsetY, DUIAnyBounds anyBounds) { DUIAnyBoundsPolygon anyBoundsPolygon = (DUIAnyBoundsPolygon)anyBounds; DUIMatrix m = new DUIMatrix(); m.Rotate(this.Rotate); PointF p = MatrixTools.PointAfterMatrix(new PointF(offsetX, offsetY), m); anyBoundsPolygon.Polygon = this.Polygon.Select(pl => new PointF(pl.X + p.X, pl.Y + p.Y)).ToArray(); RectangleF bounds = PolygonTools.GetPolygonRect(anyBoundsPolygon.Polygon); }
protected override void DoCenterFollow(DUIAnyBounds anyBounds, PointF center) { DUIAnyBoundsPolygon anyBoundsPolygon = (DUIAnyBoundsPolygon)anyBounds; RectangleF rect = PolygonTools.GetPolygonRect(anyBoundsPolygon.Polygon); anyBounds.x = rect.X; anyBounds.y = rect.Y; anyBounds.width = rect.Width; anyBounds.height = rect.Height; float lastX = anyBounds.X; float lastY = anyBounds.Y; base.DoCenterFollow(anyBounds, center); anyBoundsPolygon.Polygon = anyBoundsPolygon.Polygon.Select(pl => new PointF(pl.X + anyBounds.X - lastX, pl.Y + anyBounds.Y - lastY)).ToArray(); }
public override void DoOffsetPoint(float offsetX, float offsetY, DUIAnyBounds anyBounds) { offsetX = GetLimitPolygonPointLeftOffset(offsetX); offsetY = GetLimitPolygonPointTopOffset(offsetY); DUIAnyBoundsPolygon anyBoundsPolygon = (DUIAnyBoundsPolygon)anyBounds; RectangleF lastPolygonBounds = PolygonTools.GetPolygonRect(this.Polygon); PointF[] polygon = this.Polygon.Select(p => new PointF(p.X, p.Y)).ToArray(); polygon[this.hoverPointIndex].X += offsetX; polygon[this.hoverPointIndex].Y += offsetY; RectangleF polygonBounds = PolygonTools.GetPolygonRect(polygon); DUIMatrix m = new DUIMatrix(); m.Rotate(this.Rotate); PointF offset = MatrixTools.PointAfterMatrix(new PointF(polygonBounds.X - lastPolygonBounds.X, polygonBounds.Y - lastPolygonBounds.Y), m); anyBoundsPolygon.Polygon = polygon.Select(pl => new PointF(pl.X + offset.X - (polygonBounds.X - lastPolygonBounds.X), pl.Y + offset.Y - (polygonBounds.Y - lastPolygonBounds.Y))).ToArray(); }
protected override void SetAnyBoundsChanging(DUIAnyBounds anyBounds) { DUIAnyBoundsPolygon anyBoundsPolygon = (DUIAnyBoundsPolygon)anyBounds; this.SetBoundsChanging( anyBoundsPolygon.centerX , anyBoundsPolygon.centerY , anyBoundsPolygon.rotate , anyBoundsPolygon.skewX , anyBoundsPolygon.skewY , anyBoundsPolygon.scaleX , anyBoundsPolygon.scaleY , anyBoundsPolygon.Polygon , DUIBoundsPolygonSpecified.RotateAngle | DUIBoundsPolygonSpecified.Center | DUIBoundsPolygonSpecified.Skew | DUIBoundsPolygonSpecified.Scale | DUIBoundsPolygonSpecified.Polygon ); }