lxfater / inpaint-web

A free and open-source inpainting & image-upscaling tool powered by webgpu and wasm on the browser。| 基于 Webgpu 技术和 wasm 技术的免费开源 inpainting & image-upscaling 工具, 纯浏览器端实现。
https://inpaintweb.lxfater.com/
GNU General Public License v3.0
4.7k stars 523 forks source link

fix the editor generate progress state exceed 100 #31

Closed mingXta closed 7 months ago

mingXta commented 7 months ago

The editor generate mock progress may exceed 100. original code:

setGenerateProgress(p => {
      if (p < 90) return p + 20 * Math.random()
      if (p >= 90 && p < 100) return p + 1 * Math.random()
      window.setTimeout(() => setIsInpaintingLoading(false), 500)
      return p
    })

I changed 20 to 10 and 100 to 99:

setGenerateProgress(p => {
      if (p < 90) return p + 10 * Math.random()
      if (p >= 90 && p < 99) return p + 1 * Math.random()
      window.setTimeout(() => setIsInpaintingLoading(false), 500)
      return p
    })