diff --git a/Greenshot/Drawing/DrawableContainer.cs b/Greenshot/Drawing/DrawableContainer.cs index 78ba171fd..82d0e178f 100644 --- a/Greenshot/Drawing/DrawableContainer.cs +++ b/Greenshot/Drawing/DrawableContainer.cs @@ -707,6 +707,18 @@ namespace Greenshot.Drawing { } } + public virtual void Transform(Matrix matrix) { + if (matrix == null) { + return; + } + Point center = new Point(Left + (Width/2), Top + (Height/2)); + Point[] points = { center }; + matrix.TransformPoints(points); + + Left = points[0].X - (Width / 2); + Top = points[0].Y - (Height / 2); + } + public virtual void Rotate(RotateFlipType rotateFlipType) { // somehow the rotation is the wrong way? int angle = 90; diff --git a/Greenshot/Drawing/DrawableContainerList.cs b/Greenshot/Drawing/DrawableContainerList.cs index ec5ad5893..7b0070034 100644 --- a/Greenshot/Drawing/DrawableContainerList.cs +++ b/Greenshot/Drawing/DrawableContainerList.cs @@ -135,11 +135,7 @@ namespace Greenshot.Drawing { bool modified = false; Invalidate(); foreach (var dc in this) { - Point[] location = { dc.Location }; - matrix.TransformPoints(location); - - dc.Left = location[0].X; - dc.Top = location[0].Y; + dc.Transform(matrix); modified = true; } // Invalidate after diff --git a/GreenshotPlugin/Interfaces/Drawing/Container.cs b/GreenshotPlugin/Interfaces/Drawing/Container.cs index 74f4542c0..ce0d44f32 100644 --- a/GreenshotPlugin/Interfaces/Drawing/Container.cs +++ b/GreenshotPlugin/Interfaces/Drawing/Container.cs @@ -20,6 +20,7 @@ */ using System; using System.Drawing; +using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Windows.Forms; using System.ComponentModel; @@ -87,6 +88,7 @@ namespace Greenshot.Plugin.Drawing { void HideGrippers(); void ShowGrippers(); void MoveBy(int x, int y); + void Transform(Matrix matrix); bool HandleMouseDown(int x, int y); void HandleMouseUp(int x, int y); bool HandleMouseMove(int x, int y);