Haoming02 / sd-forge-couple

An Extension for Forge Webui that implements Attention Couple
GNU General Public License v3.0
160 stars 8 forks source link

Auto-update aspect ratio for region canvas #21

Closed arcusmaximus closed 2 months ago

arcusmaximus commented 2 months ago

It would be easier to set up regions if the aspect ratio of the canvas matched that of the image you're about to generate.

While it's already possible to make the canvas size match the generation size, users need to click the "Preview Mapping" button for this. They're unlikely to use this button for anything else, however, so (at least in my experience) it's easy to miss.

Haoming02 commented 2 months ago

It already does though?

arcusmaximus commented 2 months ago

Right - if you click "Preview Mapping", which I didn't think to click anymore because the mappings get previewed automatically now. Also, it's doesn't work in img2img if you select "Resize by" instead of "Resize to".

Most userfriendly would be for the extension to auto-detect changes in the Forge UI.

Haoming02 commented 2 months ago

Mappings get previewed automatically cause any input triggers the clicking of Preview Mapping button, thus loading the resolution.

Just say when it does not update instead.

arcusmaximus commented 2 months ago

I updated the issue description. By "auto-detect changes in the Forge UI", I mean "changes in Forge's Width/Height textboxes" (not changes in the extension's UI).

Haoming02 commented 2 months ago

I just tested your fork, and found the same problem I'm currently facing as well: The onchange event is not fired when the resolution is changed by the Webui, (eg. the Switch width/height button or the Send to ... buttons)

Does the observer thingy helps in this case?

arcusmaximus commented 2 months ago

The MutationObserver doesn't work, but it turns out that using the input event instead of change does. Updated my fork accordingly.

Haoming02 commented 2 months ago

Mapping now resizes based on sliders, buttons, image upload, both resize to and resize by, and send to buttons