gradio
8bc75137 - Fix ImageEditor brush preview dead area on vertical images (#12981)

Commit
34 days ago
Fix ImageEditor brush preview dead area on vertical images (#12981) * fix: reinitialize brush textures when canvas dimensions change When a new image is loaded into the ImageEditor, the canvas dimensions change but the brush stroke/preview textures are not recreated. This causes a 'dead area' where the real-time brush preview doesn't render, because the preview sprite's texture is smaller than the actual image. The bug is most visible with vertical (portrait) images, where the canvas height increases significantly beyond the initial canvas size. The bottom portion of the image becomes a dead zone where drawing still works (visible on mouse release) but the real-time preview is clipped to the old texture dimensions. Fix: In BrushTool.set_tool(), detect when the image container's local bounds differ from the stored texture dimensions and reinitialize the textures. Also fix BrushTextures.reinitialize() to correctly compare local bounds instead of the scale-affected container width/height. Fixes #12380 * add changeset * format --------- Co-authored-by: pngwn <hello@pngwn.io> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Author
Parents
Loading