private void ReadRectangleAttributes(RectangleVObject vObject, SvgVoRectangle svg) { ReadBaseRectangleVObjectAttributes(vObject, svg); vObject.Path = Path.CreateRectanglePath(svg.X, svg.Y, svg.Width, svg.Height); vObject.Angle = svg.Transform != null?Utils.GetAngle(svg.Transform.Elements[0], svg.Transform.Elements[1]) : 0; vObject.FillColor = svg.GetFillColor(_serializer); vObject.BorderColor = svg.GetBorderColor(_serializer); vObject.BorderWidth = svg.StrokeWidth; vObject.FixedBorderWidth = svg.FixedBorderWidth; }
protected internal override void UpdateSize() { if (ValidRect) { return; } RotatedRectangleF textRect; if (!TextPath.IsEmpty) { var dpi = Canvas != null ? 96 * Canvas.Zoom : 72; textRect = new RotatedRectangleF(MeasureText(dpi)); textRect.Scale(72 / dpi, 72 / dpi); var firstPoint = TextPath.GetFirstPoint(); // Move text rectangle to the text path's first point because GetBlackBox returns an empty rectangle (in location 0:0) when text is empty if (textRect.IsEmpty) { textRect.CenterX = firstPoint.X; textRect.CenterY = firstPoint.Y; } textRect.RotateAt(Angle, firstPoint); } else { textRect = new RotatedRectangleF(); } Path = Path.CreateRectanglePath(textRect.ToRectangleF()); Transform.Clear(keepAngle: true); ActualAngle = Transform.Angle; ValidRect = true; }