mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 04:06:05 +13:00
If region capture context menu closed because of right click then don't show context menu on mouse up, that way user can close context menu with right click
This commit is contained in:
parent
76d4f85f5f
commit
837db296b5
1 changed files with 17 additions and 2 deletions
|
@ -27,6 +27,7 @@ You should have received a copy of the GNU General Public License
|
||||||
using ShareX.ScreenCaptureLib.Properties;
|
using ShareX.ScreenCaptureLib.Properties;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -186,7 +187,8 @@ public bool NodesVisible
|
||||||
private ToolStripSeparator tssObjectOptions, tssShapeOptions;
|
private ToolStripSeparator tssObjectOptions, tssShapeOptions;
|
||||||
private ToolStripMenuItem tsmiDeleteSelected, tsmiDeleteAll, tsmiBorderColor, tsmiFillColor, tsmiHighlightColor, tsmiQuickCrop;
|
private ToolStripMenuItem tsmiDeleteSelected, tsmiDeleteAll, tsmiBorderColor, tsmiFillColor, tsmiHighlightColor, tsmiQuickCrop;
|
||||||
private ToolStripLabeledNumericUpDown tslnudBorderSize, tslnudCornerRadius, tslnudBlurRadius, tslnudPixelateSize;
|
private ToolStripLabeledNumericUpDown tslnudBorderSize, tslnudCornerRadius, tslnudBlurRadius, tslnudPixelateSize;
|
||||||
private bool isLeftPressed, isRightPressed, isUpPressed, isDownPressed;
|
private bool isLeftPressed, isRightPressed, isUpPressed, isDownPressed, allowOptionsMenu;
|
||||||
|
private Stopwatch cmsCloseTimer;
|
||||||
|
|
||||||
public ShapeManager(RegionCaptureForm form)
|
public ShapeManager(RegionCaptureForm form)
|
||||||
{
|
{
|
||||||
|
@ -255,6 +257,14 @@ private void CreateContextMenu()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cmsContextMenu.Closed += (sender, e) =>
|
||||||
|
{
|
||||||
|
if (e.CloseReason == ToolStripDropDownCloseReason.AppClicked)
|
||||||
|
{
|
||||||
|
cmsCloseTimer = Stopwatch.StartNew();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#region Editor mode
|
#region Editor mode
|
||||||
|
|
||||||
if (form.Mode == RegionCaptureMode.Editor)
|
if (form.Mode == RegionCaptureMode.Editor)
|
||||||
|
@ -914,6 +924,8 @@ private void form_LostFocus(object sender, EventArgs e)
|
||||||
|
|
||||||
private void form_MouseDown(object sender, MouseEventArgs e)
|
private void form_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
|
allowOptionsMenu = cmsCloseTimer == null || cmsCloseTimer.ElapsedMilliseconds > 100;
|
||||||
|
|
||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
if (!IsCreating)
|
if (!IsCreating)
|
||||||
|
@ -1245,7 +1257,10 @@ private void RunAction(RegionCaptureAction action)
|
||||||
DeleteIntersectShape();
|
DeleteIntersectShape();
|
||||||
break;
|
break;
|
||||||
case RegionCaptureAction.OpenOptionsMenu:
|
case RegionCaptureAction.OpenOptionsMenu:
|
||||||
OpenOptionsMenu();
|
if (allowOptionsMenu)
|
||||||
|
{
|
||||||
|
OpenOptionsMenu();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RegionCaptureAction.SwapToolType:
|
case RegionCaptureAction.SwapToolType:
|
||||||
SwapShapeType();
|
SwapShapeType();
|
||||||
|
|
Loading…
Reference in a new issue