Exemple #1
0
  /**
   * Handle the case where a plot implements the {@link Zoomable} interface.
   *
   * @param zoomable the zoomable plot.
   * @param e the mouse wheel event.
   */
  private void handleZoomable(Zoomable zoomable, MouseWheelEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = this.chartPanel.translateScreenToJava2D(e.getPoint());
    if (!pinfo.getDataArea().contains(p)) {
      return;
    }

    Plot plot = (Plot) zoomable;
    // do not notify while zooming each axis
    boolean notifyState = plot.isNotify();
    plot.setNotify(false);
    int clicks = e.getWheelRotation();
    double zf = 1.0 + this.zoomFactor;
    if (clicks < 0) {
      zf = 1.0 / zf;
    }
    if (chartPanel.isDomainZoomable()) {
      zoomable.zoomDomainAxes(zf, pinfo, p, true);
    }
    if (chartPanel.isRangeZoomable()) {
      zoomable.zoomRangeAxes(zf, pinfo, p, true);
    }
    plot.setNotify(notifyState); // this generates the change event too
  }
Exemple #2
0
  public void mouseWheelMoved(MouseWheelEvent event) {

    int zoom = event.getWheelRotation();

    mx = event.getX();
    my = event.getY();

    showStatus("Mouse rotated (" + zoom + ")");

    // zoom out
    if (zoom >= 0) {
      dbg.setColor(Color.black);
      //			dbg.drawImage (background, SIZE/2-current_size/2,
      //			        SIZE/2-current_size/2, current_size, current_size, this);
    }
    // zoom in
    else if (zoom < 0) {
      int width = building.getWidth(this);
      int height = building.getHeight(this);
      dbg.drawImage(
          building, width, height, width / 2, height / 2, width, height, width, height, this);
    }

    repaint();
    event.consume();
  }
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {
    super.mouseWheelMoved(e);

    int v = e.getWheelRotation() > 0 ? 1 : -1;

    float zoomFact = 1.05f;
    double cx = camera.pos.getX();
    double cy = camera.pos.getY();

    cx -= e.getPoint().x;
    cy -= e.getPoint().y;

    if (v < 0) {
      camera.scale *= zoomFact;
      cx *= zoomFact;
      cy *= zoomFact;
    } else {
      camera.scale /= zoomFact;
      cx /= zoomFact;
      cy /= zoomFact;
    }

    cx += e.getPoint().x;
    cy += e.getPoint().y;

    camera.pos.set(cx, cy);
    camera.proot.updateThis();
  }
