Commit ·
7a3daf0
1
Parent(s): b252433
ui change
Browse files- static/script.js +48 -6
- static/style.css +34 -4
static/script.js
CHANGED
|
@@ -256,14 +256,56 @@ function updateCustomSizeFromLastImage() {
|
|
| 256 |
let width = lastDims.width;
|
| 257 |
let height = lastDims.height;
|
| 258 |
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
}
|
| 264 |
|
| 265 |
-
|
| 266 |
-
|
|
|
|
| 267 |
|
| 268 |
document.getElementById('customWidth').value = width;
|
| 269 |
document.getElementById('customHeight').value = height;
|
|
|
|
| 256 |
let width = lastDims.width;
|
| 257 |
let height = lastDims.height;
|
| 258 |
|
| 259 |
+
// Calculate aspect ratio
|
| 260 |
+
const aspectRatio = width / height;
|
| 261 |
+
|
| 262 |
+
// If both dimensions are less than 1024 (minimum allowed), scale up proportionally
|
| 263 |
+
if (width < 1024 && height < 1024) {
|
| 264 |
+
// Scale based on which dimension needs more scaling to reach 1024
|
| 265 |
+
if (width < height) {
|
| 266 |
+
// Height is larger, scale based on width minimum
|
| 267 |
+
width = 1024;
|
| 268 |
+
height = Math.round(1024 / aspectRatio);
|
| 269 |
+
} else {
|
| 270 |
+
// Width is larger or equal, scale based on height minimum
|
| 271 |
+
height = 1024;
|
| 272 |
+
width = Math.round(1024 * aspectRatio);
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
// If any dimension exceeds 4096, scale down proportionally
|
| 277 |
+
if (width > 4096 || height > 4096) {
|
| 278 |
+
if (width > height) {
|
| 279 |
+
// Width exceeds more, scale based on width maximum
|
| 280 |
+
const scaleFactor = 4096 / width;
|
| 281 |
+
width = 4096;
|
| 282 |
+
height = Math.round(height * scaleFactor);
|
| 283 |
+
} else {
|
| 284 |
+
// Height exceeds more, scale based on height maximum
|
| 285 |
+
const scaleFactor = 4096 / height;
|
| 286 |
+
height = 4096;
|
| 287 |
+
width = Math.round(width * scaleFactor);
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
// Final bounds check while maintaining aspect ratio
|
| 292 |
+
// If width is still below minimum after height-based scaling
|
| 293 |
+
if (width < 1024) {
|
| 294 |
+
const scaleFactor = 1024 / width;
|
| 295 |
+
width = 1024;
|
| 296 |
+
height = Math.round(height * scaleFactor);
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
// If height is still below minimum after width-based scaling
|
| 300 |
+
if (height < 1024) {
|
| 301 |
+
const scaleFactor = 1024 / height;
|
| 302 |
+
height = 1024;
|
| 303 |
+
width = Math.round(width * scaleFactor);
|
| 304 |
}
|
| 305 |
|
| 306 |
+
// Final check to ensure we don't exceed maximums
|
| 307 |
+
width = Math.min(4096, width);
|
| 308 |
+
height = Math.min(4096, height);
|
| 309 |
|
| 310 |
document.getElementById('customWidth').value = width;
|
| 311 |
document.getElementById('customHeight').value = height;
|
static/style.css
CHANGED
|
@@ -140,11 +140,41 @@ body {
|
|
| 140 |
display: block;
|
| 141 |
}
|
| 142 |
|
| 143 |
-
/* Results Grid */
|
| 144 |
-
.results-grid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
display: grid;
|
| 146 |
-
grid-template-columns: repeat(auto-fill, minmax(
|
| 147 |
-
gap:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
}
|
| 149 |
|
| 150 |
.generation-item {
|
|
|
|
| 140 |
display: block;
|
| 141 |
}
|
| 142 |
|
| 143 |
+
/* Results Grid - Large images for current generation */
|
| 144 |
+
.results-grid {
|
| 145 |
+
display: flex;
|
| 146 |
+
flex-direction: column;
|
| 147 |
+
gap: 25px;
|
| 148 |
+
align-items: center;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.results-grid .generation-item {
|
| 152 |
+
width: 100%;
|
| 153 |
+
max-width: 800px;
|
| 154 |
+
min-height: 400px;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.results-grid .generation-item img {
|
| 158 |
+
width: 100%;
|
| 159 |
+
height: auto;
|
| 160 |
+
max-height: 600px;
|
| 161 |
+
object-fit: contain;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
/* History Grid - Smaller thumbnails */
|
| 165 |
+
.history-grid {
|
| 166 |
display: grid;
|
| 167 |
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
| 168 |
+
gap: 12px;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.history-grid .generation-item {
|
| 172 |
+
max-height: 250px;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
.history-grid .generation-item img {
|
| 176 |
+
max-height: 200px;
|
| 177 |
+
object-fit: cover;
|
| 178 |
}
|
| 179 |
|
| 180 |
.generation-item {
|