예제 #1
0
  // 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;
  }
예제 #2
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);
예제 #3
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());
 }
예제 #4
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;
 }
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (zoomSlider != null) {
     int val = zoomSlider.getValue();
     val -= e.getWheelRotation() * 2;
     zoomSlider.setValue(val);
   }
 }
예제 #6
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);
 }
  @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();
  }
예제 #8
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();
  }
예제 #9
0
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   double scale_ = (100.0 - e.getWheelRotation() * 5) / 100.0;
   scale *= scale_;
   updateAffineTransform();
   repaint();
 }
예제 #10
0
      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);
      }
예제 #11
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
  }
예제 #12
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);
  }
예제 #13
0
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {

    if (panel.isEnabled()) {
      instance.execute(new Zoom(panel.getImagePlus().getPerspective(), e.getWheelRotation()));
    }
  }
예제 #14
0
 public void mouseWheelMoved(MouseWheelEvent e) {
   int i = e.getWheelRotation();
   if (valid() && (Player == w.n || w.n == 0) && Putere - i <= 39 && Putere - i >= 0) {
     Putere -= i;
   }
   repaint();
 }
예제 #15
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);
  }
예제 #16
0
파일: Tools.java 프로젝트: Holdlen2DH/nest
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   final int wheelRotation = e.getWheelRotation();
   final double newZoomFactor =
       layerCanvas.getViewport().getZoomFactor() * Math.pow(1.1, wheelRotation);
   layerCanvas.getViewport().setZoomFactor(newZoomFactor);
 }
예제 #17
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();
    }
 /**
  * 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);
 }
예제 #19
0
 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();
 }
예제 #20
0
 /*
  * (non-Javadoc)
  *
  * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
  */
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   ZoneRenderer renderer = (ZoneRenderer) e.getSource();
   if (SwingUtil.isControlDown(e)) {
     if (e.getWheelRotation() > 0) {
       renderer.zoomOut(e.getX(), e.getY());
     } else {
       renderer.zoomIn(e.getX(), e.getY());
     }
   } else {
     if (e.getWheelRotation() > 0) {
       adjustGridSize(renderer, Size.Increase);
     } else {
       adjustGridSize(renderer, Size.Decrease);
     }
   }
 }
예제 #21
0
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (e.getWheelRotation() > 0) {
     menu.setReleased(0);
   } else {
     menu.setReleased(1);
   }
 }
예제 #22
0
파일: Z.java 프로젝트: adamldavis/z
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (e.isControlDown()) {
     log.debug("zoom:" + e.getWheelRotation());
     if (e.getWheelRotation() > 0 && scale > 0.125f) {
       scale /= 2f;
     } else if (e.getWheelRotation() < 0 && scale < 32) {
       scale *= 2f;
     }
     log.debug("Scale:" + scale);
     if (!edit.getEditors().isEmpty()) {
       for (Editor editor : edit.getEditors()) {
         editor.setScale(scale);
       }
     }
   }
 }
예제 #23
0
파일: JImage.java 프로젝트: RussTedrake/lcm
    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);
    }
예제 #24
0
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   int rotation = -e.getWheelRotation();
   if (rotation < 0) {
     MainCycle.drawPanel.setBackground(MyMouseClickListener.pickAColor(e.getPoint()));
     MainCycle.drawPanel.repaint();
   }
 }
예제 #25
0
 @Override
 public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {
   editor
       .getScrollingModel()
       .scrollVertically(
           editor.getScrollingModel().getVerticalScrollOffset()
               + (mouseWheelEvent.getWheelRotation() * editor.getLineHeight() * 3));
 }
예제 #26
0
    public void mouseWheelMoved(MouseWheelEvent e) {

      int notches = e.getWheelRotation();
      if (notches > 0) _currentZoom += _magnificationIncrement;
      else _currentZoom -= _magnificationIncrement;

      if (isShiftDown(e)) percentScaleImage(_currentZoom, Const.EXPAND_WINDOW);
      else percentScaleImage(_currentZoom, Const.DONT_EXPAND_WINDOW);
    }
    public void mouseWheelMoved(MouseWheelEvent e) {
      // TODO Auto-generated method stub
      int notches = e.getWheelRotation();

      getFrame()
          .getJsp()
          .getVerticalScrollBar()
          .setValue(getFrame().getJsp().getVerticalScrollBar().getValue() + (notches * 10));
    }
예제 #28
0
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (e.getWheelRotation() < 0) {
     displayCamera.zoom *= 1.05;
   } else {
     displayCamera.zoom *= .95;
   }
   if (displayCamera.zoom < 1000) displayCamera.zoom = 1000;
 }
예제 #29
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();
  }
 /** {@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();
   }
 }