mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 03:00:22 +12:00
Fixed undo/redo bug
This commit is contained in:
parent
e5fe1a8e70
commit
aa6f127825
|
@ -191,6 +191,9 @@ private set
|
|||
public bool IsCurrentHoverShapeValid => CurrentHoverShape != null && CurrentHoverShape.IsValidShape;
|
||||
|
||||
public bool IsCurrentShapeTypeRegion => IsShapeTypeRegion(CurrentTool);
|
||||
|
||||
public bool IsCurrentShapeTypeTool => IsShapeTypeTool(CurrentTool);
|
||||
|
||||
public int StartingStepNumber { get; set; } = 1;
|
||||
|
||||
public bool IsCreating { get; set; }
|
||||
|
@ -956,10 +959,12 @@ public void StartRegionSelection()
|
|||
if (shape != null && shape.IsSelectable) // Select shape
|
||||
{
|
||||
DeselectCurrentShape();
|
||||
|
||||
if (!IsMoving)
|
||||
{
|
||||
history.CreateShapesMemento();
|
||||
}
|
||||
|
||||
IsMoving = true;
|
||||
shape.OnMoving();
|
||||
CurrentShape = shape;
|
||||
|
@ -974,7 +979,12 @@ public void StartRegionSelection()
|
|||
{
|
||||
ClearTools();
|
||||
DeselectCurrentShape();
|
||||
history.CreateShapesMemento();
|
||||
|
||||
if (!IsCurrentShapeTypeRegion && !IsCurrentShapeTypeTool)
|
||||
{
|
||||
history.CreateShapesMemento();
|
||||
}
|
||||
|
||||
shape = AddShape();
|
||||
shape.OnCreating();
|
||||
}
|
||||
|
@ -1558,6 +1568,8 @@ public void RestoreState(ImageEditorMemento memento)
|
|||
effect.OnMoved();
|
||||
}
|
||||
|
||||
ClearTools();
|
||||
DeselectCurrentShape();
|
||||
OnImageModified();
|
||||
UpdateMenu();
|
||||
}
|
||||
|
@ -1789,6 +1801,19 @@ private bool IsShapeTypeRegion(ShapeType shapeType)
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool IsShapeTypeTool(ShapeType shapeType)
|
||||
{
|
||||
switch (shapeType)
|
||||
{
|
||||
case ShapeType.ToolSelect:
|
||||
case ShapeType.ToolCrop:
|
||||
case ShapeType.ToolCutOut:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateNodes()
|
||||
{
|
||||
BaseShape shape = CurrentShape;
|
||||
|
|
Loading…
Reference in a new issue