Exemple #4
0
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
      if (e.getUnitsToScroll() > 0) {
        cminx -= dist * 0.1f;
        cminy -= dist * 0.1f;
        cmaxx += dist * 0.1f;
        cmaxy += dist * 0.1f;

        dcminx -= ddist * 0.1;
        dcminy -= ddist * 0.1;
        dcmaxx += ddist * 0.1;
        dcmaxy += ddist * 0.1;
      } else {
        cminx += dist * 0.1f;
        cminy += dist * 0.1f;
        cmaxx -= dist * 0.1f;
        cmaxy -= dist * 0.1f;

        dcminx += ddist * 0.1;
        dcminy += ddist * 0.1;
        dcmaxx -= ddist * 0.1;
        dcmaxy -= ddist * 0.1;
      }
      dist = (cmaxx - cminx);
      ddist = (dcmaxx - dcminx);
    }
  }
  @Override
  public void mouseWheelMoved(final MouseWheelEvent e) {
    //		System.out.println( "MouseAndKeyHandler.mouseWheelMoved()" );
    //		System.out.println( e );
    update();

    final int mask = getMask(e);
    final int x = e.getX();
    final int y = e.getY();
    final double wheelRotation = e.getPreciseWheelRotation();

    /*
     * AWT uses the SHIFT_DOWN_MASK to indicate horizontal scrolling. We
     * keep track of whether the SHIFT key was actually pressed for
     * disambiguation. However, we can only detect horizontal scrolling if
     * the SHIFT key is not pressed. With SHIFT pressed, everything is
     * treated as vertical scrolling.
     */
    final boolean exShiftMask = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
    final boolean isHorizontal = !shiftPressed && exShiftMask;

    for (final BehaviourEntry<ScrollBehaviour> scroll : scrolls) {
      if (scroll.buttons.matches(mask, pressedKeys)) {
        scroll.behaviour.scroll(wheelRotation, isHorizontal, x, y);
      }
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
  */
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (e.getSource() == jsVolume) {
     int iOld = jsVolume.getValue();
     int iNew = iOld - (e.getUnitsToScroll() * 3);
     jsVolume.setValue(iNew);
   }
 }
Exemple #7
0
  public void mouseWheelMoved(MouseWheelEvent e) {
    if (isOSX) {
      return;
    }
    int notches = e.getWheelRotation();

    if (false) {
      if (notches < 0) {
        child.zoomToCursor(child.getPctZoom() * 21 / 20, e.getPoint());
      } else {
        child.zoomToCursor(child.getPctZoom() * 20 / 21, e.getPoint());
      }

      Component comp = container.getParent().getParent();
      if (comp instanceof MainPanel) ((MainPanel) comp).updateZoomCombo();
    }

    boolean horizontalScroll =
        ((e.getModifiers() & ActionEvent.SHIFT_MASK) == ActionEvent.SHIFT_MASK)
            || ((e.getModifiers() & ActionEvent.META_MASK) == ActionEvent.META_MASK);

    Rectangle r = container.getViewport().getViewRect();
    int newx = Math.min((int) r.getMinX() + (horizontalScroll ? notches : 0), 0);
    int newy = Math.min((int) r.getMinY() + (horizontalScroll ? 0 : notches), 0);
    scrollTo(newx, newy);
  }
Exemple #8
0
    public void mouseWheelMoved(MouseWheelEvent e) {

      int notches = e.getWheelRotation();
      int sign = 1;
      if (notches > 0) {
        sign = -1;
      }
      if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int numClicks = e.getScrollAmount();
        scale = scale + (numClicks * 0.1f) * sign;
        if (scale <= 0) scale = 0.1f;
      }

      TheDisplayPanel.initDisplay();
      TheDisplayPanel.repaint();

      JScrollBar verticalScrollBar = TheScrollPane.getVerticalScrollBar();
      JScrollBar horizScrollBar = TheScrollPane.getHorizontalScrollBar();

      // Point pInImage = new
      // Point((int)(mouseMovePoint.x+lastScrollValueX),
      // (int)(mouseMovePoint.y+lastScrollValueY));

      verticalScrollBar.setValue((int) (lastScrollValueY + mouseMovePoint.y));
      horizScrollBar.setValue((int) (lastScrollValueX + mouseMovePoint.x));

      lastScrollValueX = horizScrollBar.getValue();
      lastScrollValueY = verticalScrollBar.getValue();

      TheFrame.validate();
      TheFrame.repaint();
    }
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {
    // camera not yet defined --> exit
    if (cam == null) return;

    if (e.isConsumed()) return;
    if (ren.VisibleActorCount() == 0) return;

    // consume event
    e.consume();

    // want fast update
    setCoarseRendering();
    // abort current rendering
    rw.SetAbortRender(1);

    // get delta
    double delta = e.getWheelRotation() * CanvasPreferences.getMouseWheelSensitivity();
    if (CanvasPreferences.getInvertMouseWheelAxis()) delta = -delta;

    // faster movement with control modifier
    if (EventUtil.isControlDown(e)) delta *= 3d;

    zoomView(Math.pow(1.02, delta));

    // request repaint
    repaint();

    // restore quality rendering in 1 second
    setFineRendering(1000);
  }
Exemple #10
0
 @Override
 public void mouseWheelMoved(final MouseWheelEvent e) {
   final double v = keyModfiedSpeed(e.getModifiersEx());
   final int s = e.getWheelRotation();
   p.setF(p.getF() * (1 - 0.05f * s * v));
   update(false);
 }
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (isEnabled()) {
     a += (double) e.getWheelRotation() / (double) 3;
     a = (a >= 1 ? 0.9999 : a <= -1 ? -0.9999 : a);
     face.setEmotion(p, a, d, e.getX(), e.getY());
   }
   paint();
 }
Exemple #12
0
    public void mouseWheelMoved(MouseWheelEvent e) {
      int amount = e.getWheelRotation();

      Point2D p = new Point2D.Double(e.getPoint().getX(), e.getPoint().getY());

      if (amount > 0) zoomOut(p);
      if (amount < 0) zoomIn(p);
    }
 /**
  * Overrides method from MouseWheelListener to ensure that the screen is scaled suitably when
  * zooming in and out. Method will capture the number of notches the mouse wheel was moved by, and
  * then invoke scaleScreen. Positive inputs (scroll down) decrease the scale of the screen, and
  * negative inputs (scroll up) increase it.
  */
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   Point mousePos =
       SwingUtilities.convertPoint(
           this, e.getPoint(), this); // get current mouse position relative to this pane
   int wheelMovedBy = e.getWheelRotation(); // number of notches moved in the mouse wheel
   scaleScreen(wheelMovedBy);
 }
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   int rotation = -e.getWheelRotation();
   if (rotation < 0) {
     MainCycle.drawPanel.setBackground(MyMouseClickListener.pickAColor(e.getPoint()));
     MainCycle.drawPanel.repaint();
   }
 }
 /** {@inheritedDoc} */
 public void mouseWheelMoved(MouseWheelEvent e) {
   if ((isMac && e.isMetaDown()) || e.isControlDown()) {
     int n = e.getWheelRotation();
     if (currentFontSize != Math.min(Math.max(0, currentFontSize + n), 6)) {
       modifyFontInEDT(n);
     }
     e.consume();
   }
 }
