fix:合并冲突
This commit is contained in:
@@ -18,14 +18,12 @@
|
|||||||
<!-- 半透明遮罩 -->
|
<!-- 半透明遮罩 -->
|
||||||
<Rectangle Name="OverlayRectangle"
|
<Rectangle Name="OverlayRectangle"
|
||||||
Fill="Black"
|
Fill="Black"
|
||||||
Opacity="0.3"
|
Opacity="0.3" />
|
||||||
IsHitTestVisible="False" />
|
|
||||||
|
|
||||||
<!-- 透明选择区域遮罩 - 使用正确的几何体操作 -->
|
<!-- 透明选择区域遮罩 - 使用正确的几何体操作 -->
|
||||||
<Rectangle Name="TransparentSelectionMask"
|
<Rectangle Name="TransparentSelectionMask"
|
||||||
Fill="Black"
|
Fill="Black"
|
||||||
Opacity="0.3"
|
Opacity="0.3"
|
||||||
IsHitTestVisible="False"
|
|
||||||
Visibility="Collapsed">
|
Visibility="Collapsed">
|
||||||
<Rectangle.Clip>
|
<Rectangle.Clip>
|
||||||
<CombinedGeometry GeometryCombineMode="Exclude">
|
<CombinedGeometry GeometryCombineMode="Exclude">
|
||||||
@@ -45,9 +43,8 @@
|
|||||||
<Rectangle Name="SelectionRectangle"
|
<Rectangle Name="SelectionRectangle"
|
||||||
Stroke="White"
|
Stroke="White"
|
||||||
StrokeThickness="1"
|
StrokeThickness="1"
|
||||||
Fill="#01FFFFFF"
|
Fill="#01000000"
|
||||||
Visibility="Collapsed"
|
Visibility="Collapsed"
|
||||||
IsHitTestVisible="True"
|
|
||||||
Panel.ZIndex="1001"
|
Panel.ZIndex="1001"
|
||||||
MouseLeftButtonDown="SelectionRectangle_MouseLeftButtonDown"
|
MouseLeftButtonDown="SelectionRectangle_MouseLeftButtonDown"
|
||||||
MouseLeftButtonUp="SelectionRectangle_MouseLeftButtonUp"
|
MouseLeftButtonUp="SelectionRectangle_MouseLeftButtonUp"
|
||||||
|
|||||||
@@ -471,6 +471,10 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
// 确保选择矩形在调整模式下可见
|
// 确保选择矩形在调整模式下可见
|
||||||
SelectionRectangle.Visibility = Visibility.Visible;
|
SelectionRectangle.Visibility = Visibility.Visible;
|
||||||
|
// 设置选择矩形的Z-index,确保它能够接收鼠标事件
|
||||||
|
WpfCanvas.SetZIndex(SelectionRectangle, 1001);
|
||||||
|
// 确保选择矩形能够接收鼠标事件
|
||||||
|
SelectionRectangle.IsHitTestVisible = true;
|
||||||
ControlPointsCanvas.Visibility = Visibility.Visible;
|
ControlPointsCanvas.Visibility = Visibility.Visible;
|
||||||
UpdateControlPointsPosition();
|
UpdateControlPointsPosition();
|
||||||
}
|
}
|
||||||
@@ -516,6 +520,12 @@ namespace Ink_Canvas
|
|||||||
SelectionRectangle.Width = rect.Width;
|
SelectionRectangle.Width = rect.Width;
|
||||||
SelectionRectangle.Height = rect.Height;
|
SelectionRectangle.Height = rect.Height;
|
||||||
|
|
||||||
|
// 在选择过程中,禁用选择矩形的鼠标事件,避免干扰选择操作
|
||||||
|
if (_isSelecting)
|
||||||
|
{
|
||||||
|
SelectionRectangle.IsHitTestVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
// 更新透明选择区域遮罩
|
// 更新透明选择区域遮罩
|
||||||
UpdateTransparentSelectionMask(rect);
|
UpdateTransparentSelectionMask(rect);
|
||||||
|
|
||||||
@@ -542,7 +552,7 @@ namespace Ink_Canvas
|
|||||||
TransparentSelectionMask.Visibility = Visibility.Visible;
|
TransparentSelectionMask.Visibility = Visibility.Visible;
|
||||||
OverlayRectangle.Visibility = Visibility.Collapsed;
|
OverlayRectangle.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
// 如果几何体操作失败,回退到原始遮罩
|
// 如果几何体操作失败,回退到原始遮罩
|
||||||
TransparentSelectionMask.Visibility = Visibility.Collapsed;
|
TransparentSelectionMask.Visibility = Visibility.Collapsed;
|
||||||
@@ -560,6 +570,13 @@ namespace Ink_Canvas
|
|||||||
SelectionRectangle.Width = rect.Width;
|
SelectionRectangle.Width = rect.Width;
|
||||||
SelectionRectangle.Height = rect.Height;
|
SelectionRectangle.Height = rect.Height;
|
||||||
|
|
||||||
|
// 确保选择矩形在调整模式下能够接收鼠标事件
|
||||||
|
if (_isAdjusting)
|
||||||
|
{
|
||||||
|
SelectionRectangle.IsHitTestVisible = true;
|
||||||
|
WpfCanvas.SetZIndex(SelectionRectangle, 1001);
|
||||||
|
}
|
||||||
|
|
||||||
// 更新透明选择区域遮罩
|
// 更新透明选择区域遮罩
|
||||||
UpdateTransparentSelectionMask(rect);
|
UpdateTransparentSelectionMask(rect);
|
||||||
|
|
||||||
@@ -711,9 +728,6 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
private void SelectionRectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void SelectionRectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
// 添加调试信息
|
|
||||||
System.Diagnostics.Debug.WriteLine($"SelectionRectangle_MouseLeftButtonDown: _isAdjusting={_isAdjusting}");
|
|
||||||
|
|
||||||
if (!_isAdjusting) return;
|
if (!_isAdjusting) return;
|
||||||
|
|
||||||
_isMoving = true;
|
_isMoving = true;
|
||||||
@@ -723,8 +737,6 @@ namespace Ink_Canvas
|
|||||||
// 捕获鼠标到选择矩形
|
// 捕获鼠标到选择矩形
|
||||||
SelectionRectangle.CaptureMouse();
|
SelectionRectangle.CaptureMouse();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
||||||
System.Diagnostics.Debug.WriteLine("SelectionRectangle mouse capture started");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectionRectangle_MouseMove(object sender, MouseEventArgs e)
|
private void SelectionRectangle_MouseMove(object sender, MouseEventArgs e)
|
||||||
@@ -753,14 +765,10 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
_lastMousePosition = currentPosition;
|
_lastMousePosition = currentPosition;
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
||||||
// 添加调试信息
|
|
||||||
System.Diagnostics.Debug.WriteLine($"SelectionRectangle moving: delta=({delta.X}, {delta.Y}), newRect=({newRect.X}, {newRect.Y}, {newRect.Width}, {newRect.Height})");
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
// 如果出现异常,停止移动
|
// 如果出现异常,停止移动
|
||||||
System.Diagnostics.Debug.WriteLine($"SelectionRectangle move error: {ex.Message}");
|
|
||||||
_isMoving = false;
|
_isMoving = false;
|
||||||
_activeControlPoint = ControlPointType.None;
|
_activeControlPoint = ControlPointType.None;
|
||||||
SelectionRectangle.ReleaseMouseCapture();
|
SelectionRectangle.ReleaseMouseCapture();
|
||||||
@@ -793,6 +801,7 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
// 清除矩形选择的内容
|
// 清除矩形选择的内容
|
||||||
SelectionRectangle.Visibility = Visibility.Collapsed;
|
SelectionRectangle.Visibility = Visibility.Collapsed;
|
||||||
|
SelectionRectangle.IsHitTestVisible = false;
|
||||||
ControlPointsCanvas.Visibility = Visibility.Collapsed;
|
ControlPointsCanvas.Visibility = Visibility.Collapsed;
|
||||||
SizeInfoBorder.Visibility = Visibility.Collapsed;
|
SizeInfoBorder.Visibility = Visibility.Collapsed;
|
||||||
SelectionPath.Visibility = Visibility.Collapsed;
|
SelectionPath.Visibility = Visibility.Collapsed;
|
||||||
@@ -807,7 +816,6 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
ReleaseMouseCapture();
|
ReleaseMouseCapture();
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
// 释放选择矩形的鼠标捕获
|
// 释放选择矩形的鼠标捕获
|
||||||
if (SelectionRectangle.IsMouseCaptured)
|
if (SelectionRectangle.IsMouseCaptured)
|
||||||
@@ -815,9 +823,6 @@ namespace Ink_Canvas
|
|||||||
SelectionRectangle.ReleaseMouseCapture();
|
SelectionRectangle.ReleaseMouseCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> ff086e497c2dc751d72f3a6d72ce5d883b297672
|
|
||||||
// 重置选择区域
|
// 重置选择区域
|
||||||
_currentSelection = new Rect();
|
_currentSelection = new Rect();
|
||||||
SelectedArea = null;
|
SelectedArea = null;
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user