double (MouseWheelEvent event) { if (TouchScrollUtil.isTouchScroll(event)) { return TouchScrollUtil.getDelta(event); } double rotation = event.getPreciseWheelRotation(); if (ScrollSettings.isPixelPerfectEnabled()) { // calculate an absolute delta if possible if (SystemInfo.isMac) { // Native code in our JDK for Mac uses 0.1 to convert pixels to units, // so we use 10 to restore amount of pixels to scroll. return 10 * rotation; } JViewport viewport = getViewport(); Font font = viewport == null ? null : getViewFont(viewport); int size = font == null ? JBUIScale.scale(10) : font.getSize(); // assume an unit size return size * rotation * event.getScrollAmount(); } if (ScrollSettings.isHighPrecisionEnabled()) { // calculate a relative delta if possible int direction = rotation < 0 ? -1 : 1; int unitIncrement = getUnitIncrement(direction); double delta = unitIncrement * rotation * event.getScrollAmount(); // When the scrolling speed is set to maximum, it's possible to scroll by more units than will fit in the visible area. // To make for more accurate low-speed scrolling, we limit scrolling to the block increment // if the wheel was only rotated one click. double blockIncrement = getBlockIncrement(direction); return boundDelta(-blockIncrement, blockIncrement, delta); } return Double.NaN; }