fix fitToScreen and adjustBrushSize funcs in zoom.js

This commit is contained in:
Danil Boldyrev 2024-02-01 11:46:20 +03:00
parent ca7ba7d394
commit 733f8c7c51

View File

@ -395,7 +395,7 @@ onUiLoaded(async() => {
targetElement.style.transform = `scale(${elemData[elemId].zoomLevel}) translate(${elemData[elemId].panX}px, ${elemData[elemId].panY}px)`; targetElement.style.transform = `scale(${elemData[elemId].zoomLevel}) translate(${elemData[elemId].panX}px, ${elemData[elemId].panY}px)`;
const canvas = gradioApp().querySelector( const canvas = gradioApp().querySelector(
`${elemId} canvas[key="interface"]` `${elemId} canvas`
); );
toggleOverlap("off"); toggleOverlap("off");
@ -456,10 +456,10 @@ onUiLoaded(async() => {
) { ) {
const input = const input =
gradioApp().querySelector( gradioApp().querySelector(
`${elemId} input[aria-label='Brush radius']` `${elemId} input[type='range']`
) || ) ||
gradioApp().querySelector( gradioApp().querySelector(
`${elemId} button[aria-label="Use brush"]` `${elemId} button[aria-label="Size button"]`
); );
if (input) { if (input) {
@ -602,7 +602,7 @@ onUiLoaded(async() => {
// Fullscreen mode // Fullscreen mode
function fitToScreen() { function fitToScreen() {
const canvas = gradioApp().querySelector( const canvas = gradioApp().querySelector(
`${elemId} canvas[key="interface"]` `${elemId} canvas`
); );
// print(canvas) // print(canvas)
@ -724,7 +724,7 @@ onUiLoaded(async() => {
targetElement.isExpanded = false; targetElement.isExpanded = false;
function autoExpand() { function autoExpand() {
const canvas = document.querySelector(`${elemId} canvas[key="interface"]`); const canvas = document.querySelector(`${elemId} canvas`);
if (canvas) { if (canvas) {
if (hasHorizontalScrollbar(targetElement) && targetElement.isExpanded === false) { if (hasHorizontalScrollbar(targetElement) && targetElement.isExpanded === false) {
targetElement.style.visibility = "hidden"; targetElement.style.visibility = "hidden";