mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-03 19:54:13 +13:00
Before open options menu select intersect shape
This commit is contained in:
parent
4b0a323c9c
commit
4c3a8c3dd4
2 changed files with 28 additions and 15 deletions
|
@ -219,8 +219,6 @@ protected override void Draw(Graphics g)
|
|||
effectShape.OnDraw(g);
|
||||
}
|
||||
|
||||
ShapeManager.OrderStepShapes();
|
||||
|
||||
// Draw drawing shapes
|
||||
foreach (BaseDrawingShape drawingShape in ShapeManager.DrawingShapes)
|
||||
{
|
||||
|
|
|
@ -1137,6 +1137,8 @@ private void RunAction(RegionCaptureAction action)
|
|||
|
||||
public void Update()
|
||||
{
|
||||
OrderStepShapes();
|
||||
|
||||
BaseShape shape = CurrentShape;
|
||||
|
||||
if (shape != null)
|
||||
|
@ -1156,13 +1158,13 @@ private void StartRegionSelection()
|
|||
return;
|
||||
}
|
||||
|
||||
BaseShape shape = GetShapeIntersect();
|
||||
BaseShape shape = GetIntersectShape();
|
||||
|
||||
if (shape != null && shape.ShapeType == CurrentShapeType) // Select shape
|
||||
{
|
||||
IsMoving = true;
|
||||
CurrentShape = shape;
|
||||
SelectShape();
|
||||
SelectCurrentShape();
|
||||
}
|
||||
else if (!IsCreating) // Create new shape
|
||||
{
|
||||
|
@ -1232,7 +1234,7 @@ private void EndRegionSelection()
|
|||
shape.OnCreated();
|
||||
}
|
||||
|
||||
SelectShape();
|
||||
SelectCurrentShape();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1339,6 +1341,8 @@ private void SwapShapeType()
|
|||
|
||||
private void OpenOptionsMenu()
|
||||
{
|
||||
SelectIntersectShape();
|
||||
|
||||
if (form.Mode == RectangleRegionMode.Annotation && cmsContextMenu != null)
|
||||
{
|
||||
cmsContextMenu.Show(form, InputManager.MousePosition0Based.Add(-10, -10));
|
||||
|
@ -1378,7 +1382,7 @@ private void CheckHover()
|
|||
|
||||
if (!IsCursorOnNode && !IsCreating && !IsMoving && !IsResizing)
|
||||
{
|
||||
BaseShape shape = GetShapeIntersect();
|
||||
BaseShape shape = GetIntersectShape();
|
||||
|
||||
if (shape != null && shape.IsValidShape)
|
||||
{
|
||||
|
@ -1477,7 +1481,7 @@ public Image RenderOutputImage(Image img)
|
|||
return bmp;
|
||||
}
|
||||
|
||||
private void SelectShape()
|
||||
private void SelectCurrentShape()
|
||||
{
|
||||
BaseShape shape = CurrentShape;
|
||||
|
||||
|
@ -1487,6 +1491,17 @@ private void SelectShape()
|
|||
}
|
||||
}
|
||||
|
||||
private void SelectIntersectShape()
|
||||
{
|
||||
BaseShape shape = GetIntersectShape();
|
||||
|
||||
if (shape != null)
|
||||
{
|
||||
CurrentShape = shape;
|
||||
SelectCurrentShape();
|
||||
}
|
||||
}
|
||||
|
||||
private void DeselectShape()
|
||||
{
|
||||
CurrentShape = null;
|
||||
|
@ -1506,7 +1521,7 @@ private void DeleteCurrentShape()
|
|||
|
||||
private void DeleteIntersectShape()
|
||||
{
|
||||
BaseShape shape = GetShapeIntersect();
|
||||
BaseShape shape = GetIntersectShape();
|
||||
|
||||
if (shape != null)
|
||||
{
|
||||
|
@ -1521,7 +1536,12 @@ private void ClearAll()
|
|||
DeselectShape();
|
||||
}
|
||||
|
||||
public BaseShape GetShapeIntersect(Point position)
|
||||
public BaseShape GetIntersectShape()
|
||||
{
|
||||
return GetIntersectShape(InputManager.MousePosition0Based);
|
||||
}
|
||||
|
||||
public BaseShape GetIntersectShape(Point position)
|
||||
{
|
||||
for (int i = Shapes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
|
@ -1536,14 +1556,9 @@ public BaseShape GetShapeIntersect(Point position)
|
|||
return null;
|
||||
}
|
||||
|
||||
public BaseShape GetShapeIntersect()
|
||||
{
|
||||
return GetShapeIntersect(InputManager.MousePosition0Based);
|
||||
}
|
||||
|
||||
public bool IsShapeIntersect()
|
||||
{
|
||||
return GetShapeIntersect() != null;
|
||||
return GetIntersectShape() != null;
|
||||
}
|
||||
|
||||
private void UpdateNodes()
|
||||
|
|
Loading…
Reference in a new issue