JDK-8057788 : [macosx] "Pinch to zoom" does not work since jdk7
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2014-09-08
  • Updated: 2015-06-04
  • Resolved: 2014-12-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b45Fixed
Description
FULL PRODUCT VERSION :
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
OS X Mavericks v10.9.3	Build 13D65


A DESCRIPTION OF THE PROBLEM :
com.apple.eawt.event.GestureUtilities implementation does not work. See the attached test.



REGRESSION.  Last worked in version 6u45

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the test, run, use trackpad to zoom in or out with two fingers.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The grid rects get bigger or smaller
ACTUAL -
Nothing happens

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import com.apple.eawt.event.GestureUtilities;
import com.apple.eawt.event.MagnificationEvent;
import com.apple.eawt.event.MagnificationListener;
 
import javax.swing.*;
import java.awt.*;
 
/**
 * @author Denis Fokin
 */
 
public class ZoomableApplication {
    private static float cellSize = 50;
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame jFrame = new JFrame("Zoomable Frame");
                final JPanel canvas = new JPanel(){
                    @Override
                    public void paint(Graphics g) {
                        super.paint(g);
                        int width = getWidth();
                        int height = getHeight();
                        g.setColor(Color.white);
                        for (int x = 0, y = 0; x < width || y < height; x += cellSize, y += cellSize) {
                            g.drawLine(x, 0, x, height);
                            g.drawLine(0, y, width, y);
                        }
                    }
                };
                GestureUtilities.addGestureListenerTo(canvas, new MagnificationListener() {
                    @Override
                    public void magnify(MagnificationEvent magnificationEvent) {
                        cellSize += magnificationEvent.getMagnification() * 20;
                        canvas.repaint();
                    }
                });
                canvas.setBackground(Color.BLACK);
                canvas.setPreferredSize(new Dimension(200,200));
                jFrame.getContentPane().add(canvas);
                jFrame.pack();
                jFrame.setVisible(true);
            }
        });
    }
}
---------- END SOURCE ----------