Change scrolling speed

Tags: #<Tag:0x00007f8b2574daf8>

Greetings! What piece of code is responsible for setting up scrolling speed? It’s too quick for my needs and I’d love to make it a bit slower

Hey @n.schipkov

This option is not a part of our official API but if you’d like to dig deeper you should look for translateMouseWheelToScroll.

Ok, I’ll do it and tell if I’ve got any successful outcomes :slight_smile:

1 Like

Ok, here’s the piece of code I’ve found in the handsontable\es\3rdparty\walkontable\src\overlays.js

{
        key: "translateMouseWheelToScroll",
        value: function translateMouseWheelToScroll(event) {
          var browserLineHeight = this.browserLineHeight;
          var deltaY = isNaN(event.deltaY) ? -1 * event.wheelDeltaY : event.deltaY;
          var deltaX = isNaN(event.deltaX) ? -1 * event.wheelDeltaX : event.deltaX;

          if (event.deltaMode === 1) {
            deltaX += deltaX * browserLineHeight;
            deltaY += deltaY * browserLineHeight;
          }

          this.scrollVertically(deltaY);
          this.scrollHorizontally(deltaX);
        }
        /**
         * Scrolls main scrollable element horizontally.
         *
         * @param {Number} delta Relative value to scroll.
         */

      }, {
        key: "scrollVertically",
        value: function scrollVertically(delta) {
          this.scrollableElement.scrollTop += delta;
        }
        /**
         * Scrolls main scrollable element horizontally.
         *
         * @param {Number} delta Relative value to scroll.
         */

      }, {
        key: "scrollHorizontally",
        value: function scrollHorizontally(delta) {
          this.scrollableElement.scrollLeft += delta;
        }

Tried to switch delta to 0 and… well, nothing changed, though I expected that scrolling wouldn’t happen :slight_smile:

Here https://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers is a SO topic that can share some tips.

Alright, will try and report

Hey @n.schipkov how’s the progress?

Programmatically, not much. As one of workarounds, it’s possible to change scrolling from “3” to “1” in a computer’s Control Panel. In this case, even if there are only 2 checkboxes in Dropdown Menu are visible, there won’t be a chance to scroll them over.

1 Like