Files
PowerToys/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsProperties.cs
Mike Hall faf7c7f1a1 add horizontal and vertical options for MousePointerCrosshairs (#41789)
## Summary of the Pull Request
This PR addresses two logged issues for MousePointerCrosshairs, these
are:
https://github.com/microsoft/PowerToys/issues/24944 
https://github.com/microsoft/PowerToys/issues/31817

## PR Checklist

- [x] Closes: #24944, #31817
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

## Detailed Description of the Pull Request / Additional comments
The PR adds a new combo box to MousePointerCrosshairs XAML options, this
gives the option for 'both', 'vertical only' or 'horizontal only'. The
default option is 'both' which mirrors the existing behavior.

## Validation Steps Performed
Validation has been completed on two separate PCs, a Surface laptop 7
Pro and a Dell Workstation.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-29 10:32:07 +08:00

84 lines
3.4 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text.Json.Serialization;
using Settings.UI.Library.Attributes;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class MousePointerCrosshairsProperties
{
[CmdConfigureIgnore]
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, true, false, 0x50); // Win + Alt + P
[CmdConfigureIgnore]
public HotkeySettings DefaultGlidingCursorActivationShortcut => new HotkeySettings(true, false, true, false, 0xBE); // Win + Alt + .
[JsonPropertyName("activation_shortcut")]
public HotkeySettings ActivationShortcut { get; set; }
[JsonPropertyName("gliding_cursor_activation_shortcut")]
public HotkeySettings GlidingCursorActivationShortcut { get; set; }
[JsonPropertyName("crosshairs_color")]
public StringProperty CrosshairsColor { get; set; }
[JsonPropertyName("crosshairs_opacity")]
public IntProperty CrosshairsOpacity { get; set; }
[JsonPropertyName("crosshairs_radius")]
public IntProperty CrosshairsRadius { get; set; }
[JsonPropertyName("crosshairs_thickness")]
public IntProperty CrosshairsThickness { get; set; }
[JsonPropertyName("crosshairs_border_color")]
public StringProperty CrosshairsBorderColor { get; set; }
[JsonPropertyName("crosshairs_border_size")]
public IntProperty CrosshairsBorderSize { get; set; }
[JsonPropertyName("crosshairs_orientation")]
public IntProperty CrosshairsOrientation { get; set; }
[JsonPropertyName("crosshairs_auto_hide")]
public BoolProperty CrosshairsAutoHide { get; set; }
[JsonPropertyName("crosshairs_is_fixed_length_enabled")]
public BoolProperty CrosshairsIsFixedLengthEnabled { get; set; }
[JsonPropertyName("crosshairs_fixed_length")]
public IntProperty CrosshairsFixedLength { get; set; }
[JsonPropertyName("auto_activate")]
public BoolProperty AutoActivate { get; set; }
[JsonPropertyName("gliding_travel_speed")]
public IntProperty GlidingTravelSpeed { get; set; }
[JsonPropertyName("gliding_delay_speed")]
public IntProperty GlidingDelaySpeed { get; set; }
public MousePointerCrosshairsProperties()
{
ActivationShortcut = DefaultActivationShortcut;
GlidingCursorActivationShortcut = DefaultGlidingCursorActivationShortcut;
CrosshairsColor = new StringProperty("#FF0000");
CrosshairsOpacity = new IntProperty(75);
CrosshairsRadius = new IntProperty(20);
CrosshairsThickness = new IntProperty(5);
CrosshairsBorderColor = new StringProperty("#FFFFFF");
CrosshairsBorderSize = new IntProperty(1);
CrosshairsOrientation = new IntProperty(0); // Default to both (0=Both, 1=Vertical, 2=Horizontal)
CrosshairsAutoHide = new BoolProperty(false);
CrosshairsIsFixedLengthEnabled = new BoolProperty(false);
CrosshairsFixedLength = new IntProperty(1);
AutoActivate = new BoolProperty(false);
GlidingTravelSpeed = new IntProperty(25);
GlidingDelaySpeed = new IntProperty(5);
}
}
}