logger.debug(this.getName() + " INPUT_STARTED, Cursor: " + newCursor.getId());
List<InputCursor> alreadyLockedCursors = getLockedCursors();
if (alreadyLockedCursors.size() >= 2){ //gesture with 2 fingers already in progress
//TODO get the 2 cursors which are most far away from each other
InputCursor firstCursor = alreadyLockedCursors.get(0);
InputCursor secondCursor = alreadyLockedCursors.get(1);
if (isCursorDistanceGreater(firstCursor, secondCursor, newCursor) && canLock(firstCursor, newCursor)){
RotationContext newContext = new RotationContext(firstCursor, newCursor, comp);
if (!newContext.isGestureAborted()){ //Check if we could start gesture (ie. if fingers on component)
rc = newContext;
//Lock new Second cursor
this.getLock(firstCursor, newCursor);
this.unLock(secondCursor);
logger.debug(this.getName() + " we could lock cursors: " + firstCursor.getId() +", and more far away cursor " + newCursor.getId());
}else{
logger.debug(this.getName() + " we could NOT exchange new second cursor - cursor not on component: " + firstCursor.getId() +", " + secondCursor.getId());
}
}else{
logger.debug(this.getName() + " has already enough cursors for this gesture and the new cursors distance to the first one ist greater (or we dont have the priority to lock it) - adding to unused ID:" + newCursor.getId());
}
}else{ //no gesture in progress yet
List<InputCursor> availableCursors = getFreeComponentCursors();
logger.debug(this.getName() + " Available cursors: " + availableCursors.size());
if (availableCursors.size() >= 2){
InputCursor otherCursor = getFarthestFreeComponentCursorTo(newCursor);
// logger.debug(this.getName() + " already had 1 unused cursor - we can try start gesture! used Cursor ID:" + otherCursor.getId() + " and new cursor ID:" + newCursor.getId());
if (this.canLock(otherCursor, newCursor)){ //TODO remove check, since alreday checked in getAvailableComponentCursors()?
rc = new RotationContext(otherCursor, newCursor, comp);
if (!rc.isGestureAborted()){