mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 22:34:27 -07:00
BUG-2300: A small fix for the undo/redo issue in the editor, where the moves are not merged.
This commit is contained in:
parent
5921cb77da
commit
18c41080a6
2 changed files with 16 additions and 11 deletions
|
@ -42,7 +42,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
|
||||||
{
|
{
|
||||||
private NativeRectFloat _boundsAfterResize = NativeRectFloat.Empty;
|
private NativeRectFloat _boundsAfterResize = NativeRectFloat.Empty;
|
||||||
private NativeRectFloat _boundsBeforeResize = NativeRectFloat.Empty;
|
private NativeRectFloat _boundsBeforeResize = NativeRectFloat.Empty;
|
||||||
|
private bool _initialMoveAfterMouseDown = true;
|
||||||
public MoveAdorner(IDrawableContainer owner, Positions position) : base(owner)
|
public MoveAdorner(IDrawableContainer owner, Positions position) : base(owner)
|
||||||
{
|
{
|
||||||
Position = position;
|
Position = position;
|
||||||
|
@ -112,6 +112,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
|
||||||
EditStatus = EditStatus.RESIZING;
|
EditStatus = EditStatus.RESIZING;
|
||||||
_boundsBeforeResize = new NativeRectFloat(Owner.Left, Owner.Top, Owner.Width, Owner.Height);
|
_boundsBeforeResize = new NativeRectFloat(Owner.Left, Owner.Top, Owner.Width, Owner.Height);
|
||||||
_boundsAfterResize = _boundsBeforeResize;
|
_boundsAfterResize = _boundsBeforeResize;
|
||||||
|
_initialMoveAfterMouseDown = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -126,10 +128,12 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Owner.Invalidate();
|
Owner.Invalidate();
|
||||||
Owner.MakeBoundsChangeUndoable(false);
|
// Make merges in this drag, meaning as long as it's not the initial move we merge
|
||||||
|
Owner.MakeBoundsChangeUndoable(!_initialMoveAfterMouseDown);
|
||||||
|
_initialMoveAfterMouseDown = false;
|
||||||
|
|
||||||
// reset "workbench" rectangle to current bounds
|
// reset "workbench" rectangle to current bounds
|
||||||
_boundsAfterResize = _boundsBeforeResize;
|
_boundsAfterResize = _boundsBeforeResize;
|
||||||
|
|
||||||
// calculate scaled rectangle
|
// calculate scaled rectangle
|
||||||
ScaleHelper.Scale(ref _boundsAfterResize, Position, new NativePointFloat(mouseEventArgs.X, mouseEventArgs.Y), ScaleHelper.GetScaleOptions());
|
ScaleHelper.Scale(ref _boundsAfterResize, Position, new NativePointFloat(mouseEventArgs.X, mouseEventArgs.Y), ScaleHelper.GetScaleOptions());
|
||||||
|
|
|
@ -66,14 +66,15 @@ namespace Greenshot.Addon.LegacyEditor.Memento
|
||||||
|
|
||||||
public bool Merge(IMemento otherMemento)
|
public bool Merge(IMemento otherMemento)
|
||||||
{
|
{
|
||||||
var other = otherMemento as DrawableContainerBoundsChangeMemento;
|
if (!(otherMemento is DrawableContainerBoundsChangeMemento other))
|
||||||
if (other != null)
|
|
||||||
{
|
{
|
||||||
if (ObjectExtensions.CompareLists(_listOfdrawableContainer, other._listOfdrawableContainer))
|
return false;
|
||||||
{
|
}
|
||||||
// Lists are equal, as we have the state already we can ignore the new memento
|
|
||||||
return true;
|
if (ObjectExtensions.CompareLists(_listOfdrawableContainer, other._listOfdrawableContainer))
|
||||||
}
|
{
|
||||||
|
// Lists are equal, as we have the state already we can ignore the new memento
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue