configurable image fit in all image views

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-08-06 11:33:50 -04:00
parent 7bba30e797
commit 6a6605191f
8 changed files with 43 additions and 8 deletions
+12
View File
@@ -3,6 +3,18 @@ let previewDrag = false;
let modalPreviewZone;
let previewInstance;
function cycleImageFit() {
const root = document.documentElement;
const current = getComputedStyle(root).getPropertyValue('--sd-image-fit').trim();
let next = 'contain';
if (current === 'contain') next = 'cover';
else if (current === 'cover') next = 'fill';
else if (current === 'fill') next = 'scale-down';
else if (current === 'scale-down') next = 'none';
root.style.setProperty('--sd-image-fit', next);
log('cycleImageFit', current, next);
}
function closeModal(evt, force = false) {
if (force) gradioApp().getElementById('lightboxModal').style.display = 'none';
if (previewDrag) return;