Created
August 20, 2019 17:44
-
-
Save ar-nelson/9d545c51501ae4527a5c7dd920cab15b to your computer and use it in GitHub Desktop.
Greasemonkey script to fix slow Figma mouse wheel scrolling in Firefox on Linux
This file contains 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
// ==UserScript== | |
// @name Figma Mouse Wheel Speed Fix | |
// @namespace https://adam.nels.onl | |
// @match https://www.figma.com/* | |
// @grant none | |
// ==/UserScript== | |
// Mouse wheel scrolling in Figma on Firefox + Linux is unbearably slow. | |
// | |
// This script catches all mouse wheel events on the main canvas, | |
// then re-fires them with the deltaX/deltaY increased by a multiplier. | |
// | |
// - Adam Nelson <[email protected]> | |
const MULTIPLIER_X = 30; | |
const MULTIPLIER_Y = 10; | |
function speedUp(ev) { | |
if (!ev.isTrusted) return true; // Prevent recursion. | |
const { clientX, clientY, screenX, screenY, shiftKey, ctrlKey, altKey } = ev; | |
const newEv = new WheelEvent('wheel', { | |
bubbles: true, | |
cancelable: true, | |
view: window, | |
clientX, | |
clientY, | |
screenX, | |
screenY, | |
ctrlKey, | |
shiftKey, | |
altKey, | |
deltaX: ev.deltaX * MULTIPLIER_X, | |
deltaY: ev.deltaY * MULTIPLIER_Y | |
}); | |
ev.preventDefault(); | |
ev.stopPropagation(); | |
ev.target.dispatchEvent(newEv); | |
return false; | |
} | |
// Wait for the main canvas to show up. | |
function addCanvasEvent() { | |
const canvas = document.querySelector('.view > canvas'); | |
if (canvas != null) canvas.addEventListener('wheel', speedUp); | |
else setTimeout(addCanvasEvent, 500); | |
} | |
addCanvasEvent(); |
I just set MULTIPLIER_X and Y to 0.5 and now it`s a bit better.
@guifsdev This seems like a problem with firefox new defaults.
There was a post en reddit that seems to be the same as your issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Is there any update for this script to work for Firefox 91 as of august 2021?
My scroll speed is now extremely high, jumping 10x each turn.
Turning of the script makes is too slow also.
Changing the values of MULTIPLIER_X and MULTIPLIER_Y does not produce any effect even refreshing.
Any help appreciated.