mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
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>
This commit is contained in:
@@ -40,6 +40,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[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; }
|
||||
|
||||
@@ -68,6 +71,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
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);
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
Severity="Informational"
|
||||
Visibility="{x:Bind ViewModel.IsAnimationEnabledBySystem, Mode=OneWay, Converter={StaticResource ReverseBoolToVisibilityConverter}}">
|
||||
<InfoBar.ActionButton>
|
||||
<HyperlinkButton x:Uid="OpenSettings" Click="OpenAnimationsSettings_Click" />
|
||||
<HyperlinkButton x:Uid="OpenAnimationsSettings" Click="OpenAnimationsSettings_Click" />
|
||||
</InfoBar.ActionButton>
|
||||
</InfoBar>
|
||||
<tkcontrols:SettingsExpander
|
||||
@@ -355,6 +355,14 @@
|
||||
Value="{x:Bind ViewModel.MousePointerCrosshairsBorderSize, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard Name="MouseUtilsMousePointerCrosshairsCrosshairsOrientation" x:Uid="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.MousePointerCrosshairsOrientation, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation_Both" />
|
||||
<ComboBoxItem x:Uid="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation_Vertical" />
|
||||
<ComboBoxItem x:Uid="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation_Horizontal" />
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Uid="MouseUtils_MousePointerCrosshairs_CrosshairsAutoHide" IsChecked="{x:Bind ViewModel.MousePointerCrosshairsAutoHide, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
@@ -2892,6 +2892,18 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<data name="MouseUtils_MousePointerCrosshairs_CrosshairsFixedLength.Header" xml:space="preserve">
|
||||
<value>Crosshairs fixed length (px)</value>
|
||||
<comment>px = pixels</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation" xml:space="preserve">
|
||||
<value>Crosshairs orientation</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation_Both.Content" xml:space="preserve">
|
||||
<value>Vertical and horizontal lines</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation_Vertical.Content" xml:space="preserve">
|
||||
<value>Vertical only</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MousePointerCrosshairs_CrosshairsOrientation_Horizontal.Content" xml:space="preserve">
|
||||
<value>Horizontal only</value>
|
||||
</data>
|
||||
<data name="MouseUtils_GlidingCursor.Header" xml:space="preserve">
|
||||
<value>Gliding cursor</value>
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_mousePointerCrosshairsAutoHide = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsAutoHide.Value;
|
||||
_mousePointerCrosshairsIsFixedLengthEnabled = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsIsFixedLengthEnabled.Value;
|
||||
_mousePointerCrosshairsFixedLength = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsFixedLength.Value;
|
||||
_mousePointerCrosshairsOrientation = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsOrientation.Value;
|
||||
_mousePointerCrosshairsAutoActivate = MousePointerCrosshairsSettingsConfig.Properties.AutoActivate.Value;
|
||||
|
||||
int isEnabled = 0;
|
||||
@@ -869,6 +870,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int MousePointerCrosshairsOrientation
|
||||
{
|
||||
get
|
||||
{
|
||||
return _mousePointerCrosshairsOrientation;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _mousePointerCrosshairsOrientation)
|
||||
{
|
||||
_mousePointerCrosshairsOrientation = value;
|
||||
MousePointerCrosshairsSettingsConfig.Properties.CrosshairsOrientation.Value = value;
|
||||
NotifyMousePointerCrosshairsPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MousePointerCrosshairsAutoActivate
|
||||
{
|
||||
get
|
||||
@@ -991,6 +1010,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private bool _mousePointerCrosshairsAutoHide;
|
||||
private bool _mousePointerCrosshairsIsFixedLengthEnabled;
|
||||
private int _mousePointerCrosshairsFixedLength;
|
||||
private int _mousePointerCrosshairsOrientation;
|
||||
private bool _mousePointerCrosshairsAutoActivate;
|
||||
private bool _isAnimationEnabledBySystem;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user