mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-20 21:30:09 +08:00
Fix the startup zoom error
This commit is contained in:
parent
5e37bf66c1
commit
ca7ba7d394
@ -401,7 +401,7 @@ onUiLoaded(async() => {
|
||||
toggleOverlap("off");
|
||||
fullScreenMode = false;
|
||||
|
||||
const closeBtn = targetElement.querySelector("button[aria-label='Remove Image']");
|
||||
const closeBtn = targetElement.querySelector("button[aria-label='Clear canvas']");
|
||||
if (closeBtn) {
|
||||
closeBtn.addEventListener("click", resetZoom);
|
||||
}
|
||||
@ -479,10 +479,11 @@ onUiLoaded(async() => {
|
||||
|
||||
// Reset zoom when uploading a new image
|
||||
const fileInput = gradioApp().querySelector(
|
||||
`${elemId} input[type="file"][accept="image/*"].svelte-116rqfv`
|
||||
`${elemId} .upload-container input[type="file"][accept="image/*"]`
|
||||
);
|
||||
fileInput.addEventListener("click", resetZoom);
|
||||
|
||||
|
||||
// Update the zoom level and pan position of the target element based on the values of the zoomLevel, panX and panY variables
|
||||
function updateZoom(newZoomLevel, mouseX, mouseY) {
|
||||
newZoomLevel = Math.max(0.1, Math.min(newZoomLevel, 15));
|
||||
@ -604,6 +605,8 @@ onUiLoaded(async() => {
|
||||
`${elemId} canvas[key="interface"]`
|
||||
);
|
||||
|
||||
// print(canvas)
|
||||
|
||||
if (!canvas) return;
|
||||
|
||||
if (canvas.offsetWidth > 862 || isExtension) {
|
||||
|
Loading…
Reference in New Issue
Block a user