Package com.alderstone.multitouch.mac.touchpad

Examples of com.alderstone.multitouch.mac.touchpad.Finger


     * @param o
     * @param arg
     */
    @Override
    public void update(Observable o, Object arg) {
        Finger finger = (Finger) arg;
        //showRawData(finger);
        int id = finger.getID();
        if (id <= MAX_FINGER_BLOBS) blobs[id-1] = finger;
       
        // blob が1つでも press だったら pressed = true
        pressed = false;
        // 速度は最初に見つかった pressed の finger の値とする
View Full Code Here


   
    this.fingerIdToCursorId = new HashMap<Integer, Long>();
  }

  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;
    }
   
    int absoluteX = Math.round(finger.getX()*this.windowWidth);
    int absoluteY = Math.round((1-finger.getY())*this.windowHeight);
    this.enqueueInputEvent(new MTFingerInputEvt(this, absoluteX, absoluteY, inputID, cursor));
  }
View Full Code Here

TOP

Related Classes of com.alderstone.multitouch.mac.touchpad.Finger

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.