private void HandleRotation(PointF point) { PointF position = this.Position; PointF pointF; PointF pointF2; if (this.selectedParentObjects.Count <VisualObject>() == 1) { pointF = this.selectedParentObjects.FirstOrDefault <VisualObject>().TransformToParent(this.lastMousePoint); pointF2 = this.selectedParentObjects.FirstOrDefault <VisualObject>().TransformToParent(point); } else { pointF = this.canvasObject.TransformToSelf(this.lastMousePoint); pointF2 = this.canvasObject.TransformToSelf(point); } float num = ComControlNode.CC_DEGREES_TO_RADIANS(this.RotationSkew.ScaleX); float num2 = ComControlNode.CC_DEGREES_TO_RADIANS(this.RotationSkew.ScaleY); float num3 = (float)(-(float)Math.Atan2((double)(pointF.Y - position.Y), (double)(pointF.X - position.X))); float num4 = (float)(-(float)Math.Atan2((double)(pointF2.Y - position.Y), (double)(pointF2.X - position.X))); if (this.isShiftDown) { num4 = ((num4 * num3 < 0f) ? (-num4) : num4); float num5 = ComControlNode.CC_RADIANS_TO_DEGREES(num4 - num3); this.lastRotation += num5; if (Math.Abs(this.lastRotation) >= 15f) { float num6 = (float)((this.RotationSkew.ScaleX + this.lastRotation > 0f) ? 15 : -15); float num7 = (float)((this.RotationSkew.ScaleY + this.lastRotation > 0f) ? 15 : -15); this.RotationSkew = new ScaleValue(); this.lastRotation = 0f; } } else { num2 = ComControlNode.CC_RADIANS_TO_DEGREES(num2 + num4 - num3); num = ComControlNode.CC_RADIANS_TO_DEGREES(num + num4 - num3); this.RotationSkew = new ScaleValue(num, num2, 0.1, -99999999.0, 99999999.0); } }
private void HandleRotation(PointF point) { PointF position = this.Position; PointF pointF1; PointF pointF2; if (this.selectedParentObjects.Count <VisualObject>() == 1) { pointF1 = this.selectedParentObjects.FirstOrDefault <VisualObject>().TransformToParent(this.lastMousePoint); pointF2 = this.selectedParentObjects.FirstOrDefault <VisualObject>().TransformToParent(point); } else { pointF1 = this.canvasObject.TransformToSelf(this.lastMousePoint); pointF2 = this.canvasObject.TransformToSelf(point); } float radians1 = ComControlNode.CC_DEGREES_TO_RADIANS(this.RotationSkew.ScaleX); float radians2 = ComControlNode.CC_DEGREES_TO_RADIANS(this.RotationSkew.ScaleY); float num1 = (float)-Math.Atan2((double)pointF1.Y - (double)position.Y, (double)pointF1.X - (double)position.X); float num2 = (float)-Math.Atan2((double)pointF2.Y - (double)position.Y, (double)pointF2.X - (double)position.X); if (this.isShiftDown) { this.lastRotation += ComControlNode.CC_RADIANS_TO_DEGREES(((double)num2 * (double)num1 < 0.0 ? -num2 : num2) - num1); if ((double)Math.Abs(this.lastRotation) < 15.0) { return; } float num3 = (double)this.RotationSkew.ScaleX + (double)this.lastRotation > 0.0 ? 15f : -15f; float num4 = (double)this.RotationSkew.ScaleY + (double)this.lastRotation > 0.0 ? 15f : -15f; this.RotationSkew = new ScaleValue(); this.lastRotation = 0.0f; } else { float degrees = ComControlNode.CC_RADIANS_TO_DEGREES(radians2 + num2 - num1); this.RotationSkew = new ScaleValue(ComControlNode.CC_RADIANS_TO_DEGREES(radians1 + num2 - num1), degrees, 0.1, -99999999.0, 99999999.0); } }