private void dragEntity(boolean isShiftKeyDown,GridElement mainElement){
  DESELECT_MULTISEL=false;
  Point newp=getNewCoordinate();
  Point oldp=getOldCoordinate();
  int diffx=newp.x - oldp.x;
  int diffy=newp.y - oldp.y;
  List<GridElement> elementsToMove=selector.getSelectedElements();
  if (!resizeDirections.isEmpty()) {
    elementsToMove=Arrays.asList(mainElement);
  }
  if (FIRST_MOVE_COMMANDS == null) {
    POINT_BEFORE_MOVE=mousePressedPoint;
    FIRST_MOVE_COMMANDS=calculateFirstMoveCommands(diffx,diffy,POINT_BEFORE_MOVE,elementsToMove,isShiftKeyDown,false,handler,resizeDirections);
  }
 else   if (diffx != 0 || diffy != 0) {
    Vector<Command> commands=continueDragging(diffx,diffy,POINT_BEFORE_MOVE,elementsToMove);
    POINT_BEFORE_MOVE=new Point(POINT_BEFORE_MOVE.getX() + diffx,POINT_BEFORE_MOVE.getY() + diffy);
    controller.executeCommand(new Macro(commands));
    FIRST_DRAG=false;
  }
}

private void dragEntity ( boolean isShiftKeyDown , GridElement mainElement ) { DESELECT_MULTISEL = false ; Point newp = getNewCoordinate ( ) ; Point oldp = getOldCoordinate ( ) ; int diffx = newp . x - oldp . x ; int diffy = newp . y - oldp . y ; List < GridElement > elementsToMove = selector . getSelectedElements ( ) ; if ( ! resizeDirections . isEmpty ( ) ) { elementsToMove = Arrays . asList ( mainElement ) ; } if ( FIRST_MOVE_COMMANDS == null ) { POINT_BEFORE_MOVE = mousePressedPoint ; FIRST_MOVE_COMMANDS = calculateFirstMoveCommands ( diffx , diffy , POINT_BEFORE_MOVE , elementsToMove , isShiftKeyDown , false , handler , resizeDirections ) ; } else if ( diffx != 0 || diffy != 0 ) { Vector < Command > commands = continueDragging ( diffx , diffy , POINT_BEFORE_MOVE , elementsToMove ) ; POINT_BEFORE_MOVE = new Point ( POINT_BEFORE_MOVE . getX ( ) + diffx , POINT_BEFORE_MOVE . getY ( ) + diffy ) ; controller . executeCommand ( new Macro ( commands ) ) ; FIRST_DRAG = false ; } }
dragging entities must be a macro , because undo should undo the full move ( and not only a small part which would happen with many short move actions ) and it must consider sticking relations at the dragging - start and later
