-
-
Save ar-nelson/9d545c51501ae4527a5c7dd920cab15b to your computer and use it in GitHub Desktop.
// ==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(); |
@thblckjkr It's a Greasemonkey script, so just install the extension: https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
Then select "New user script" from the extension's menu, and paste the contents of this script into it. The @match https://www.figma.com/*
line will make it autoload on all Figma pages.
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.
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.
Works great!!
Do you know if is there any way to make firefox load this script every time I open up figma?