Package org.mt4j.input.inputData

Examples of org.mt4j.input.inputData.ActiveCursorPool


  public void update(Observable obj, Object arg) {
    Finger finger = (Finger) arg;
    int fingerID = finger.getID();
   
    ActiveCursorPool cursorPool = ActiveCursorPool.getInstance();
    int inputID;
    Long cursorID = fingerIdToCursorId.get(fingerID);
    InputCursor cursor = (cursorID != null)? cursorPool.getActiveCursorByID(cursorID) : null;
   
    if (finger.getState() == FingerState.PRESSED) {
      if (cursor == null) { //new finger
        cursor = new InputCursor();
        fingerIdToCursorId.put(fingerID, cursor.getId());
        cursorPool.putActiveCursor(cursor.getId(), cursor);
        inputID = MTFingerInputEvt.INPUT_DETECTED;
      } else { //updated finger
        inputID = MTFingerInputEvt.INPUT_UPDATED;
      }
    } else { //removed finger
      if (cursorID != null){
        cursorPool.removeCursor(cursorID);
      }
      fingerIdToCursorId.remove(fingerID);
      inputID = MTFingerInputEvt.INPUT_ENDED;
    }
   
View Full Code Here

TOP

Related Classes of org.mt4j.input.inputData.ActiveCursorPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.