diff options
Diffstat (limited to 'javascript/ui.js')
-rw-r--r-- | javascript/ui.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/javascript/ui.js b/javascript/ui.js index c9df066d..e50b44ee 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -386,4 +386,21 @@ function restoreProgress (task_tag) { res[0] = 0 return res -}
\ No newline at end of file +} + +function currentImg2imgSourceResolution(_, _, scaleBy){ + var img = gradioApp().querySelector('#mode_img2img > div[style="display: block;"] img') + return img ? [img.naturalWidth, img.naturalHeight, scaleBy] : [0, 0, scaleBy] +} + +function updateImg2imgResizeToTextAfterChangingImage(){ + // At the time this is called from gradio, the image has no yet been replaced. + // There may be a better solution, but this is simple and straightforward so I'm going with it. + + setTimeout(function() { + gradioApp().getElementById('img2img_update_resize_to').click() + }, 500); + + return [] +} + |