think it makes more sense here
This commit is contained in:
parent
228bd3d9a0
commit
8e5d48f97b
3 changed files with 30 additions and 34 deletions
|
@ -87,6 +87,13 @@
|
||||||
<br />
|
<br />
|
||||||
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
|
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
|
||||||
<label for="cbxHRFix">Auto txt2img HRfix</label>
|
<label for="cbxHRFix">Auto txt2img HRfix</label>
|
||||||
|
<br />
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
id="cbxSyncCursorSize"
|
||||||
|
onchange="changeSyncCursorSize()" />
|
||||||
|
<label for="cbxSyncCursorSize">Sync cursor size</label>
|
||||||
|
<br />
|
||||||
<div id="resolution"></div>
|
<div id="resolution"></div>
|
||||||
<div id="steps"></div>
|
<div id="steps"></div>
|
||||||
<div id="cfgScale"></div>
|
<div id="cfgScale"></div>
|
||||||
|
|
23
js/index.js
23
js/index.js
|
@ -115,6 +115,7 @@ function startup() {
|
||||||
changeSmoothRendering();
|
changeSmoothRendering();
|
||||||
changeSeed();
|
changeSeed();
|
||||||
changeHiResFix();
|
changeHiResFix();
|
||||||
|
changeSyncCursorSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -543,6 +544,17 @@ function changeHiResFix() {
|
||||||
);
|
);
|
||||||
localStorage.setItem("enable_hr", stableDiffusionData.enable_hr);
|
localStorage.setItem("enable_hr", stableDiffusionData.enable_hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeSyncCursorSize() {
|
||||||
|
stableDiffusionData.sync_cursor_size = Boolean(
|
||||||
|
document.getElementById("cbxSyncCursorSize").checked
|
||||||
|
); //is this horribly hacky, putting it in SD data instead of making a gross global var?
|
||||||
|
localStorage.setItem(
|
||||||
|
"sync_cursor_size",
|
||||||
|
stableDiffusionData.sync_cursor_size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function changeSmoothRendering() {
|
function changeSmoothRendering() {
|
||||||
const layers = document.getElementById("layer-render");
|
const layers = document.getElementById("layer-render");
|
||||||
if (document.getElementById("cbxSmooth").checked) {
|
if (document.getElementById("cbxSmooth").checked) {
|
||||||
|
@ -957,6 +969,11 @@ function loadSettings() {
|
||||||
? false
|
? false
|
||||||
: localStorage.getItem("enable_hr")
|
: localStorage.getItem("enable_hr")
|
||||||
);
|
);
|
||||||
|
var _sync_cursor_size = Boolean(
|
||||||
|
localStorage.getItem("sync_cursor_size") == (null || "false")
|
||||||
|
? false
|
||||||
|
: localStorage.getItem("sync_cursor_size")
|
||||||
|
);
|
||||||
|
|
||||||
// set the values into the UI
|
// set the values into the UI
|
||||||
document.getElementById("prompt").value = String(_prompt);
|
document.getElementById("prompt").value = String(_prompt);
|
||||||
|
@ -966,6 +983,8 @@ function loadSettings() {
|
||||||
document.getElementById("maskBlur").value = Number(_mask_blur);
|
document.getElementById("maskBlur").value = Number(_mask_blur);
|
||||||
document.getElementById("seed").value = Number(_seed);
|
document.getElementById("seed").value = Number(_seed);
|
||||||
document.getElementById("cbxHRFix").checked = Boolean(_enable_hr);
|
document.getElementById("cbxHRFix").checked = Boolean(_enable_hr);
|
||||||
|
document.getElementById("cbxSyncCursorSize").checked =
|
||||||
|
Boolean(_sync_cursor_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
imageCollection.element.addEventListener(
|
imageCollection.element.addEventListener(
|
||||||
|
@ -992,7 +1011,7 @@ function resetToDefaults() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function informSliders() {
|
function informSliders() {
|
||||||
if (toolbar._current_tool && toolbar._current_tool.state.matchResolution) {
|
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);
|
||||||
}
|
}
|
||||||
|
@ -1001,7 +1020,7 @@ function informSliders() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const _resolution_onwheel = (evn) => {
|
const _resolution_onwheel = (evn) => {
|
||||||
if (toolbar._current_tool && toolbar._current_tool.state.matchResolution) {
|
if (stableDiffusionData.sync_cursor_size) {
|
||||||
toolbar._current_tool.state.ignorePrevious = true; //so hacky
|
toolbar._current_tool.state.ignorePrevious = true; //so hacky
|
||||||
resSlider.value =
|
resSlider.value =
|
||||||
stableDiffusionData.width - (128 * evn.deltaY) / Math.abs(evn.deltaY);
|
stableDiffusionData.width - (128 * evn.deltaY) / Math.abs(evn.deltaY);
|
||||||
|
|
|
@ -916,7 +916,7 @@ const dreamTool = () =>
|
||||||
setMask(state.invertMask ? "hold" : "clear");
|
setMask(state.invertMask ? "hold" : "clear");
|
||||||
|
|
||||||
// update cursor size if matching is enabled
|
// update cursor size if matching is enabled
|
||||||
if (state.matchResolution) {
|
if (stableDiffusionData.sync_cursor_size) {
|
||||||
state.setCursorSize(stableDiffusionData.width);
|
state.setCursorSize(stableDiffusionData.width);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -939,7 +939,6 @@ const dreamTool = () =>
|
||||||
};
|
};
|
||||||
|
|
||||||
state.cursorSize = 512;
|
state.cursorSize = 512;
|
||||||
state.matchResolution = true;
|
|
||||||
state.snapToGrid = true;
|
state.snapToGrid = true;
|
||||||
state.invertMask = false;
|
state.invertMask = false;
|
||||||
state.overMaskPx = 0;
|
state.overMaskPx = 0;
|
||||||
|
@ -997,18 +996,6 @@ const dreamTool = () =>
|
||||||
state.setCursorSize = cursorSizeSlider.setValue;
|
state.setCursorSize = cursorSizeSlider.setValue;
|
||||||
state.ctxmenu.cursorSizeSlider = cursorSizeSlider.slider;
|
state.ctxmenu.cursorSizeSlider = cursorSizeSlider.slider;
|
||||||
|
|
||||||
// Match Resolution Checkbox
|
|
||||||
state.ctxmenu.matchResolutionLabel = _toolbar_input.checkbox(
|
|
||||||
state,
|
|
||||||
"matchResolution",
|
|
||||||
"Match Resolution",
|
|
||||||
() => {
|
|
||||||
if (state.matchResolution) {
|
|
||||||
resSlider.value = state.cursorSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).label;
|
|
||||||
|
|
||||||
// Snap to Grid Checkbox
|
// Snap to Grid Checkbox
|
||||||
state.ctxmenu.snapToGridLabel = _toolbar_input.checkbox(
|
state.ctxmenu.snapToGridLabel = _toolbar_input.checkbox(
|
||||||
state,
|
state,
|
||||||
|
@ -1041,8 +1028,6 @@ const dreamTool = () =>
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.appendChild(state.ctxmenu.cursorSizeSlider);
|
menu.appendChild(state.ctxmenu.cursorSizeSlider);
|
||||||
menu.appendChild(state.ctxmenu.matchResolutionLabel);
|
|
||||||
menu.appendChild(document.createElement("br"));
|
|
||||||
menu.appendChild(state.ctxmenu.snapToGridLabel);
|
menu.appendChild(state.ctxmenu.snapToGridLabel);
|
||||||
menu.appendChild(document.createElement("br"));
|
menu.appendChild(document.createElement("br"));
|
||||||
menu.appendChild(state.ctxmenu.invertMaskLabel);
|
menu.appendChild(state.ctxmenu.invertMaskLabel);
|
||||||
|
@ -1074,7 +1059,7 @@ const img2imgTool = () =>
|
||||||
setMask(state.invertMask ? "hold" : "clear");
|
setMask(state.invertMask ? "hold" : "clear");
|
||||||
|
|
||||||
// update cursor size if matching is enabled
|
// update cursor size if matching is enabled
|
||||||
if (state.matchResolution) {
|
if (stableDiffusionData.sync_cursor_size) {
|
||||||
state.setCursorSize(stableDiffusionData.width);
|
state.setCursorSize(stableDiffusionData.width);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1096,7 +1081,6 @@ const img2imgTool = () =>
|
||||||
};
|
};
|
||||||
|
|
||||||
state.cursorSize = 512;
|
state.cursorSize = 512;
|
||||||
state.matchResolution = true;
|
|
||||||
state.snapToGrid = true;
|
state.snapToGrid = true;
|
||||||
state.invertMask = true;
|
state.invertMask = true;
|
||||||
state.fullResolution = false;
|
state.fullResolution = false;
|
||||||
|
@ -1258,18 +1242,6 @@ const img2imgTool = () =>
|
||||||
state.setCursorSize = cursorSizeSlider.setValue;
|
state.setCursorSize = cursorSizeSlider.setValue;
|
||||||
state.ctxmenu.cursorSizeSlider = cursorSizeSlider.slider;
|
state.ctxmenu.cursorSizeSlider = cursorSizeSlider.slider;
|
||||||
|
|
||||||
// Match Resolution Checkbox
|
|
||||||
state.ctxmenu.matchResolutionLabel = _toolbar_input.checkbox(
|
|
||||||
state,
|
|
||||||
"matchResolution",
|
|
||||||
"Match Resolution",
|
|
||||||
() => {
|
|
||||||
if (state.matchResolution) {
|
|
||||||
resSlider.value = state.cursorSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).label;
|
|
||||||
|
|
||||||
// Snap To Grid Checkbox
|
// Snap To Grid Checkbox
|
||||||
state.ctxmenu.snapToGridLabel = _toolbar_input.checkbox(
|
state.ctxmenu.snapToGridLabel = _toolbar_input.checkbox(
|
||||||
state,
|
state,
|
||||||
|
@ -1329,8 +1301,6 @@ const img2imgTool = () =>
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.appendChild(state.ctxmenu.cursorSizeSlider);
|
menu.appendChild(state.ctxmenu.cursorSizeSlider);
|
||||||
menu.appendChild(state.ctxmenu.matchResolutionLabel);
|
|
||||||
menu.appendChild(document.createElement("br"));
|
|
||||||
menu.appendChild(state.ctxmenu.snapToGridLabel);
|
menu.appendChild(state.ctxmenu.snapToGridLabel);
|
||||||
menu.appendChild(document.createElement("br"));
|
menu.appendChild(document.createElement("br"));
|
||||||
menu.appendChild(state.ctxmenu.invertMaskLabel);
|
menu.appendChild(state.ctxmenu.invertMaskLabel);
|
||||||
|
|
Loading…
Reference in a new issue