(修复)当AllowDrag为False时,通过单击鼠标没法显示光标,而是必须先双击再单击才能显示的问题
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user