示例#1
0
 @Override
 public void mouseScrolled(MouseEvent e) {
   if (e.count > 0) {
     ctrl.zoomIn(e.x, e.y);
   } else {
     ctrl.zoomOut(e.x, e.y);
   }
 }
示例#2
0
 @Override
 public void mouseUp(MouseEvent e) {
   dragging = false;
   ctrl.drag(0, 0);
   if (dx != 0 && dy != 0) {
     ctrl.move(dx, dy);
   }
   dx = dy = 0;
 }
示例#3
0
 @Override
 public void mouseMove(MouseEvent e) {
   if (dragging) {
     dx += e.x - lastX;
     dy += e.y - lastY;
     if (dx != 0 && dy != 0) {
       lastX = e.x;
       lastY = e.y;
       ctrl.drag(dx, dy);
     }
   }
 }