Fix merge errors

This commit is contained in:
catboxanon 2024-03-24 16:38:02 -04:00
parent 25f636cb3a
commit 492f902454
3 changed files with 11 additions and 30 deletions

View File

@ -383,8 +383,7 @@ onUiLoaded(async() => {
// Create tooltip // Create tooltip
function createTooltip() { function createTooltip() {
const toolTipElement = const toolTipElement = targetElement.querySelector(".image-container");
targetElement.querySelector(".image-container");
const tooltip = document.createElement("div"); const tooltip = document.createElement("div");
tooltip.className = "canvas-tooltip"; tooltip.className = "canvas-tooltip";
@ -447,25 +446,15 @@ onUiLoaded(async() => {
// Add a hint element to the target element // Add a hint element to the target element
toolTipElement.appendChild(tooltip); toolTipElement.appendChild(tooltip);
return tooltip;
} }
//Show tool tip if setting enable //Show tool tip if setting enable
if (hotkeysConfig.canvas_show_tooltip) { const canvasTooltip = createTooltip();
createTooltip();
}
// In the course of research, it was found that the tag img is very harmful when zooming and creates white canvases. This hack allows you to almost never think about this problem, it has no effect on webui. if (!hotkeysConfig.canvas_show_tooltip) {
function fixCanvas() { canvasTooltip.style.display = "none";
const activeTab = getActiveTab(elements)?.textContent.trim();
if (activeTab && activeTab !== "img2img") {
const img = targetElement.querySelector(`${elemId} img`);
if (img && img.style.display !== "none") {
img.style.display = "none";
img.style.visibility = "hidden";
}
}
} }
// Reset the zoom level and pan position of the target element to their initial values // Reset the zoom level and pan position of the target element to their initial values
@ -785,15 +774,7 @@ onUiLoaded(async() => {
targetElement.addEventListener("mouseleave", handleMouseLeave); targetElement.addEventListener("mouseleave", handleMouseLeave);
// Reset zoom when click on another tab // Reset zoom when click on another tab
if (elements.img2imgTabs) {
elements.img2imgTabs.addEventListener("click", resetZoom); elements.img2imgTabs.addEventListener("click", resetZoom);
elements.img2imgTabs.addEventListener("click", () => {
// targetElement.style.width = "";
if (parseInt(targetElement.style.width) > 865) {
setTimeout(fitToElement, 0);
}
});
}
targetElement.addEventListener("wheel", e => { targetElement.addEventListener("wheel", e => {
// change zoom level // change zoom level

View File

@ -12,7 +12,7 @@ from gradio.components.image_editor import Brush
from PIL import Image, PngImagePlugin # noqa: F401 from PIL import Image, PngImagePlugin # noqa: F401
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, wrap_gradio_call from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, wrap_gradio_call
from modules import gradio_extensons, sd_schedulers # noqa: F401 from modules import gradio_extensions, sd_schedulers # noqa: F401
from modules import sd_hijack, sd_models, script_callbacks, ui_extensions, deepbooru, extra_networks, ui_common, ui_postprocessing, progress, ui_loadsave, shared_items, ui_settings, timer, sysinfo, ui_checkpoint_merger, scripts, sd_samplers, processing, ui_extra_networks, ui_toprow, launch_utils from modules import sd_hijack, sd_models, script_callbacks, ui_extensions, deepbooru, extra_networks, ui_common, ui_postprocessing, progress, ui_loadsave, shared_items, ui_settings, timer, sysinfo, ui_checkpoint_merger, scripts, sd_samplers, processing, ui_extra_networks, ui_toprow, launch_utils
from modules.ui_components import FormRow, FormGroup, ToolButton, FormHTML, InputAccordion, ResizeHandleRow from modules.ui_components import FormRow, FormGroup, ToolButton, FormHTML, InputAccordion, ResizeHandleRow
from modules.paths import script_path from modules.paths import script_path