@Override
 public boolean processMouseDown(MouseDownEvent event) {
   JavaScriptObject target = event.getNativeEvent().getEventTarget();
   m = g.getScreenCTM().inverse();
   delta = getCoordinates(event, m);
   float x = posHandle.getX().getBaseVal().getValue();
   float y = posHandle.getY().getBaseVal().getValue();
   float width = posHandle.getWidth().getBaseVal().getValue();
   float height = posHandle.getHeight().getBaseVal().getValue();
   OMSVGPoint p = svg.createSVGPoint();
   if (target == posHandle.getElement()) {
     mode = Mode.POS;
     p.setX(x);
     p.setY(y);
   } else if (target == topLeftHandle.getElement()) {
     p.setX(x);
     p.setY(y);
     mode = Mode.TOP_LEFT;
   } else if (target == bottomRightHandle.getElement()) {
     p.setX(x + width);
     p.setY(y + height);
     mode = Mode.BOTTOM_RIGHT;
   }
   if (mode.consumeEvent()) {
     delta.substract(p);
     event.preventDefault();
     event.stopPropagation();
   }
   return true;
 }
 @Override
 public boolean processMouseMove(MouseMoveEvent event) {
   if (mode.consumeEvent()) {
     float x = posHandle.getX().getBaseVal().getValue();
     float y = posHandle.getY().getBaseVal().getValue();
     float width = posHandle.getWidth().getBaseVal().getValue();
     float height = posHandle.getHeight().getBaseVal().getValue();
     OMSVGPoint p = getCoordinates(event, m).substract(delta);
     switch (mode) {
       case POS:
         {
           posHandle.getX().getBaseVal().setValue(p.getX());
           posHandle.getY().getBaseVal().setValue(p.getY());
         }
         break;
       case TOP_LEFT:
         {
           float xmax = Math.min(p.getX(), x + width);
           float ymax = Math.min(p.getY(), y + height);
           posHandle.getX().getBaseVal().setValue(xmax);
           posHandle.getY().getBaseVal().setValue(ymax);
           posHandle.getWidth().getBaseVal().setValue(width + x - xmax);
           posHandle.getHeight().getBaseVal().setValue(height + y - ymax);
         }
         break;
       case BOTTOM_RIGHT:
         {
           float xmin = Math.max(p.getX(), x);
           float ymin = Math.max(p.getY(), y);
           posHandle.getWidth().getBaseVal().setValue(xmin - x);
           posHandle.getHeight().getBaseVal().setValue(ymin - y);
         }
         break;
     }
     update();
     event.preventDefault();
     event.stopPropagation();
   }
   return true;
 }