fix full-screen image-viewer toolbar actions with control tab

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-10-22 14:35:41 -04:00
parent 0faf61f48a
commit f4a8776108
3 changed files with 13 additions and 4 deletions
+11 -3
View File
@@ -52,12 +52,15 @@ function modalImageSwitch(offset) {
}
function modalSaveImage(event) {
if (gradioApp().getElementById('tab_txt2img').style.display !== 'none') gradioApp().getElementById('save_txt2img').click();
else if (gradioApp().getElementById('tab_img2img').style.display !== 'none') gradioApp().getElementById('save_img2img').click();
else if (gradioApp().getElementById('tab_process').style.display !== 'none') gradioApp().getElementById('save_extras').click();
const tabName = getENActiveTab();
const saveBtn = gradioApp().getElementById(`save_${tabName}`);
log('modalSaveImage', tabName, saveBtn);
if (saveBtn) saveBtn.click();
modalImageSwitch(0);
}
function modalKeyHandler(event) {
log('modalKeyHandler', event.key);
switch (event.key) {
case 's':
modalSaveImage();
@@ -158,6 +161,7 @@ function modalZoomToggle(event) {
const modalImage = gradioApp().getElementById('modalImage');
modalZoomSet(modalImage, !modalImage.classList.contains('modalImageFullscreen'));
event.stopPropagation();
modalImageSwitch(0);
}
function modalTileToggle(event) {
@@ -172,12 +176,15 @@ function modalTileToggle(event) {
modal.style.setProperty('background-image', `url(${modalImage.src})`);
}
event.stopPropagation();
modalImageSwitch(0);
}
function modalResetInstance(event) {
const modalImage = document.getElementById('modalImage');
previewInstance.dispose();
previewInstance = panzoom(modalImage, { zoomSpeed: 0.05, minZoom: 0.1, maxZoom: 5.0, filterKey: (/* e, dx, dy, dz */) => true });
event.stopPropagation();
modalImageSwitch(0);
}
function modalToggleParams(event) {
@@ -188,6 +195,7 @@ function modalToggleParams(event) {
modalExif.style.display = 'none';
}
event.stopPropagation();
modalImageSwitch(0);
}
function galleryClickEventHandler(event) {