Skip to content

Commit e426523

Browse files
committed
perf: Optimize potential issues during the freeze window switch
1 parent 0862d3d commit e426523

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ScreenGrab/ScreenGrabView.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public ScreenGrabView(Action<Bitmap>? action, bool isAuxiliary = false)
4848
private double _yShiftDelta;
4949
private Point _promptMsgTopLeft;
5050
private Point _promptMsgBottomRight;
51+
private bool _isFreezeHandle;
5152

5253
private readonly Border _selectBorder = new();
5354
private const double SelectBorderThickness = 2;
@@ -146,6 +147,7 @@ private void SetImageToBackground()
146147

147148
private async void FreezeUnfreeze()
148149
{
150+
_isFreezeHandle = true;
149151
if (BackgroundImage.Source == null)
150152
{
151153
if (_isAuxiliary)
@@ -171,6 +173,7 @@ private async void FreezeUnfreeze()
171173
// 刷新提示词
172174
FreezeTb.Text = "冻结窗口";
173175
}
176+
_isFreezeHandle = false;
174177
}
175178

176179
private void CloseAllScreenGrabs()
@@ -282,6 +285,8 @@ private void RegionClickCanvas_MouseDown(object sender, MouseButtonEventArgs e)
282285

283286
private void RegionClickCanvas_MouseMove(object sender, MouseEventArgs e)
284287
{
288+
if (_isFreezeHandle) return;
289+
285290
var movingPoint = e.GetPosition(this);
286291

287292
if (!_isSelecting)

0 commit comments

Comments
 (0)