Ejemplo n.º 1
0
 private void kochPanelMouseDragged(MouseEvent event) {
   zoomTranslateX = zoomTranslateX + event.getX() - lastDragX;
   zoomTranslateY = zoomTranslateY + event.getY() - lastDragY;
   lastDragX = event.getX();
   lastDragY = event.getY();
   kochManager.drawEdges();
 }
Ejemplo n.º 2
0
 private void kochPanelMouseClicked(MouseEvent event) {
   if (Math.abs(event.getX() - startPressedX) < 1.0
       && Math.abs(event.getY() - startPressedY) < 1.0) {
     double originalPointClickedX = (event.getX() - zoomTranslateX) / zoom;
     double originalPointClickedY = (event.getY() - zoomTranslateY) / zoom;
     if (event.getButton() == MouseButton.PRIMARY) {
       zoom *= 2.0;
     } else if (event.getButton() == MouseButton.SECONDARY) {
       zoom /= 2.0;
     }
     zoomTranslateX = (int) (event.getX() - originalPointClickedX * zoom);
     zoomTranslateY = (int) (event.getY() - originalPointClickedY * zoom);
     kochManager.drawEdges();
   }
 }
Ejemplo n.º 3
0
 private void kochPanelMousePressed(MouseEvent event) {
   startPressedX = event.getX();
   startPressedY = event.getY();
   lastDragX = event.getX();
   lastDragY = event.getY();
 }