private void InitMatrix(float left, float bottom, float right, float top) { this.CSCom.SetAnchorPointVisiable(true); this.CSCom.SetControlPointVisiable(true); if (this.selectedObjects.Count <VisualObject>() == 1) { VisualObject visualObject = this.selectedParentObjects.FirstOrDefault <VisualObject>(); this.AnchorPoint = visualObject.GetBoundingAnchorPoint(); PointF boundingSize = visualObject.GetBoundingSize(); this.Size = boundingSize; this.Position = visualObject.Position; this.Scale = visualObject.Scale; this.RotationSkew = visualObject.RotationSkew; if (!visualObject.OperationFlag.HasFlag(OperationMask.ScaleFlag) && !visualObject.OperationFlag.HasFlag(OperationMask.RotationFlag)) { this.CSCom.SetControlPointVisiable(false); } this.CSCom.SetAnchorPointVisiable(visualObject.OperationFlag.HasFlag(OperationMask.AnchorMoveFlag)); } else { this.AnchorPoint = new ScaleValue(0.5f, 0.5f, 0.1, -99999999.0, 99999999.0); this.Size = new PointF(right - left, top - bottom); this.RotationSkew = new ScaleValue(0f, 0f, 0.1, -99999999.0, 99999999.0); this.Scale = new ScaleValue(1f, 1f, 0.1, -99999999.0, 99999999.0); PointF anchorPointInPoints = this.CSCom.GetAnchorPointInPoints(); this.Position = new PointF(left + anchorPointInPoints.X, bottom + anchorPointInPoints.Y); } }
private void InitBoundingBox() { float num = 0f; float num2 = 0f; float num3 = 0f; float num4 = 0f; bool flag = true; foreach (VisualObject current in this.selectedObjects) { VisualObject visualObject = current; PointF boundingSize = visualObject.GetBoundingSize(); Rectangle rect = new Rectangle(0, 0, (int)boundingSize.X, (int)boundingSize.Y); CSRect cSRect = this.CSCom.RectApplyTransform(rect, visualObject.GetCSVisual().ConvertToNodeMatrix(this.canvasObject.GetCSVisual())); if (flag) { num = cSRect.MinX(); num2 = cSRect.MinY(); num3 = cSRect.MaxX(); num4 = cSRect.MaxY(); flag = false; } else { num = Math.Min(num, cSRect.MinX()); num2 = Math.Min(num2, cSRect.MinY()); num3 = Math.Max(num3, cSRect.MaxX()); num4 = Math.Max(num4, cSRect.MaxY()); } } this.InitMatrix(num, num2, num3, num4); }