(修复)当AllowDrag为False时,通过单击鼠标没法显示光标,而是必须先双击再单击才能显示的问题
This commit is contained in:
@@ -320,7 +320,7 @@ public class TimeBox : TemplatedControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
_currentActiveSectionIndex = i;
|
_currentActiveSectionIndex = i;
|
||||||
|
|
||||||
if (e.ClickCount == 2)
|
if (e.ClickCount == 2)
|
||||||
{
|
{
|
||||||
EnterSection(_currentActiveSectionIndex.Value);
|
EnterSection(_currentActiveSectionIndex.Value);
|
||||||
@@ -332,7 +332,7 @@ public class TimeBox : TemplatedControl
|
|||||||
MoveCaret(_currentActiveSectionIndex.Value);
|
MoveCaret(_currentActiveSectionIndex.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
e.Pointer.Capture(_presenters[_currentActiveSectionIndex.Value]);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,13 +482,16 @@ public class TimeBox : TemplatedControl
|
|||||||
|
|
||||||
if (AllowDrag)
|
if (AllowDrag)
|
||||||
_dragPanels[index].IsVisible = false;
|
_dragPanels[index].IsVisible = false;
|
||||||
_presenters[index].ShowCaret();
|
ShowCaretInteral(index);
|
||||||
_isShowedCaret[index] = true;
|
|
||||||
_presenters[index].SelectAll();
|
_presenters[index].SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveCaret(int index)
|
private void MoveCaret(int index)
|
||||||
{
|
{
|
||||||
|
if (!_isShowedCaret[index])
|
||||||
|
{
|
||||||
|
ShowCaretInteral(index);
|
||||||
|
}
|
||||||
_presenters[index].ClearSelection();
|
_presenters[index].ClearSelection();
|
||||||
var caretPosition =
|
var caretPosition =
|
||||||
_pressedPosition.WithX(_pressedPosition.X - _borders[index].Bounds.X);
|
_pressedPosition.WithX(_pressedPosition.X - _borders[index].Bounds.X);
|
||||||
@@ -505,8 +508,7 @@ public class TimeBox : TemplatedControl
|
|||||||
_presenters[index].ClearSelection();
|
_presenters[index].ClearSelection();
|
||||||
if (_isShowedCaret[index])
|
if (_isShowedCaret[index])
|
||||||
{
|
{
|
||||||
_presenters[index].HideCaret();
|
HideCaretInteral(index);
|
||||||
_isShowedCaret[index] = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllowDrag)
|
if (AllowDrag)
|
||||||
@@ -696,4 +698,16 @@ public class TimeBox : TemplatedControl
|
|||||||
|
|
||||||
return milliSecond;
|
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