Skip to content

Commit

Permalink
Merge branch 'increment-wrap' of https://github.com/pksebben/ComfyUI
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Feb 1, 2024
2 parents 6ab4205 + 53a22e1 commit 4c54c2e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web/scripts/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export function addValueControlWidgets(node, targetWidget, defaultValue = "rando

const isCombo = targetWidget.type === "combo";
let comboFilter;
if (isCombo) {
valueControl.options.values.push("increment-wrap");
}
if (isCombo && options.addFilterList !== false) {
comboFilter = node.addWidget(
"string",
Expand Down Expand Up @@ -128,6 +131,12 @@ export function addValueControlWidgets(node, targetWidget, defaultValue = "rando
case "increment":
current_index += 1;
break;
case "increment-wrap":
current_index += 1;
if ( current_index >= current_length ) {
current_index = 0;
}
break;
case "decrement":
current_index -= 1;
break;
Expand Down Expand Up @@ -295,7 +304,7 @@ export const ComfyWidgets = {
let disable_rounding = app.ui.settings.getSettingValue("Comfy.DisableFloatRounding")
if (precision == 0) precision = undefined;
const { val, config } = getNumberDefaults(inputData, 0.5, precision, !disable_rounding);
return { widget: node.addWidget(widgetType, inputName, val,
return { widget: node.addWidget(widgetType, inputName, val,
function (v) {
if (config.round) {
this.value = Math.round(v/config.round)*config.round;
Expand Down

0 comments on commit 4c54c2e

Please sign in to comment.