From d6cc1472fd30678818faf16e733024d4050efcef Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 20 Jan 2026 11:42:45 +0700 Subject: [PATCH] feat: add square orientation with auto-selection for 1:1 aspect ratio --- resolution_matrix.py | 2 +- web/js/pixel_forge.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/resolution_matrix.py b/resolution_matrix.py index 4805c5e..e06a293 100644 --- a/resolution_matrix.py +++ b/resolution_matrix.py @@ -32,7 +32,7 @@ class PixelForge: {"default": "3:2"}, ), "orientation": ( - ["landscape", "portrait"], + ["landscape", "portrait", "square"], {"default": "landscape"}, ), "divisible_by": ( diff --git a/web/js/pixel_forge.js b/web/js/pixel_forge.js index b26c744..1ffd654 100644 --- a/web/js/pixel_forge.js +++ b/web/js/pixel_forge.js @@ -51,6 +51,12 @@ app.registerExtension({ console.log("PixelForge: updateResolutions called with:", { aspect, orientation, div, maxMp }); + // Auto-select "square" orientation for 1:1 aspect ratio + if (aspect === "1:1" && orientationWidget && orientation !== "square") { + orientationWidget.value = "square"; + console.log("PixelForge: Auto-selected square orientation for 1:1 ratio"); + } + const ratio = ASPECT_RATIOS[aspect]; if (!ratio) { console.error("PixelForge: Invalid aspect ratio:", aspect); @@ -70,7 +76,10 @@ app.registerExtension({ if (total > maxPixels) break; - if (orientation === "portrait") { + // For square aspect ratio (1:1), orientation doesn't matter + // For portrait, swap dimensions + const currentOrientation = orientationWidget ? orientationWidget.value : orientation; + if (currentOrientation === "portrait" && aspect !== "1:1") { [w, h] = [h, w]; }