mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
Allow negative spacing between zones up to -10 (#7284)
This commit is contained in:
parent
d1372af581
commit
944e605f06
@ -54,6 +54,8 @@ namespace FancyZonesEditor
|
|||||||
public const ushort _blankCustomModelId = 0xFFFA;
|
public const ushort _blankCustomModelId = 0xFFFA;
|
||||||
public const ushort _lastDefinedId = _blankCustomModelId;
|
public const ushort _lastDefinedId = _blankCustomModelId;
|
||||||
|
|
||||||
|
private const int MaxNegativeSpacing = -10;
|
||||||
|
|
||||||
// Localizable strings
|
// Localizable strings
|
||||||
private const string ErrorMessageBoxTitle = "FancyZones Editor Error";
|
private const string ErrorMessageBoxTitle = "FancyZones Editor Error";
|
||||||
private const string ErrorParsingDeviceInfo = "Error parsing device info data.";
|
private const string ErrorParsingDeviceInfo = "Error parsing device info data.";
|
||||||
@ -209,7 +211,7 @@ namespace FancyZonesEditor
|
|||||||
{
|
{
|
||||||
if (_spacing != value)
|
if (_spacing != value)
|
||||||
{
|
{
|
||||||
_spacing = Math.Max(0, value);
|
_spacing = Math.Max(MaxNegativeSpacing, value);
|
||||||
FirePropertyChanged();
|
FirePropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,11 @@ namespace
|
|||||||
{
|
{
|
||||||
int width = rect.right - rect.left;
|
int width = rect.right - rect.left;
|
||||||
int height = rect.bottom - rect.top;
|
int height = rect.bottom - rect.top;
|
||||||
return rect.left >= 0 && rect.right >= 0 && rect.top >= 0 && rect.bottom >= 0 && width >= 0 && height >= 0;
|
return rect.left >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
||||||
|
rect.right >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
||||||
|
rect.top >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
||||||
|
rect.bottom >= ZoneConstants::MAX_NEGATIVE_SPACING &&
|
||||||
|
width >= 0 && height >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK saveDisplayToVector(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
|
BOOL CALLBACK saveDisplayToVector(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace ZoneConstants
|
||||||
|
{
|
||||||
|
constexpr int MAX_NEGATIVE_SPACING = -10;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing one zone inside applied zone layout, which is basically wrapper around rectangle structure.
|
* Class representing one zone inside applied zone layout, which is basically wrapper around rectangle structure.
|
||||||
*/
|
*/
|
||||||
|
@ -156,7 +156,8 @@ namespace FancyZonesUnitTests
|
|||||||
|
|
||||||
TEST_METHOD (MakeZoneFromInvalidRectCoords)
|
TEST_METHOD (MakeZoneFromInvalidRectCoords)
|
||||||
{
|
{
|
||||||
winrt::com_ptr<IZone> zone = MakeZone({ -1, -1, -1, -1 }, 1);
|
const int invalid = ZoneConstants::MAX_NEGATIVE_SPACING - 1;
|
||||||
|
winrt::com_ptr<IZone> zone = MakeZone({ invalid, invalid, invalid, invalid }, 1);
|
||||||
Assert::IsNull(zone.get());
|
Assert::IsNull(zone.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,9 +847,9 @@ namespace FancyZonesUnitTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD (NegativeSpacing)
|
TEST_METHOD (LargeNegativeSpacing)
|
||||||
{
|
{
|
||||||
const int spacing = -1;
|
const int spacing = ZoneConstants::MAX_NEGATIVE_SPACING - 1;
|
||||||
const int zoneCount = 10;
|
const int zoneCount = 10;
|
||||||
|
|
||||||
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
|
for (int type = static_cast<int>(ZoneSetLayoutType::Focus); type < static_cast<int>(ZoneSetLayoutType::Custom); type++)
|
||||||
|
Loading…
Reference in New Issue
Block a user