@Override
  public void gestureBegan(GesturePhaseEvent event) {
    magnification = 0;

    PointerInfo pointerInfo = MouseInfo.getPointerInfo();

    if (pointerInfo == null) return;

    Point mouse = new Point(pointerInfo.getLocation());
    SwingUtilities.convertPointFromScreen(mouse, myFrame.getComponent());
    Component deepest = SwingUtilities.getDeepestComponentAt(myFrame.getComponent(), mouse.x, mouse.y);
    ZoomableViewport viewport = (ZoomableViewport) SwingUtilities.getAncestorOfClass(ZoomableViewport.class, deepest);
    if (viewport != null) {
      Magnificator magnificator = viewport.getMagnificator();

      if (magnificator != null) {
        Point at = new Point(pointerInfo.getLocation());
        SwingUtilities.convertPointFromScreen(at, (JComponent)viewport);
        viewport.magnificationStarted(at);
        myMagnifyingViewport = viewport;
      }
    }
  }
@Override
  public void gestureBegan(GesturePhaseEvent event)