Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8057788

[macosx] "Pinch to zoom" does not work since jdk7

XMLWordPrintable

    • b45
    • x86
    • os_x

        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 ----------

              serb Sergey Bylokhov
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: