Spaces:
Sleeping
Sleeping
$P@D$3RV£R commited on
Commit ·
7ffaeaa
1
Parent(s): c111fc3
Update transient intensity scaling: 30% larger with constrained proportions, container unchanged
Browse files- templates/tagger.html +14 -9
templates/tagger.html
CHANGED
|
@@ -689,23 +689,28 @@ function setupCanvas(imageSrc, canvasId, imageName, labels) {
|
|
| 689 |
scaleX = 416 / image.width;
|
| 690 |
scaleY = 416 / image.height;
|
| 691 |
} else if (imageName.includes('-tr_int_full.png')) {
|
| 692 |
-
// Crop 150 pixels from top and bottom of tr_int_full images, then scale
|
| 693 |
const croppedHeight = image.height - 300; // Remove 150px from top + 150px from bottom
|
| 694 |
const croppedWidth = image.width;
|
| 695 |
const aspectRatio = croppedWidth / croppedHeight;
|
| 696 |
|
| 697 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 698 |
const container = c.parentElement;
|
| 699 |
const maxWidth = container.clientWidth;
|
| 700 |
const maxHeight = container.clientHeight;
|
| 701 |
|
| 702 |
-
//
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
}
|
| 710 |
|
| 711 |
canvasWidth = scaledWidth;
|
|
|
|
| 689 |
scaleX = 416 / image.width;
|
| 690 |
scaleY = 416 / image.height;
|
| 691 |
} else if (imageName.includes('-tr_int_full.png')) {
|
| 692 |
+
// Crop 150 pixels from top and bottom of tr_int_full images, then scale by 30% (1.3x) with constrained proportions
|
| 693 |
const croppedHeight = image.height - 300; // Remove 150px from top + 150px from bottom
|
| 694 |
const croppedWidth = image.width;
|
| 695 |
const aspectRatio = croppedWidth / croppedHeight;
|
| 696 |
|
| 697 |
+
// Scale by 30% (1.3x) while maintaining aspect ratio
|
| 698 |
+
const baseScale = 1.3;
|
| 699 |
+
let scaledWidth = croppedWidth * baseScale;
|
| 700 |
+
let scaledHeight = croppedHeight * baseScale;
|
| 701 |
+
|
| 702 |
+
// Ensure it fits within container while maintaining aspect ratio
|
| 703 |
const container = c.parentElement;
|
| 704 |
const maxWidth = container.clientWidth;
|
| 705 |
const maxHeight = container.clientHeight;
|
| 706 |
|
| 707 |
+
// If scaled dimensions exceed container, scale down proportionally
|
| 708 |
+
if (scaledWidth > maxWidth || scaledHeight > maxHeight) {
|
| 709 |
+
const scaleX = maxWidth / scaledWidth;
|
| 710 |
+
const scaleY = maxHeight / scaledHeight;
|
| 711 |
+
const scale = Math.min(scaleX, scaleY);
|
| 712 |
+
scaledWidth = scaledWidth * scale;
|
| 713 |
+
scaledHeight = scaledHeight * scale;
|
| 714 |
}
|
| 715 |
|
| 716 |
canvasWidth = scaledWidth;
|