mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Fixed rotating elements which are just rectangles, like the enum-label.
This commit is contained in:
parent
9d668f5226
commit
c19564b6e3
3 changed files with 15 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue