private void setupCanvas() {
    mousePanMediator.setBatchDraw(true);
    mousePanMediator.setTransformMediator(new BoundaryTransformMediator());
    gridPanel.getViewport().getMediators().push(mousePanMediator);

    final Transform transform = new Transform().scale(VP_SCALE);
    gridPanel.getViewport().setTransform(transform);

    gridPanel.add(gridLayer);
  }
  @Override
  public void setZoom(final int zoom) {
    final Transform transform = new Transform();
    final double tx = gridPanel.getViewport().getTransform().getTranslateX();
    final double ty = gridPanel.getViewport().getTransform().getTranslateY();
    transform.translate(tx, ty);
    transform.scale(((double) zoom / 100.0));

    gridPanel.getViewport().setTransform(transform);
    gridPanel.getViewport().batch();
  }
 @Override
 public void onResize() {
   gridPanel.onResize();
 }
 @Override
 public HandlerRegistration addKeyDownHandler(final KeyDownHandler handler) {
   return gridPanel.addDomHandler(handler, KeyDownEvent.getType());
 }