From 4241cbd4f9bb5b1b284dd19a2a924e2f4aac1201 Mon Sep 17 00:00:00 2001 From: tim h Date: Mon, 12 Dec 2022 19:30:28 -0600 Subject: [PATCH] why does the callback work fine on dream but breaks img2img --- js/index.js | 11 ++++++++--- js/ui/tool/dream.js | 12 ++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/js/index.js b/js/index.js index 2821b27..a47c49e 100644 --- a/js/index.js +++ b/js/index.js @@ -482,7 +482,7 @@ const resSlider = makeSlider( stableDiffusionData.width = stableDiffusionData.height = v; stableDiffusionData.firstphase_width = stableDiffusionData.firstphase_height = v / 2; - informSliders(); + informCursorSizeSlider(); } ); makeSlider( @@ -553,6 +553,9 @@ function changeSyncCursorSize() { "sync_cursor_size", stableDiffusionData.sync_cursor_size ); + if (stableDiffusionData.sync_cursor_size) { + resSlider.value = stableDiffusionData.width; + } } function changeSmoothRendering() { @@ -991,7 +994,9 @@ imageCollection.element.addEventListener( "wheel", (evn) => { evn.preventDefault(); - _resolution_onwheel(evn); + if (!evn.ctrlKey) { + _resolution_onwheel(evn); + } }, {passive: false} ); @@ -1010,7 +1015,7 @@ function resetToDefaults() { } } -function informSliders() { +function informCursorSizeSlider() { if (stableDiffusionData.sync_cursor_size) { if (!toolbar._current_tool.state.ignorePrevious) { toolbar._current_tool.state.setCursorSize(stableDiffusionData.width); diff --git a/js/ui/tool/dream.js b/js/ui/tool/dream.js index fe5e0f5..efcf38c 100644 --- a/js/ui/tool/dream.js +++ b/js/ui/tool/dream.js @@ -990,6 +990,12 @@ const dreamTool = () => max: 2048, step: 128, textStep: 2, + cb: () => { + if (stableDiffusionData.sync_cursor_size) { + state.ignorePrevious = true; + resSlider.value = state.cursorSize; + } + }, } ); @@ -1236,6 +1242,12 @@ const img2imgTool = () => max: 2048, step: 128, textStep: 2, + // cb: () => { + // if (stableDiffusionData.sync_cursor_size) { + // state.ignorePrevious = true; + // resSlider.value = state.cursorSize; + // } + // }, } );