mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[FancyZones] Custom canvas layouts scaling (#3644)
* Make canvas layout scaling sensitive * Revert "Make canvas layout scaling sensitive" This reverts commit705dab7e36. * Revert "Revert "Make canvas layout scaling sensitive"" This reverts commitb9dd27644c. * Cleanup * Minor refactoring * Address PR comments
This commit is contained in:
@@ -853,9 +853,9 @@ namespace JSONHelpers
|
||||
CanvasLayoutInfo info;
|
||||
|
||||
int j = 5;
|
||||
info.referenceWidth = data[j] * 256 + data[j + 1];
|
||||
info.lastWorkAreaWidth = data[j] * 256 + data[j + 1];
|
||||
j += 2;
|
||||
info.referenceHeight = data[j] * 256 + data[j + 1];
|
||||
info.lastWorkAreaHeight = data[j] * 256 + data[j + 1];
|
||||
j += 2;
|
||||
|
||||
int count = data[j++];
|
||||
@@ -1023,8 +1023,9 @@ namespace JSONHelpers
|
||||
json::JsonObject CanvasLayoutInfo::ToJson(const CanvasLayoutInfo& canvasInfo)
|
||||
{
|
||||
json::JsonObject infoJson{};
|
||||
infoJson.SetNamedValue(L"ref-width", json::value(canvasInfo.referenceWidth));
|
||||
infoJson.SetNamedValue(L"ref-height", json::value(canvasInfo.referenceHeight));
|
||||
infoJson.SetNamedValue(L"ref-width", json::value(canvasInfo.lastWorkAreaWidth));
|
||||
infoJson.SetNamedValue(L"ref-height", json::value(canvasInfo.lastWorkAreaHeight));
|
||||
|
||||
json::JsonArray zonesJson;
|
||||
|
||||
for (const auto& [x, y, width, height] : canvasInfo.zones)
|
||||
@@ -1045,8 +1046,9 @@ namespace JSONHelpers
|
||||
try
|
||||
{
|
||||
CanvasLayoutInfo info;
|
||||
info.referenceWidth = static_cast<int>(infoJson.GetNamedNumber(L"ref-width"));
|
||||
info.referenceHeight = static_cast<int>(infoJson.GetNamedNumber(L"ref-height"));
|
||||
info.lastWorkAreaWidth = static_cast<int>(infoJson.GetNamedNumber(L"ref-width"));
|
||||
info.lastWorkAreaHeight = static_cast<int>(infoJson.GetNamedNumber(L"ref-height"));
|
||||
|
||||
json::JsonArray zonesJson = infoJson.GetNamedArray(L"zones");
|
||||
uint32_t size = zonesJson.Size();
|
||||
info.zones.reserve(size);
|
||||
|
||||
Reference in New Issue
Block a user