Skip to content

Commit

Permalink
Enable ts-strict for invertMenuScrolling.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
maoXyzt committed Oct 17, 2024
1 parent 7239e94 commit 864029c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/extensions/core/invertMenuScrolling.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { LiteGraph } from '@comfyorg/litegraph'
import { app } from '../../scripts/app'

Expand All @@ -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,
Expand Down

0 comments on commit 864029c

Please sign in to comment.