mirror of
https://github.com/greenshot/greenshot
synced 2025-07-06 04:52:16 -07:00
Fixed an issue with the adorner size, which stayed on 0, so it wasn't visible.
This commit is contained in:
parent
acdbdeca3c
commit
8880578f77
3 changed files with 32 additions and 7 deletions
|
@ -256,5 +256,13 @@ namespace Greenshot.Base.Interfaces
|
||||||
/// <param name="previous">Image</param>
|
/// <param name="previous">Image</param>
|
||||||
/// <param name="matrix">Matrix</param>
|
/// <param name="matrix">Matrix</param>
|
||||||
void UndoBackgroundChange(Image previous, Matrix matrix);
|
void UndoBackgroundChange(Image previous, Matrix matrix);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The most recent DPI value that was used
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentDpi
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,12 +34,17 @@ namespace Greenshot.Editor.Drawing.Adorners
|
||||||
{
|
{
|
||||||
public virtual EditStatus EditStatus { get; protected set; } = EditStatus.IDLE;
|
public virtual EditStatus EditStatus { get; protected set; } = EditStatus.IDLE;
|
||||||
|
|
||||||
private static readonly NativeSize DefaultSize = new NativeSize(6, 6);
|
private static readonly NativeSize DefaultSize = new(6, 6);
|
||||||
protected NativeSize _size;
|
|
||||||
|
protected NativeSize Size
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public AbstractAdorner(IDrawableContainer owner)
|
public AbstractAdorner(IDrawableContainer owner)
|
||||||
{
|
{
|
||||||
_size = DpiCalculator.ScaleWithDpi(DefaultSize, 0);
|
Size = DpiCalculator.ScaleWithDpi(DefaultSize, owner?.Parent?.CurrentDpi ?? 96);
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +56,7 @@ namespace Greenshot.Editor.Drawing.Adorners
|
||||||
get { return Cursors.SizeAll; }
|
get { return Cursors.SizeAll; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IDrawableContainer Owner { get; set; }
|
public IDrawableContainer Owner { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test if the point is inside the adorner
|
/// Test if the point is inside the adorner
|
||||||
|
@ -105,7 +110,7 @@ namespace Greenshot.Editor.Drawing.Adorners
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
NativePoint location = Location;
|
NativePoint location = Location;
|
||||||
return new NativeRect(location.X - (_size.Width / 2), location.Y - (_size.Height / 2), _size.Width, _size.Height);
|
return new NativeRect(location.X - (Size.Width / 2), location.Y - (Size.Height / 2), Size.Width, Size.Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +122,7 @@ namespace Greenshot.Editor.Drawing.Adorners
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
NativePoint displayLocation = Owner.Parent.ToSurfaceCoordinates(Location);
|
NativePoint displayLocation = Owner.Parent.ToSurfaceCoordinates(Location);
|
||||||
return new NativeRect(displayLocation.X - _size.Width / 2, displayLocation.Y - _size.Height / 2, _size.Width, _size.Height);
|
return new NativeRect(displayLocation.X - Size.Width / 2, displayLocation.Y - Size.Height / 2, Size.Width, Size.Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +140,7 @@ namespace Greenshot.Editor.Drawing.Adorners
|
||||||
/// <param name="dpi">uint</param>
|
/// <param name="dpi">uint</param>
|
||||||
public void AdjustToDpi(int dpi)
|
public void AdjustToDpi(int dpi)
|
||||||
{
|
{
|
||||||
_size = DpiCalculator.ScaleWithDpi(DefaultSize, dpi);
|
Size = DpiCalculator.ScaleWithDpi(DefaultSize, dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color OutlineColor { get; set; } = Color.White;
|
public Color OutlineColor { get; set; } = Color.White;
|
||||||
|
|
|
@ -145,6 +145,17 @@ namespace Greenshot.Editor.Drawing
|
||||||
remove => _shadowChanged -= value;
|
remove => _shadowChanged -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[NonSerialized] private int _currentDpi = 96;
|
||||||
|
/// <summary>
|
||||||
|
/// The most recent DPI value that was used
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentDpi
|
||||||
|
{
|
||||||
|
get => _currentDpi;
|
||||||
|
set => _currentDpi = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// inUndoRedo makes sure we don't undo/redo while in a undo/redo action
|
/// inUndoRedo makes sure we don't undo/redo while in a undo/redo action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -456,6 +467,7 @@ namespace Greenshot.Editor.Drawing
|
||||||
/// <param name="dpi"></param>
|
/// <param name="dpi"></param>
|
||||||
public void AdjustToDpi(int dpi)
|
public void AdjustToDpi(int dpi)
|
||||||
{
|
{
|
||||||
|
CurrentDpi = dpi;
|
||||||
foreach (var element in this._elements)
|
foreach (var element in this._elements)
|
||||||
{
|
{
|
||||||
element.AdjustToDpi(dpi);
|
element.AdjustToDpi(dpi);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue