aboutsummaryrefslogtreecommitdiff
path: root/javascript/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/ui.js')
-rw-r--r--javascript/ui.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/javascript/ui.js b/javascript/ui.js
index fcaf5608..8aa4a459 100644
--- a/javascript/ui.js
+++ b/javascript/ui.js
@@ -8,8 +8,8 @@ function set_theme(theme){
}
function selected_gallery_index(){
- var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem div[id$=_gallery] .gallery-item')
- var button = gradioApp().querySelector('[style="display: block;"].tabitem div[id$=_gallery] .gallery-item.\\!ring-2')
+ var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem div[id$=_gallery] .thumbnails > .thumbnail-item')
+ var button = gradioApp().querySelector('[style="display: block;"].tabitem div[id$=_gallery] .thumbnails > .thumbnail-item.selected')
var result = -1
buttons.forEach(function(v, i){ if(v==button) { result = i } })
@@ -111,6 +111,14 @@ function get_img2img_tab_index() {
return res
}
+function get_img2img_tab_index_for_res_preview() {
+ let res = args_to_array(arguments)
+ res.splice(-1) // gradio also sends outputs to the arguments, pop them off
+ res[0] = get_tab_index('mode_img2img')
+ debugger;
+ return res
+}
+
function create_submit_args(args){
res = []
for(var i=0;i<args.length;i++){
@@ -335,3 +343,16 @@ function selectCheckpoint(name){
desiredCheckpointName = name;
gradioApp().getElementById('change_checkpoint').click()
}
+
+
+function onCalcResolutionImg2Img(init_img, scale, width, height, resize_mode){
+ i2iScale = gradioApp().getElementById('img2img_scale')
+ i2iWidth = gradioApp().getElementById('img2img_width')
+ i2iHeight = gradioApp().getElementById('img2img_height')
+
+ setInactive(i2iScale, scale == 1)
+ setInactive(i2iWidth, scale > 1)
+ setInactive(i2iHeight, scale > 1)
+
+ return [init_img, width, height, scale, resize_mode]
+}