mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
configurable image fit in all image views
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user