Repository navigation
fix(editor): wheel scrolling and zoom in Firefox, Shift+wheel and small zoom steps - #402
Merged
Merged
Conversation
The editor pans on the non-standard mousewheel event and zooms on it with Ctrl, but kity only listens for an event that elements have an on<type> property for, and Firefox has neither onmousewheel nor fires mousewheel. So wheel scrolling and Ctrl+wheel zoom did nothing in Firefox. Where mousewheel is missing, give elements the property and re-dispatch each wheel event as mousewheel with the deltas Chrome reports. Fixes #93 Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
…l steps The editor ignored the wheel while Shift was held, and zoomed with Ctrl or Cmd only once a single event reported more than 100, which touchpad pinches and the small pixel steps of macOS never do. Re-dispatch the wheel as mousewheel in Chrome too where needed: with Shift as horizontal scrolling, and with Ctrl or Cmd with at least 120. The editor still zooms once per gesture, as it waits for 100 ms of quiet. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #93
In Firefox the mouse wheel did nothing on the mind map canvas: scrolling didn't move the canvas, vertically or horizontally, and Ctrl+wheel didn't zoom. Both work in Chrome. In every browser, Shift+wheel didn't scroll horizontally, and touchpad pinches and small wheel steps didn't zoom.
The vendored KityMinder pans on the non-standard
mousewheelevent and zooms on it when Ctrl or Cmd is held:mousewheel, andkitydoesn't even listen for it there.kityonly attaches a DOM listener when the element has anon<type>property ("onmousewheel" in node), which Firefox elements don't have. That also rules out KityMinder's ownDOMMouseScrollfallback, so Firefox got no wheel handling at all.src/viewer.js, the editor iframe's script, now handles the wheel before the editor does. The vendored files are unchanged.onmousewheelproperty, sokitybinds its listener, and every standardwheelevent is re-dispatched asmousewheelwith the deltas Chrome reports: 120 per notch of three lines, and 1.2 per pixel.In Chrome the native
mousewheelpasses through untouched in all other cases. When the editor handles an event, the original is cancelled, so the page itself doesn't scroll or zoom too.Tested on Nextcloud 32, 35 and 36, in Chromium and Firefox, by reading the editor's canvas position and zoom. The results are the same in both browsers and on all three versions:
macOS itself wasn't available for testing; the Cmd and small-step cases cover what macOS sends. Lint, Vitest and the build pass. Backport: #403.
🤖 AI (if applicable)