mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 13:10:00 -07:00
More fixes for Surface.Image size
- crop works properly; - Freehand drawings are selectable everywhere at all zoom levels. Known issue: freehand selection outline is not drawn
This commit is contained in:
parent
ec2c46daa8
commit
3d39241f82
2 changed files with 14 additions and 7 deletions
|
@ -47,8 +47,8 @@ namespace Greenshot.Drawing {
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FreehandContainer(Surface parent) : base(parent) {
|
public FreehandContainer(Surface parent) : base(parent) {
|
||||||
Width = parent.Width;
|
Width = parent.Image.Width;
|
||||||
Height = parent.Height;
|
Height = parent.Image.Height;
|
||||||
Top = 0;
|
Top = 0;
|
||||||
Left = 0;
|
Left = 0;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,14 @@ namespace Greenshot.Drawing {
|
||||||
int safetymargin = 10;
|
int safetymargin = 10;
|
||||||
return new Rectangle(myBounds.Left + Left - (safetymargin+lineThickness), myBounds.Top + Top - (safetymargin+lineThickness), myBounds.Width + 2*(lineThickness+safetymargin), myBounds.Height + 2*(lineThickness+safetymargin));
|
return new Rectangle(myBounds.Left + Left - (safetymargin+lineThickness), myBounds.Top + Top - (safetymargin+lineThickness), myBounds.Width + 2*(lineThickness+safetymargin), myBounds.Height + 2*(lineThickness+safetymargin));
|
||||||
}
|
}
|
||||||
return new Rectangle(0, 0, _parent?.Width??0, _parent?.Height?? 0);
|
if (_parent?.Image is Image image)
|
||||||
|
{
|
||||||
|
return new Rectangle(0, 0, image.Width, image.Height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Rectangle.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -991,13 +991,13 @@ namespace Greenshot.Drawing
|
||||||
{
|
{
|
||||||
cropRectangle = new Rectangle(cropRectangle.Left, 0, cropRectangle.Width, cropRectangle.Height + cropRectangle.Top);
|
cropRectangle = new Rectangle(cropRectangle.Left, 0, cropRectangle.Width, cropRectangle.Height + cropRectangle.Top);
|
||||||
}
|
}
|
||||||
if (cropRectangle.Left + cropRectangle.Width > Width)
|
if (cropRectangle.Left + cropRectangle.Width > Image.Width)
|
||||||
{
|
{
|
||||||
cropRectangle = new Rectangle(cropRectangle.Left, cropRectangle.Top, Width - cropRectangle.Left, cropRectangle.Height);
|
cropRectangle = new Rectangle(cropRectangle.Left, cropRectangle.Top, Image.Width - cropRectangle.Left, cropRectangle.Height);
|
||||||
}
|
}
|
||||||
if (cropRectangle.Top + cropRectangle.Height > Height)
|
if (cropRectangle.Top + cropRectangle.Height > Image.Height)
|
||||||
{
|
{
|
||||||
cropRectangle = new Rectangle(cropRectangle.Left, cropRectangle.Top, cropRectangle.Width, Height - cropRectangle.Top);
|
cropRectangle = new Rectangle(cropRectangle.Left, cropRectangle.Top, cropRectangle.Width, Image.Height - cropRectangle.Top);
|
||||||
}
|
}
|
||||||
if (cropRectangle.Height > 0 && cropRectangle.Width > 0)
|
if (cropRectangle.Height > 0 && cropRectangle.Width > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue