Commit 4d7b63f4 authored by Danil Boldyrev's avatar Danil Boldyrev

changed the document to gradioApp()

parent f48bce5f
......@@ -71,7 +71,7 @@ onUiLoaded(async() => {
fixCanvas();
targetElement.style.transform = `scale(${zoomLevel}) translate(${panX}px, ${panY}px)`;
const canvas = document.querySelector(
const canvas = gradioApp().querySelector(
`${elemId} canvas[key="interface"]`
);
......@@ -116,10 +116,10 @@ onUiLoaded(async() => {
percentage = 5
) {
const input =
document.querySelector(
gradioApp().querySelector(
`${elemId} input[aria-label='Brush radius']`
) ||
document.querySelector(
gradioApp().querySelector(
`${elemId} button[aria-label="Use brush"]`
);
......@@ -139,7 +139,7 @@ onUiLoaded(async() => {
}
// Reset zoom when uploading a new image
const fileInput = document.querySelector(
const fileInput = gradioApp().querySelector(
`${elemId} input[type="file"][accept="image/*"].svelte-116rqfv`
);
fileInput.addEventListener("click", resetZoom);
......@@ -242,7 +242,7 @@ onUiLoaded(async() => {
// Fullscreen mode
function fitToScreen() {
const canvas = document.querySelector(
const canvas = gradioApp().querySelector(
`${elemId} canvas[key="interface"]`
);
......@@ -419,7 +419,7 @@ onUiLoaded(async() => {
}
}
document.addEventListener("mousemove", handleMoveByKey);
gradioApp().addEventListener("mousemove", handleMoveByKey);
}
applyZoomAndPan(elements.sketch, elementIDs.sketch);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment