Enable ts-strict for invertMenuScrolling.ts (#1264)

This commit is contained in:
YANG Zhitao
2024-10-24 00:03:33 +08:00
committed by GitHub
parent f228ec29eb
commit 9388ee0705

View File

@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { LiteGraph } from '@comfyorg/litegraph'
import { app } from '../../scripts/app'
@@ -10,17 +9,22 @@ app.registerExtension({
init() {
const ctxMenu = LiteGraph.ContextMenu
const replace = () => {
// @ts-expect-error
LiteGraph.ContextMenu = function (values, options) {
options = options || {}
if (options.scroll_speed) {
options.scroll_speed *= -1
} else {
options.scroll_speed = -0.1
type CtxMenuConstructorArgs = ConstructorParameters<typeof ctxMenu>
class InvertContextMenu extends ctxMenu {
constructor(
values: CtxMenuConstructorArgs[0],
options: CtxMenuConstructorArgs[1]
) {
options = options || {}
if (options.scroll_speed) {
options.scroll_speed *= -1
} else {
options.scroll_speed = -0.1
}
super(values, options)
}
return ctxMenu.call(this, values, options)
}
LiteGraph.ContextMenu.prototype = ctxMenu.prototype
LiteGraph.ContextMenu = InvertContextMenu
}
app.ui.settings.addSetting({
id,