Exemple #16
0
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {
    int nbClicks = e.getWheelRotation(); // La vitesse à laquelle on a tourné la roulette

    for (IFormeEditable forme : this.pan.getFormesEditables())
      Action.agrandir(forme, new Point2D(e.getX(), e.getY()), 1 + 0.1 * nbClicks);

    this.pan.repaint();
  }
 protected void processMouseWheelEvent(MouseWheelEvent e) {
   MouseWheelEvent transformedEvent = (MouseWheelEvent) transformMouseEvent(e);
   MouseWheelListener[] mouseWheelListeners =
       transformedEvent.getComponent().getMouseWheelListeners();
   for (MouseWheelListener listener : mouseWheelListeners) {
     listener.mouseWheelMoved(transformedEvent);
   }
   super.processMouseWheelEvent(e);
 }
  /* (non-Javadoc)
   * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
   *
   * Thread safety: This method is thread safe
   */
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {

    int lines = e.getWheelRotation();
    if (e.isControlDown()) {
      this.fastTextView.scrollPage((lines < 0) ? true : false);
    } else {
      this.fastTextView.scrollLines(2 * lines);
    }
  }
  public void mouseWheelMoved(MouseWheelEvent e) {

    Event.EventType type = ScrollEvent.ScrollVertical;
    Node node = findTopNode(e.getX(), e.getY());
    int rotation = e.getWheelRotation();
    if (e.isShiftDown()) {
      type = ScrollEvent.ScrollHorizontal;
    }
    EventBus.getSystem().publish(new ScrollEvent(type, node, rotation));
  }
  // Called when the mouse wheel is rotated
  public void onMouseWheelMoved(MouseWheelEvent e) {
    // If the wheel rotation is negative it means that it is moved forward.
    // Set move direction = forward, if wheel is moved forward.
    // Otherwise, set move direction = backward
    moveDirection = (e.getWheelRotation() < 0) ? 1 : -1;

    // Set the amount to move = absolute wheel rotation amount * 5 (speed)
    // Here 5 means 5 pixels per wheel rotation step. The higher value, the
    // more speed
    moveAmount += Math.abs(e.getWheelRotation()) * 5;
  }
 private static boolean isHorizontalScrolling(Component c, MouseEvent e) {
   if (c != null
       && e instanceof MouseWheelEvent
       && (!SystemInfo.isMac || isDiagramViewComponent(c.getParent()))) {
     final MouseWheelEvent mwe = (MouseWheelEvent) e;
     return mwe.isShiftDown()
         && mwe.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL
         && findHorizontalScrollBar(c) != null;
   }
   return false;
 }
Exemple #22
0
  public void mouseWheel(MouseWheelEvent event) {
    if (win.mouseWheel(event)) return;

    if (!Utilities.isPointInBox(mouseX, mouseY, 0, 0, draw_width, draw_height)) return;

    if (zoomLevel > minZoom || event.getWheelRotation() > 0) {
      zoomLevel = Math.max(minZoom, (zoomLevel + 0.1f * event.getWheelRotation()));
      offsetX -= (int) (((mouseX - offsetX) * (0.1f * event.getWheelRotation()))) / zoomLevel;
      offsetY -= (int) (((mouseY - offsetY) * (0.1f * event.getWheelRotation()))) / zoomLevel;
    }
  } // SIM_TICKS = (int) (slider.getValue() * SIM_TPS_MAX);
