updates reticle size upon manually entered resolution

This commit is contained in:
tim h 2022-12-12 17:09:27 -06:00
parent 82e943b12d
commit 228bd3d9a0
2 changed files with 21 additions and 10 deletions

View file

@ -472,15 +472,16 @@ const resSlider = makeSlider(
"Resolution", "Resolution",
document.getElementById("resolution"), document.getElementById("resolution"),
"resolution", "resolution",
64, 128,
2048, 2048,
64, 128,
512, 512,
2, 2,
(v) => { (v) => {
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();
} }
); );
makeSlider( makeSlider(
@ -990,9 +991,19 @@ function resetToDefaults() {
} }
} }
function informSliders() {
if (toolbar._current_tool && toolbar._current_tool.state.matchResolution) {
if (!toolbar._current_tool.state.ignorePrevious) {
toolbar._current_tool.state.setCursorSize(stableDiffusionData.width);
}
toolbar._current_tool.state.ignorePrevious = false;
}
}
const _resolution_onwheel = (evn) => { const _resolution_onwheel = (evn) => {
if (toolbar._current_tool.state.matchResolution) { if (toolbar._current_tool && toolbar._current_tool.state.matchResolution) {
toolbar._current_tool.state.ignorePrevious = true; //so hacky
resSlider.value = resSlider.value =
stableDiffusionData.width - (64 * evn.deltaY) / Math.abs(evn.deltaY); stableDiffusionData.width - (128 * evn.deltaY) / Math.abs(evn.deltaY);
} }
}; };

View file

@ -884,9 +884,9 @@ const _dream_onwheel = (evn, state) => {
// //
// TODO: Someone that has a smooth scrolling mouse should verify if this works with them. // TODO: Someone that has a smooth scrolling mouse should verify if this works with them.
const v = state.cursorSize - 64 * (evn.delta / Math.abs(evn.delta)); const v = state.cursorSize - 128 * (evn.delta / Math.abs(evn.delta));
state.cursorSize = state.setCursorSize(v + snap(v, 0, 64)); state.cursorSize = state.setCursorSize(v + snap(v, 0, 128));
state.mousemovecb(evn); state.mousemovecb(evn);
} }
}; };
@ -987,9 +987,9 @@ const dreamTool = () =>
"cursorSize", "cursorSize",
"Cursor Size", "Cursor Size",
{ {
min: 64, min: 128,
max: 2048, max: 2048,
step: 64, step: 128,
textStep: 2, textStep: 2,
} }
); );
@ -1248,9 +1248,9 @@ const img2imgTool = () =>
"cursorSize", "cursorSize",
"Cursor Size", "Cursor Size",
{ {
min: 64, min: 128,
max: 2048, max: 2048,
step: 64, step: 128,
textStep: 2, textStep: 2,
} }
); );