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.
37 lines
798 B
37 lines
798 B
2 years ago
|
import { app } from "/scripts/app.js";
|
||
|
|
||
|
// Inverts the scrolling of context menus
|
||
|
|
||
|
const id = "Comfy.InvertMenuScrolling";
|
||
|
const ctxMenu = LiteGraph.ContextMenu;
|
||
|
app.registerExtension({
|
||
|
name: id,
|
||
|
init() {
|
||
|
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;
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
},
|
||
|
});
|