feat: add square orientation with auto-selection for 1:1 aspect ratio

This commit is contained in:
Your Name
2026-01-20 11:42:45 +07:00
parent 1b75cc56d9
commit d6cc1472fd
2 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ class PixelForge:
{"default": "3:2"},
),
"orientation": (
["landscape", "portrait"],
["landscape", "portrait", "square"],
{"default": "landscape"},
),
"divisible_by": (
+10 -1
View File
@@ -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];
}