hires_fix.js 886 B

123456789101112131415161718
  1. function onCalcResolutionHires(enable, width, height, hr_scale, hr_resize_x, hr_resize_y) {
  2. function setInactive(elem, inactive) {
  3. elem.classList.toggle('inactive', !!inactive);
  4. }
  5. var hrUpscaleBy = gradioApp().getElementById('txt2img_hr_scale');
  6. var hrResizeX = gradioApp().getElementById('txt2img_hr_resize_x');
  7. var hrResizeY = gradioApp().getElementById('txt2img_hr_resize_y');
  8. gradioApp().getElementById('txt2img_hires_fix_row2').style.display = opts.use_old_hires_fix_width_height ? "none" : "";
  9. setInactive(hrUpscaleBy, opts.use_old_hires_fix_width_height || hr_resize_x > 0 || hr_resize_y > 0);
  10. setInactive(hrResizeX, opts.use_old_hires_fix_width_height || hr_resize_x == 0);
  11. setInactive(hrResizeY, opts.use_old_hires_fix_width_height || hr_resize_y == 0);
  12. return [enable, width, height, hr_scale, hr_resize_x, hr_resize_y];
  13. }