mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[FancyZones] Configurable sensitivity radius (#6554)
* Add the setting for the Sensitivity Radius to JSON and the Editor Use the setting when determining Zones to highligh * Fix FanzyZones unit tests Add test for Json upgrade * Updated texts in FancyZone Editor More Text to Resources / Use Resources * Added constant for default of Sensitivity Radius * When installing from scratch of when a new device is added set the sensitivity radius to the default. Move all the constant values to a single namespace * restore correct formatting Co-authored-by: Remy Blok <remy.blok@prodware.nl>
This commit is contained in:
@@ -384,6 +384,8 @@ namespace FancyZonesEditor.Models
|
||||
public int EditorSpacing { get; set; }
|
||||
|
||||
public int EditorZoneCount { get; set; }
|
||||
|
||||
public int EditorSensitivityRadius { get; set; }
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
@@ -424,6 +426,7 @@ namespace FancyZonesEditor.Models
|
||||
EditorShowSpacing = settings.ShowSpacing,
|
||||
EditorSpacing = settings.Spacing,
|
||||
EditorZoneCount = settings.ZoneCount,
|
||||
EditorSensitivityRadius = settings.SensitivityRadius,
|
||||
};
|
||||
|
||||
JsonSerializerOptions options = new JsonSerializerOptions
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace FancyZonesEditor
|
||||
private const string EditorShowSpacingJsonTag = "editor-show-spacing";
|
||||
private const string EditorSpacingJsonTag = "editor-spacing";
|
||||
private const string EditorZoneCountJsonTag = "editor-zone-count";
|
||||
private const string EditorSensitivityRadiusJsonTag = "editor-sensitivity-radius";
|
||||
|
||||
private const string FocusJsonTag = "focus";
|
||||
private const string ColumnsJsonTag = "columns";
|
||||
@@ -208,7 +209,7 @@ namespace FancyZonesEditor
|
||||
{
|
||||
if (_spacing != value)
|
||||
{
|
||||
_spacing = value;
|
||||
_spacing = Math.Max(0, value);
|
||||
FirePropertyChanged();
|
||||
}
|
||||
}
|
||||
@@ -236,6 +237,26 @@ namespace FancyZonesEditor
|
||||
|
||||
private bool _showSpacing;
|
||||
|
||||
// SensitivityRadius - how much space inside the zone to highlight the adjacent zone too
|
||||
public int SensitivityRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
return _sensitivityRadius;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_sensitivityRadius != value)
|
||||
{
|
||||
_sensitivityRadius = Math.Max(0, value);
|
||||
FirePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _sensitivityRadius;
|
||||
|
||||
// IsShiftKeyPressed - is the shift key currently being held down
|
||||
public bool IsShiftKeyPressed
|
||||
{
|
||||
@@ -435,6 +456,7 @@ namespace FancyZonesEditor
|
||||
_showSpacing = true;
|
||||
_spacing = 16;
|
||||
_zoneCount = 3;
|
||||
_sensitivityRadius = 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -463,6 +485,7 @@ namespace FancyZonesEditor
|
||||
_showSpacing = jsonObject.GetProperty(EditorShowSpacingJsonTag).GetBoolean();
|
||||
_spacing = jsonObject.GetProperty(EditorSpacingJsonTag).GetInt32();
|
||||
_zoneCount = jsonObject.GetProperty(EditorZoneCountJsonTag).GetInt32();
|
||||
_sensitivityRadius = jsonObject.GetProperty(EditorSensitivityRadiusJsonTag).GetInt32();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user