示例#1
0
文件: window.java 项目: asong91/2012
  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();
  }
示例#2
0
  @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);
  }
 /** {@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();
   }
 }
 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();
   }
 }