Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fixes https://github.com/comfyanonymous/ComfyUI/issues/2059

### Installation

1. Put this folder into ComfyUI/custom_nodes/TinkerBot-tech-for-ComfyUI-Touchpad
1. Put this folder into ComfyUI/web/extensions/TinkerBot-tech-for-ComfyUI-Touchpad
2. Restart ComfyUI
3. Reload the UI
4. Enjoy!
24 changes: 11 additions & 13 deletions web/fix touchpad pan and zoom.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// @ts-check
/** @type {any} */
const { self } = window
import { app } from "../../../scripts/app.js";

/** @type {import("../../../web/types/litegraph")} */
const { LGraphCanvas } = self

// @ts-ignore
import * as ComfyUI_module from "../../../scripts/app.js"
/** @type { import("../../../web/scripts/app.js") } */
const { app } = ComfyUI_module

//////////////////////////////
app.registerExtension({
name: "ComfyUI-Mac-Trackpad",
async setup(app2) {
app2.canvas.ds.element.removeEventListener("mousewheel", app2.canvas.ds._binded_mouse_callback);
app2.canvas.ds.element.removeEventListener("wheel", app2.canvas.ds._binded_mouse_callback);
app2.canvas.ds.element.addEventListener("wheel", processWheel.bind(app2.canvas), false);
}
});

/**
* Smooth scrolling for touchpad
*/
LGraphCanvas.prototype.processMouseWheel = function (/** @type {WheelEvent}*/ event) {
function processWheel(/** @type {WheelEvent}*/ event) {
if (!this.graph || !this.allow_dragcanvas) return

const { clientX: x, clientY: y } = event
Expand All @@ -40,4 +38,4 @@ LGraphCanvas.prototype.processMouseWheel = function (/** @type {WheelEvent}*/ ev

event.preventDefault()
return false // prevent default
}
}