Skip to content

Instantly share code, notes, and snippets.

@ar-nelson
Created August 20, 2019 17:44
Show Gist options
  • Save ar-nelson/9d545c51501ae4527a5c7dd920cab15b to your computer and use it in GitHub Desktop.
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
// ==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 <adam@nels.onl>
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();
@guifsdev
Copy link

I just set MULTIPLIER_X and Y to 0.5 and now it`s a bit better.

@thblckjkr
Copy link

@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