Fix text zoom when high-precision scrolling input is used

Touchpad / MagicMouse provide high-precision scrolling events,
and getWheelRotation() often turns out to be 0
Just ignore the events for now since proper handling of high precision is complicated

see 21c99af7c7/bin/idea.properties (L133-L156)
This commit is contained in:
Vladimir Sitnikov 2018-07-02 23:27:23 +03:00
parent 6042502552
commit eade1865d9

View File

@ -227,6 +227,13 @@ public class OpenFile implements SyntaxConstants {
scrollPane.addMouseWheelListener(new MouseWheelListener() { scrollPane.addMouseWheelListener(new MouseWheelListener() {
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getWheelRotation() == 0) {
// Nothing to do here. This happens when scroll event is delivered from a touchbar
// or MagicMouse. There's getPreciseWheelRotation, however it looks like there's no
// trivial and consistent way to use that
// See https://github.com/JetBrains/intellij-community/blob/21c99af7c78fc82aefc4d05646389f4991b08b38/bin/idea.properties#L133-L156
return;
}
if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) { if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) {
Font font = textArea.getFont(); Font font = textArea.getFont();