private void UpdateRotation() { double num = this.unsnappedAngle; if (this.snapping) { num = this.SnapToAngle(this.unsnappedAngle, BrushRotateBehavior.shiftSnapAngle); } Point relativeBrushCenter = this.ActiveAdorner.RelativeBrushCenter; CanonicalTransform transform = new CanonicalTransform(this.initialBrushTransform); transform.UpdateCenter(relativeBrushCenter); transform.ApplyRotation(num - this.initialBrushTransform.RotationAngle, relativeBrushCenter); this.SetBrushTransform(transform); }
protected override void ApplyRotation(double angle) { Point point1 = this.initialElementSetCenter; angle -= this.initialSharedTransform.RotationAngle; this.ActiveView.AdornerLayer.FirePropertyChanged("RotateBoundingBoxAdornerRotationAngle", (object)angle); foreach (SceneElement element in this.EditingElementSet.Elements) { if (!(element.GetComputedValueAsWpf(Base2DElement.RenderTransformProperty) is Transform)) { Transform identity = Transform.Identity; } Matrix matrix = this.elementsToElement[element]; Point elementCoordinates = ((Base2DElement)element).RenderTransformOriginInElementCoordinates; Point point2 = point1 * matrix; point2 = new Point(point2.X - elementCoordinates.X, point2.Y - elementCoordinates.Y); Point fixedPoint = RoundingHelper.RoundPosition(point2); CanonicalTransform newTransform = (CanonicalTransform)this.initialTransforms[element].Clone(); newTransform.ApplyRotation(angle, fixedPoint); AdornedToolBehavior.UpdateElementTransform(element, newTransform, AdornedToolBehavior.TransformPropertyFlags.Translation | AdornedToolBehavior.TransformPropertyFlags.RotatationAngle); } if (this.EditingElementSet.HasHomogeneousRotation) { return; } this.EditingElementSet.Update(); this.UpdateEditTransaction(); this.EditingElement.ViewModel.DefaultView.UpdateLayout(); Vector vector1 = this.initialArtboardOrigin - this.EditingElement.DesignerContext.ActiveView.Artboard.ArtboardBounds.TopLeft; Rect bounds = this.EditingElementSet.Bounds; Rect rect = this.initialBounds; Point point3 = new Point(0.0, 0.0); Vector vector2 = this.initialBounds.TopLeft + new Point(this.intialRenderTransformOrigin.X * rect.Width, this.intialRenderTransformOrigin.Y * rect.Height) - point3 - bounds.TopLeft + vector1; vector2.X /= bounds.Width; vector2.Y /= bounds.Height; this.EditingElementSet.RenderTransformOrigin = RoundingHelper.RoundPosition(point3 + vector2); }