You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
805 B
36 lines
805 B
import { app } from "../../scripts/app.js"; |
|
|
|
// Inverts the scrolling of context menus |
|
|
|
const id = "Comfy.InvertMenuScrolling"; |
|
app.registerExtension({ |
|
name: id, |
|
init() { |
|
const ctxMenu = LiteGraph.ContextMenu; |
|
const replace = () => { |
|
LiteGraph.ContextMenu = function (values, options) { |
|
options = options || {}; |
|
if (options.scroll_speed) { |
|
options.scroll_speed *= -1; |
|
} else { |
|
options.scroll_speed = -0.1; |
|
} |
|
return ctxMenu.call(this, values, options); |
|
}; |
|
LiteGraph.ContextMenu.prototype = ctxMenu.prototype; |
|
}; |
|
app.ui.settings.addSetting({ |
|
id, |
|
name: "Invert Menu Scrolling", |
|
type: "boolean", |
|
defaultValue: false, |
|
onChange(value) { |
|
if (value) { |
|
replace(); |
|
} else { |
|
LiteGraph.ContextMenu = ctxMenu; |
|
} |
|
}, |
|
}); |
|
}, |
|
});
|
|
|