Skip to content

Commit

Permalink
Fix text zoom when high-precision scrolling input is used
Browse files Browse the repository at this point in the history
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 https://github.com/JetBrains/intellij-community/blob/21c99af7c78fc82aefc4d05646389f4991b08b38/bin/idea.properties#L133-L156
  • Loading branch information
vlsi committed Jul 2, 2018
1 parent 6042502 commit eade186
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/us/deathmarine/luyten/OpenFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ public int getSourceOffset() {
scrollPane.addMouseWheelListener(new MouseWheelListener() {
@Override
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) {
Font font = textArea.getFont();
Expand Down

0 comments on commit eade186

Please sign in to comment.