mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-20 01:59:50 +01:00
Compare commits
3 Commits
async-cpp-
...
cinnamon/s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4920f8dcf8 | ||
|
|
d9b2c9dc15 | ||
|
|
8e74e18365 |
@@ -714,16 +714,33 @@ private:
|
|||||||
m_backdrop.RelativeSizeAdjustment({ 1.0f, 1.0f }); // fill the parent
|
m_backdrop.RelativeSizeAdjustment({ 1.0f, 1.0f }); // fill the parent
|
||||||
m_backdrop.Brush(m_compositor.CreateColorBrush(m_backgroundColor));
|
m_backdrop.Brush(m_compositor.CreateColorBrush(m_backgroundColor));
|
||||||
layer.Children().InsertAtTop(m_backdrop);
|
layer.Children().InsertAtTop(m_backdrop);
|
||||||
|
|
||||||
m_circleGeometry = m_compositor.CreateEllipseGeometry(); // radius set via expression animation
|
m_circleGeometry = m_compositor.CreateEllipseGeometry(); // radius set via expression animation
|
||||||
|
m_circleGeometry.Radius({ m_sonarRadiusFloat * m_sonarZoomFactor, m_sonarRadiusFloat * m_sonarZoomFactor });
|
||||||
|
|
||||||
m_circleShape = m_compositor.CreateSpriteShape(m_circleGeometry);
|
m_circleShape = m_compositor.CreateSpriteShape(m_circleGeometry);
|
||||||
m_circleShape.FillBrush(m_compositor.CreateColorBrush(m_spotlightColor));
|
m_circleShape.FillBrush(m_compositor.CreateColorBrush(m_spotlightColor));
|
||||||
m_circleShape.Offset({ m_sonarRadiusFloat * m_sonarZoomFactor, m_sonarRadiusFloat * m_sonarZoomFactor });
|
m_circleShape.Offset({ m_sonarRadiusFloat * m_sonarZoomFactor, m_sonarRadiusFloat * m_sonarZoomFactor });
|
||||||
|
|
||||||
m_spotlight = m_compositor.CreateShapeVisual();
|
m_spotlight = m_compositor.CreateShapeVisual();
|
||||||
m_spotlight.Size({ m_sonarRadiusFloat * 2 * m_sonarZoomFactor, m_sonarRadiusFloat * 2 * m_sonarZoomFactor });
|
m_spotlight.Size({ m_sonarRadiusFloat * 2 * m_sonarZoomFactor, m_sonarRadiusFloat * 2 * m_sonarZoomFactor });
|
||||||
m_spotlight.AnchorPoint({ 0.5f, 0.5f });
|
m_spotlight.AnchorPoint({ 0.5f, 0.5f });
|
||||||
|
m_spotlight.Opacity(m_spotlightColor.A);
|
||||||
m_spotlight.Shapes().Append(m_circleShape);
|
m_spotlight.Shapes().Append(m_circleShape);
|
||||||
|
|
||||||
|
// auto maskBrush = m_compositor.CreateMaskBrush();
|
||||||
|
// maskBrush.Source(m_compositor.CreateColorBrush(winrt::Windows::UI::Colors::Black()));
|
||||||
|
// maskBrush.Mask(m_circleShape.FillBrush());
|
||||||
|
|
||||||
|
// auto clipGeometry = m_compositor.CreateEllipseGeometry();
|
||||||
|
// clipGeometry.Center(m_circleShape.Offset());
|
||||||
|
// clipGeometry.Radius(m_spotlight.Size());
|
||||||
|
auto clip = m_compositor.CreateGeometricClip(m_circleGeometry);
|
||||||
|
// layer.Clip(clip);
|
||||||
|
m_backdrop.Clip(clip);
|
||||||
|
|
||||||
|
// m_backdrop.Brush(maskBrush);
|
||||||
|
|
||||||
layer.Children().InsertAtTop(m_spotlight);
|
layer.Children().InsertAtTop(m_spotlight);
|
||||||
|
|
||||||
// Implicitly animate the alpha.
|
// Implicitly animate the alpha.
|
||||||
@@ -816,6 +833,7 @@ public:
|
|||||||
m_circleShape.FillBrush().as<winrt::CompositionColorBrush>().Color(m_spotlightColor);
|
m_circleShape.FillBrush().as<winrt::CompositionColorBrush>().Color(m_spotlightColor);
|
||||||
m_circleShape.Offset({ m_sonarRadiusFloat * m_sonarZoomFactor, m_sonarRadiusFloat * m_sonarZoomFactor });
|
m_circleShape.Offset({ m_sonarRadiusFloat * m_sonarZoomFactor, m_sonarRadiusFloat * m_sonarZoomFactor });
|
||||||
m_spotlight.Size({ m_sonarRadiusFloat * 2 * m_sonarZoomFactor, m_sonarRadiusFloat * 2 * m_sonarZoomFactor });
|
m_spotlight.Size({ m_sonarRadiusFloat * 2 * m_sonarZoomFactor, m_sonarRadiusFloat * 2 * m_sonarZoomFactor });
|
||||||
|
m_spotlight.Opacity(m_spotlightColor.A);
|
||||||
m_animation.Duration(std::chrono::milliseconds{ m_fadeDuration });
|
m_animation.Duration(std::chrono::milliseconds{ m_fadeDuration });
|
||||||
m_circleGeometry.StopAnimation(L"Radius");
|
m_circleGeometry.StopAnimation(L"Radius");
|
||||||
|
|
||||||
|
|||||||
@@ -279,14 +279,15 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
|
|||||||
// Parse spotlight color
|
// Parse spotlight color
|
||||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_SPOTLIGHT_COLOR);
|
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_SPOTLIGHT_COLOR);
|
||||||
auto spotlightColor = (std::wstring)jsonPropertiesObject.GetNamedString(JSON_KEY_VALUE);
|
auto spotlightColor = (std::wstring)jsonPropertiesObject.GetNamedString(JSON_KEY_VALUE);
|
||||||
uint8_t r, g, b;
|
|
||||||
if (!checkValidRGB(spotlightColor, &r, &g, &b))
|
uint8_t a, r, g, b;
|
||||||
|
if (!checkValidARGB(spotlightColor, &a, &r, &g, &b))
|
||||||
{
|
{
|
||||||
Logger::error("Spotlight color RGB value is invalid. Will use default value");
|
Logger::error("Spotlight color RGB value is invalid. Will use default value");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
findMyMouseSettings.spotlightColor = winrt::Windows::UI::ColorHelper::FromArgb(255, r, g, b);
|
findMyMouseSettings.spotlightColor = winrt::Windows::UI::ColorHelper::FromArgb(a, r, g, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
ActivationShortcut = DefaultActivationShortcut;
|
ActivationShortcut = DefaultActivationShortcut;
|
||||||
DoNotActivateOnGameMode = new BoolProperty(true);
|
DoNotActivateOnGameMode = new BoolProperty(true);
|
||||||
BackgroundColor = new StringProperty("#000000");
|
BackgroundColor = new StringProperty("#000000");
|
||||||
SpotlightColor = new StringProperty("#FFFFFF");
|
SpotlightColor = new StringProperty("#FFFFFFFF");
|
||||||
OverlayOpacity = new IntProperty(50);
|
OverlayOpacity = new IntProperty(50);
|
||||||
SpotlightRadius = new IntProperty(100);
|
SpotlightRadius = new IntProperty(100);
|
||||||
AnimationDurationMs = new IntProperty(500);
|
AnimationDurationMs = new IntProperty(500);
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FindMyMouseBackgroundColor, Mode=TwoWay}" />
|
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FindMyMouseBackgroundColor, Mode=TwoWay}" />
|
||||||
</tkcontrols:SettingsCard>
|
</tkcontrols:SettingsCard>
|
||||||
<tkcontrols:SettingsCard x:Uid="MouseUtils_FindMyMouse_SpotlightColor">
|
<tkcontrols:SettingsCard x:Uid="MouseUtils_FindMyMouse_SpotlightColor">
|
||||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FindMyMouseSpotlightColor, Mode=TwoWay}" />
|
<controls:AlphaColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FindMyMouseSpotlightColor, Mode=TwoWay}" />
|
||||||
</tkcontrols:SettingsCard>
|
</tkcontrols:SettingsCard>
|
||||||
<tkcontrols:SettingsCard x:Uid="MouseUtils_FindMyMouse_SpotlightRadius">
|
<tkcontrols:SettingsCard x:Uid="MouseUtils_FindMyMouse_SpotlightRadius">
|
||||||
<NumberBox
|
<NumberBox
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
_findMyMouseBackgroundColor = !string.IsNullOrEmpty(backgroundColor) ? backgroundColor : "#000000";
|
_findMyMouseBackgroundColor = !string.IsNullOrEmpty(backgroundColor) ? backgroundColor : "#000000";
|
||||||
|
|
||||||
string spotlightColor = FindMyMouseSettingsConfig.Properties.SpotlightColor.Value;
|
string spotlightColor = FindMyMouseSettingsConfig.Properties.SpotlightColor.Value;
|
||||||
_findMyMouseSpotlightColor = !string.IsNullOrEmpty(spotlightColor) ? spotlightColor : "#FFFFFF";
|
_findMyMouseSpotlightColor = !string.IsNullOrEmpty(spotlightColor) ? spotlightColor : "#FFFFFFFF";
|
||||||
|
|
||||||
_findMyMouseOverlayOpacity = FindMyMouseSettingsConfig.Properties.OverlayOpacity.Value;
|
_findMyMouseOverlayOpacity = FindMyMouseSettingsConfig.Properties.OverlayOpacity.Value;
|
||||||
_findMyMouseSpotlightRadius = FindMyMouseSettingsConfig.Properties.SpotlightRadius.Value;
|
_findMyMouseSpotlightRadius = FindMyMouseSettingsConfig.Properties.SpotlightRadius.Value;
|
||||||
@@ -278,7 +278,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF";
|
value = (value != null) ? SettingsUtilities.ToARGBHex(value) : "#FFFFFFFF";
|
||||||
if (!value.Equals(_findMyMouseSpotlightColor, StringComparison.OrdinalIgnoreCase))
|
if (!value.Equals(_findMyMouseSpotlightColor, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
_findMyMouseSpotlightColor = value;
|
_findMyMouseSpotlightColor = value;
|
||||||
|
|||||||
Reference in New Issue
Block a user