Deselect shape before selecting new one, this ensures the correct behavior when switching between types

This commit is contained in:
Daniel Kuschny 2019-04-15 20:59:18 +02:00
parent 2957763918
commit f34666816b

View file

@ -96,12 +96,12 @@ public ShapeType CurrentTool
if (CurrentShape != null)
{
// do not keep selection if select tool does not handle it
if ((currentTool == ShapeType.ToolSelect && !CurrentShape.IsHandledBySelectTool))
if (currentTool == ShapeType.ToolSelect && !CurrentShape.IsHandledBySelectTool)
{
DeselectCurrentShape();
}
// do not keep selection if we switch away from select tool and the selected shape does not match the new type
else if (previousTool == ShapeType.ToolSelect && CurrentShape.ShapeType != currentTool)
// do not keep selection if we switch away from a tool and the selected shape does not match the new type
else if (CurrentShape.ShapeType != currentTool)
{
DeselectCurrentShape();
}
@ -820,6 +820,7 @@ private void StartRegionSelection()
if (shape != null && shape.IsSelectable) // Select shape
{
DeselectCurrentShape();
IsMoving = true;
shape.OnMoving();
Form.Cursor = Cursors.SizeAll;