StopPropagationHandler handler = new StopPropagationHandler();
left.addMouseUpHandler(new MouseUpHandler() {
public void onMouseUp(MouseUpEvent event) {
Bbox bounds = viewPort.getBounds();
double deltaX = -bounds.getWidth() / 3;
PanAnimation animation = new PanAnimation(viewPort);
animation.panTo(deltaX, 0, 300);
event.stopPropagation();
}
});
left.addMouseDownHandler(handler);
left.addClickHandler(handler);
left.addDoubleClickHandler(handler);
right.addMouseUpHandler(new MouseUpHandler() {
public void onMouseUp(MouseUpEvent event) {
Bbox bounds = viewPort.getBounds();
double deltaX = bounds.getWidth() / 3;
PanAnimation animation = new PanAnimation(viewPort);
animation.panTo(deltaX, 0, 300);
event.stopPropagation();
}
});
right.addMouseDownHandler(handler);
right.addClickHandler(handler);
right.addDoubleClickHandler(handler);
up.addMouseUpHandler(new MouseUpHandler() {
public void onMouseUp(MouseUpEvent event) {
Bbox bounds = viewPort.getBounds();
double deltaY = bounds.getHeight() / 3;
PanAnimation animation = new PanAnimation(viewPort);
animation.panTo(0, deltaY, 300);
event.stopPropagation();
}
});
up.addMouseDownHandler(handler);
up.addClickHandler(handler);
up.addDoubleClickHandler(handler);
down.addMouseUpHandler(new MouseUpHandler() {
public void onMouseUp(MouseUpEvent event) {
Bbox bounds = viewPort.getBounds();
double deltaY = -bounds.getHeight() / 3;
PanAnimation animation = new PanAnimation(viewPort);
animation.panTo(0, deltaY, 300);
event.stopPropagation();
}
});