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]; }