why does the callback work fine on dream but breaks img2img

This commit is contained in:
tim h 2022-12-12 19:30:28 -06:00
parent 8e5d48f97b
commit 4241cbd4f9
2 changed files with 20 additions and 3 deletions

View file

@ -482,7 +482,7 @@ const resSlider = makeSlider(
stableDiffusionData.width = stableDiffusionData.height = v; stableDiffusionData.width = stableDiffusionData.height = v;
stableDiffusionData.firstphase_width = stableDiffusionData.firstphase_width =
stableDiffusionData.firstphase_height = v / 2; stableDiffusionData.firstphase_height = v / 2;
informSliders(); informCursorSizeSlider();
} }
); );
makeSlider( makeSlider(
@ -553,6 +553,9 @@ function changeSyncCursorSize() {
"sync_cursor_size", "sync_cursor_size",
stableDiffusionData.sync_cursor_size stableDiffusionData.sync_cursor_size
); );
if (stableDiffusionData.sync_cursor_size) {
resSlider.value = stableDiffusionData.width;
}
} }
function changeSmoothRendering() { function changeSmoothRendering() {
@ -991,7 +994,9 @@ imageCollection.element.addEventListener(
"wheel", "wheel",
(evn) => { (evn) => {
evn.preventDefault(); evn.preventDefault();
if (!evn.ctrlKey) {
_resolution_onwheel(evn); _resolution_onwheel(evn);
}
}, },
{passive: false} {passive: false}
); );
@ -1010,7 +1015,7 @@ function resetToDefaults() {
} }
} }
function informSliders() { function informCursorSizeSlider() {
if (stableDiffusionData.sync_cursor_size) { if (stableDiffusionData.sync_cursor_size) {
if (!toolbar._current_tool.state.ignorePrevious) { if (!toolbar._current_tool.state.ignorePrevious) {
toolbar._current_tool.state.setCursorSize(stableDiffusionData.width); toolbar._current_tool.state.setCursorSize(stableDiffusionData.width);

View file

@ -990,6 +990,12 @@ const dreamTool = () =>
max: 2048, max: 2048,
step: 128, step: 128,
textStep: 2, textStep: 2,
cb: () => {
if (stableDiffusionData.sync_cursor_size) {
state.ignorePrevious = true;
resSlider.value = state.cursorSize;
}
},
} }
); );
@ -1236,6 +1242,12 @@ const img2imgTool = () =>
max: 2048, max: 2048,
step: 128, step: 128,
textStep: 2, textStep: 2,
// cb: () => {
// if (stableDiffusionData.sync_cursor_size) {
// state.ignorePrevious = true;
// resSlider.value = state.cursorSize;
// }
// },
} }
); );