From dd98227dac03f49565fc74c6af9c3dea2a56ec97 Mon Sep 17 00:00:00 2001 From: LiWenhao Date: Sat, 18 May 2024 00:34:08 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=88=E4=BF=AE=E5=A4=8D=EF=BC=89=E5=BD=93Al?= =?UTF-8?q?lowDrag=E4=B8=BAFalse=E6=97=B6=EF=BC=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=8D=95=E5=87=BB=E9=BC=A0=E6=A0=87=E6=B2=A1=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=85=89=E6=A0=87=EF=BC=8C=E8=80=8C=E6=98=AF=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E5=85=88=E5=8F=8C=E5=87=BB=E5=86=8D=E5=8D=95=E5=87=BB?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Ursa/Controls/TimeBox.cs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Ursa/Controls/TimeBox.cs b/src/Ursa/Controls/TimeBox.cs index 60eccfd..88b482b 100644 --- a/src/Ursa/Controls/TimeBox.cs +++ b/src/Ursa/Controls/TimeBox.cs @@ -320,7 +320,7 @@ public class TimeBox : TemplatedControl } _currentActiveSectionIndex = i; - + if (e.ClickCount == 2) { EnterSection(_currentActiveSectionIndex.Value); @@ -332,7 +332,7 @@ public class TimeBox : TemplatedControl MoveCaret(_currentActiveSectionIndex.Value); } } - + e.Pointer.Capture(_presenters[_currentActiveSectionIndex.Value]); e.Handled = true; } @@ -482,13 +482,16 @@ public class TimeBox : TemplatedControl if (AllowDrag) _dragPanels[index].IsVisible = false; - _presenters[index].ShowCaret(); - _isShowedCaret[index] = true; + ShowCaretInteral(index); _presenters[index].SelectAll(); } private void MoveCaret(int index) { + if (!_isShowedCaret[index]) + { + ShowCaretInteral(index); + } _presenters[index].ClearSelection(); var caretPosition = _pressedPosition.WithX(_pressedPosition.X - _borders[index].Bounds.X); @@ -505,8 +508,7 @@ public class TimeBox : TemplatedControl _presenters[index].ClearSelection(); if (_isShowedCaret[index]) { - _presenters[index].HideCaret(); - _isShowedCaret[index] = false; + HideCaretInteral(index); } if (AllowDrag) @@ -696,4 +698,16 @@ public class TimeBox : TemplatedControl return milliSecond; } + + private void ShowCaretInteral(int index) + { + _presenters[index].ShowCaret(); + _isShowedCaret[index] = true; + } + + private void HideCaretInteral(int index) + { + _presenters[index].HideCaret(); + _isShowedCaret[index] = false; + } } \ No newline at end of file