[MouseHighlighter]Remove lower limit of fade delay and duration (#29352)

* Removed limit for MouseHighlighter Animation Duration and Animation Delay.
(If user sets these values to 0ms, it will actually be set to 1ms to avoid crashing the app)

* Update MouseHighlighter.cpp

Removed the hack ;D

* Update MouseHighlighter.cpp

* Update MouseUtilsPage.xaml

Changed the values to 1

* Update MouseHighlighter.cpp

Reintroducing workaround

* Update MouseUtilsPage.xaml

Changed the minimum values for FadeDelayMs and FadeDuration back to 0.
This commit is contained in:
Fredrik Salomonsson
2023-10-24 12:11:29 +02:00
committed by GitHub
parent 547467e45e
commit 8eb48676f2
2 changed files with 11 additions and 2 deletions

View File

@@ -212,6 +212,15 @@ void Highlighter::StartDrawingPointFading(MouseButton button)
auto animation = m_compositor.CreateColorKeyFrameAnimation();
animation.InsertKeyFrame(1, winrt::Windows::UI::ColorHelper::FromArgb(0, brushColor.R, brushColor.G, brushColor.B));
using timeSpan = std::chrono::duration<int, std::ratio<1, 1000>>;
// HACK: If user sets these durations to 0, the fade won't work. Setting them to 1ms instead to avoid this.
if (m_fadeDuration_ms == 0)
{
m_fadeDuration_ms = 1;
}
if (m_fadeDelay_ms == 0)
{
m_fadeDelay_ms = 1;
}
std::chrono::milliseconds duration(m_fadeDuration_ms);
std::chrono::milliseconds delay(m_fadeDelay_ms);
animation.Duration(timeSpan(duration));