mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-05 20:54:31 +13:00
If image dialog is canceled then remove image shape
This commit is contained in:
parent
59f0b43c18
commit
f9ec01a2c1
3 changed files with 15 additions and 3 deletions
|
@ -90,6 +90,11 @@ public virtual bool Intersects(Point position)
|
||||||
return Rectangle.Contains(position);
|
return Rectangle.Contains(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Remove()
|
||||||
|
{
|
||||||
|
Manager.DeleteShape(this);
|
||||||
|
}
|
||||||
|
|
||||||
public void AddShapePath(GraphicsPath gp, int sizeOffset = 0)
|
public void AddShapePath(GraphicsPath gp, int sizeOffset = 0)
|
||||||
{
|
{
|
||||||
Rectangle rect = Rectangle;
|
Rectangle rect = Rectangle;
|
||||||
|
|
|
@ -58,7 +58,7 @@ public void SetImage(Image img, bool centerImage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenImageDialog(bool centerImage)
|
public bool OpenImageDialog(bool centerImage)
|
||||||
{
|
{
|
||||||
Manager.IsMoving = false;
|
Manager.IsMoving = false;
|
||||||
|
|
||||||
|
@ -71,8 +71,12 @@ public void OpenImageDialog(bool centerImage)
|
||||||
if (img != null)
|
if (img != null)
|
||||||
{
|
{
|
||||||
SetImage(img, centerImage);
|
SetImage(img, centerImage);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDraw(Graphics g)
|
public override void OnDraw(Graphics g)
|
||||||
|
@ -87,7 +91,10 @@ public override void OnCreating()
|
||||||
{
|
{
|
||||||
StartPosition = EndPosition = InputManager.MousePosition0Based;
|
StartPosition = EndPosition = InputManager.MousePosition0Based;
|
||||||
|
|
||||||
OpenImageDialog(true);
|
if (!OpenImageDialog(true))
|
||||||
|
{
|
||||||
|
Remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClicked()
|
public override void OnDoubleClicked()
|
||||||
|
|
|
@ -1526,7 +1526,7 @@ private void DeselectCurrentShape()
|
||||||
DeselectShape(CurrentShape);
|
DeselectShape(CurrentShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteShape(BaseShape shape)
|
public void DeleteShape(BaseShape shape)
|
||||||
{
|
{
|
||||||
if (shape != null)
|
if (shape != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue