protected internal virtual void SetBoundsChanged(float centerX, float centerY, float rotateAngle, float skewX, float skewY, float scaleX, float scaleY, PointF[] polygon, DUIBoundsPolygonSpecified specified) { var polygonRect = PolygonTools.GetPolygonRect(polygon); float x = polygonRect.X; float y = polygonRect.Y; float width = polygonRect.Width; float height = polygonRect.Height; if ((specified & DUIBoundsPolygonSpecified.CenterX) == DUIBoundsPolygonSpecified.None) { centerX = this.mouseDownCenter.X; } if ((specified & DUIBoundsPolygonSpecified.CenterY) == DUIBoundsPolygonSpecified.None) { centerY = this.mouseDownCenter.Y; } if ((specified & DUIBoundsPolygonSpecified.RotateAngle) == DUIBoundsPolygonSpecified.None) { rotateAngle = this.mouseDownRotateAngle; } if ((specified & DUIBoundsPolygonSpecified.SkewX) == DUIBoundsPolygonSpecified.None) { skewX = this.mouseDownSkew.X; } if ((specified & DUIBoundsPolygonSpecified.SkewY) == DUIBoundsPolygonSpecified.None) { skewY = this.mouseDownSkew.Y; } if ((specified & DUIBoundsPolygonSpecified.ScaleX) == DUIBoundsPolygonSpecified.None) { scaleX = this.mouseDownScale.X; } if ((specified & DUIBoundsPolygonSpecified.ScaleY) == DUIBoundsPolygonSpecified.None) { scaleY = this.mouseDownScale.Y; } if ((specified & DUIBoundsPolygonSpecified.Polygon) == DUIBoundsPolygonSpecified.None) { polygon = this.mouseDownPolygon; } if (this.mouseDownBounds.X != x || this.mouseDownBounds.Y != y || this.mouseDownBounds.Width != width || this.mouseDownBounds.Height != height || this.mouseDownCenter.X != centerX || this.mouseDownCenter.Y != centerY || this.mouseDownRotateAngle != rotateAngle || this.mouseDownSkew.X != skewX || this.mouseDownSkew.Y != skewY || this.mouseDownScale.X != scaleX || this.mouseDownScale.Y != scaleY || !PolygonTools.PolygonEquels(this.mouseDownPolygon, polygon)) { UpdateBoundsChanged(x, y, width, height, centerX, centerY, rotateAngle, skewX, skewY, scaleX, scaleY, polygon); } }
public virtual void SetBounds(float centerX, float centerY, float rotateAngle, float skewX, float skewY, float scaleX, float scaleY, PointF[] polygon, DUIBoundsPolygonSpecified specified, bool invalidate = true) { var polygonRect = PolygonTools.GetPolygonRect(polygon); float x = polygonRect.X; float y = polygonRect.Y; float width = polygonRect.Width; float height = polygonRect.Height; if ((specified & DUIBoundsPolygonSpecified.CenterX) == DUIBoundsPolygonSpecified.None) { centerX = this.centerX; } if ((specified & DUIBoundsPolygonSpecified.CenterY) == DUIBoundsPolygonSpecified.None) { centerY = this.centerY; } if ((specified & DUIBoundsPolygonSpecified.RotateAngle) == DUIBoundsPolygonSpecified.None) { rotateAngle = this.rotate; } if ((specified & DUIBoundsPolygonSpecified.SkewX) == DUIBoundsPolygonSpecified.None) { skewX = this.skewX; } if ((specified & DUIBoundsPolygonSpecified.SkewY) == DUIBoundsPolygonSpecified.None) { skewY = this.skewY; } if ((specified & DUIBoundsPolygonSpecified.ScaleX) == DUIBoundsPolygonSpecified.None) { scaleX = this.scaleX; } if ((specified & DUIBoundsPolygonSpecified.ScaleY) == DUIBoundsPolygonSpecified.None) { scaleY = this.scaleY; } if ((specified & DUIBoundsPolygonSpecified.Polygon) == DUIBoundsPolygonSpecified.None) { polygon = this.polygon; } if (this.x != x || this.y != y || this.width != width || this.height != height || this.centerX != centerX || this.centerY != centerY || this.rotate != rotateAngle || this.skewX != skewX || this.skewY != skewY || this.scaleX != scaleX || this.scaleY != scaleY || !PolygonTools.PolygonEquels(this.polygon, polygon)) { UpdateBounds(x, y, width, height, centerX, centerY, rotateAngle, skewX, skewY, scaleX, scaleY, polygon, invalidate); } }
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(); }