Exemple #23
0
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (rightclicking) {
     // angle += e.getWheelRotation() * 0.5;
     heightscale += e.getWheelRotation() * 0.01;
     switched = true;
     System.out.println(heightscale);
   } else {
     height += e.getWheelRotation() * 0.1;
     // scene.setLightCircleLookInside(posx, height);
   }
   // scene.setLightCircleLookOutside(posx,posy,height,angle,1,1,scene.lightCount());
 }
 public void mouseWheelMoved(MouseWheelEvent e) {
   Options options = OptionsManager.getInstance().getOptions();
   EditorOptions editorOptions = options.getEditorOptions();
   ZoomOptions zoomOptions = editorOptions.getZoomOptions();
   if (zoomOptions.isWheelZooming() && e.isControlDown()) {
     if (e.getWheelRotation() < 0) {
       zoomModel.zoomOut();
     } else {
       zoomModel.zoomIn();
     }
     e.consume();
   }
 }
      public void mouseWheelMoved(MouseWheelEvent e) {
        String st[] = {"PER UNITA'", "PER BLOCCO"};

        int unit = e.getUnitsToScroll();

        // calcolo per la scrollbar verticale l'attuale posizione
        // e l'unità di incremento per scroll
        JScrollBar sb = sp.getVerticalScrollBar();
        int y = sb.getValue();
        int y1 =
            e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL
                ? sb.getUnitIncrement(1)
                : sb.getBlockIncrement(1);

        sb.setValue(y + y1 * unit); // aggiorna la view della textarea

        int a = e.getScrollAmount();
        int b = e.getScrollType();
        int c = e.getUnitsToScroll();
        int d = e.getWheelRotation();
        double f = e.getPreciseWheelRotation();
        String g =
            "Unità da scorrere per giro di tacca: "
                + a
                + "\nTipo di scroll: "
                + st[e.getScrollType()]
                + "\nUnità che scorreranno verso l'alto: "
                + c
                + "\nNumero di tacche ruotate: "
                + d
                + "\nNumero di tacche precisamente ruotate: "
                + f;

        wheel_area.setText(g);
      }
  /**
   * This mouse wheel listener reacts when a scroll is carried out over the tab strip and scrolls
   * one tab/down or up, selecting it immediately.
   */
  @Override
  public void mouseWheelMoved(MouseWheelEvent wev) {
    // Ensure the cursor is over the tab strip
    if (super.indexAtLocation(wev.getPoint().x, wev.getPoint().y) < 0) return;

    // Get currently selected tab
    int newTab = super.getSelectedIndex() + wev.getWheelRotation();

    // Ensure the new tab index is sound
    newTab = newTab < 0 ? 0 : newTab;
    newTab = newTab >= super.getTabCount() ? super.getTabCount() - 1 : newTab;

    // select new tab
    super.setSelectedIndex(newTab);
  }
Exemple #27
0
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (camDist > 1.0) {
     camDist += (0.5f * camDist) * zoomFactor * e.getWheelRotation();
     PVector newMouse = getNewMouse();
     //			PVector toAdd = new PVector(newMouse.x - p.width*0.5f,newMouse.y - p.height*0.5f);
     PVector toAdd = new PVector(newMouse.x, newMouse.y);
     toAdd.sub(new PVector(camCenter.x, camCenter.y));
     toAdd.mult(-0.05f * e.getWheelRotation());
     camPos.add(toAdd);
     //			camPos.mult(0.5f);
     camCenter.add(toAdd);
     //			camCenter.mult(0.5f);
   } else camDist = 1.01f;
 }
Exemple #28
0
 public boolean handleMouseWheelEvent(MouseWheelEvent e) {
   if ((e.getModifiers() & InputEvent.ALT_MASK) != 0) {
     logger.info("handleMouseWheelEvent entered.");
     MindMapNode rootNode = mMap.getRootNode();
     if (e.getWheelRotation() > 0) {
       hookInstance.unfoldOneStage(rootNode);
     } else {
       // this is to avoid having selected nodes getting folded.
       controller.select(controller.getView().getRoot());
       hookInstance.foldOneStage(rootNode);
     }
     return true;
   }
   return false;
 }
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {

    if (panel.isEnabled()) {
      instance.execute(new Zoom(panel.getImagePlus().getPerspective(), e.getWheelRotation()));
    }
  }
 public void mouseWheelMoved(MouseWheelEvent event) {
   JGVTComponent component = (JGVTComponent) event.getSource();
   double scale = 1 - 0.2 * event.getWheelRotation();
   int x = event.getX();
   int y = event.getY();
   AffineTransform at = AffineTransform.getTranslateInstance(x, y);
   at.scale(scale, scale);
   at.translate(-x, -y);
   AffineTransform rt = (AffineTransform) component.getRenderingTransform().clone();
   rt.preConcatenate(at);
   if (rt.getDeterminant() < MAX_ZOOM_DETERMINANT) {
     return;
   }
   component.setRenderingTransform(rt);
   calculator.reset();
 }