Package org.mt4j.input.inputData

Examples of org.mt4j.input.inputData.InputCursor


    //-> actually we always lock 2 cursors at once so should never be only 1 locked, but just for safety..
    this.unLockAllCursors();

    List<InputCursor> availableCursors = getFreeComponentCursors();
    if (availableCursors.size() >= 2){ //we can try to resume the gesture
      InputCursor firstCursor = availableCursors.get(0);
      InputCursor secondCursor = getFarthestFreeComponentCursorTo(firstCursor);

      //See if we can obtain a lock on both cursors
      IMTComponent3D comp = firstCursor.getFirstEvent().getTargetComponent();
      ScaleContext newContext = new ScaleContext(firstCursor, secondCursor, comp);
      if (!newContext.isGestureAborted()){ //Check if we could start gesture (ie. if fingers on component)
        sc = newContext;
        this.getLock(firstCursor, secondCursor);
        logger.debug(this.getName() + " we could lock cursors: " + firstCursor.getId() +", " + secondCursor.getId());
      }else{
        sc = null;
        logger.debug(this.getName() + " we could NOT resume gesture - cursors not on component: " + firstCursor.getId() +", " + secondCursor.getId());
      }
    }
  }
View Full Code Here


       
        switch (wmTouchEvent.type) {
        case Native_WM_TOUCH_Event.TOUCH_DOWN:{
//          logger.debug("TOUCH_DOWN ==> ID:" + wmTouchEvent.id + " x:" +  wmTouchEvent.x + " y:" +  wmTouchEvent.y);
         
          InputCursor c = new InputCursor();
          long cursorID = c.getId();
          MTWin7TouchInputEvt touchEvt = new MTWin7TouchInputEvt(this, wmTouchEvent.x, wmTouchEvent.y, wmTouchEvent.contactSizeX, wmTouchEvent.contactSizeY, MTFingerInputEvt.INPUT_DETECTED, c);
          int touchID = wmTouchEvent.id;
          ActiveCursorPool.getInstance().putActiveCursor(cursorID, c);
          touchToCursorID.put(touchID, cursorID);
          this.enqueueInputEvent(touchEvt);
         
          break;
        }case Native_WM_TOUCH_Event.TOUCH_MOVE:{
//          logger.debug("TOUCH_MOVE ==> ID:" + wmTouchEvent.id + " x:" +  wmTouchEvent.x + " y:" +  wmTouchEvent.y);
//          System.out.println("Contact area X:" + wmTouchEvent.contactSizeX + " Y:" + wmTouchEvent.contactSizeY);
         
          Long cursorID = touchToCursorID.get(wmTouchEvent.id);
          if (cursorID != null){
            InputCursor c = ActiveCursorPool.getInstance().getActiveCursorByID(cursorID);
            if (c != null){
              MTWin7TouchInputEvt te = new MTWin7TouchInputEvt(this, wmTouchEvent.x, wmTouchEvent.y, wmTouchEvent.contactSizeX, wmTouchEvent.contactSizeY, MTFingerInputEvt.INPUT_UPDATED, c);
              this.enqueueInputEvent(te)
            }
          }
         
          break;
        }case Native_WM_TOUCH_Event.TOUCH_UP:{
//          logger.debug("TOUCH_UP ==> ID:" + wmTouchEvent.id + " x:" +  wmTouchEvent.x + " y:" +  wmTouchEvent.y);

          Long cursorID = touchToCursorID.get(wmTouchEvent.id);
          if (cursorID != null){
            InputCursor c = ActiveCursorPool.getInstance().getActiveCursorByID(cursorID);
            if (c != null){
              MTWin7TouchInputEvt te = new MTWin7TouchInputEvt(this, wmTouchEvent.x, wmTouchEvent.y, wmTouchEvent.contactSizeX, wmTouchEvent.contactSizeY, MTFingerInputEvt.INPUT_ENDED, c);
              this.enqueueInputEvent(te);
            }
            ActiveCursorPool.getInstance().removeCursor(cursorID);
View Full Code Here

            break;
          case MTGestureEvent.GESTURE_ENDED:
            unhighlightButton(closeButton, buttonOpacity);
            unhighlightButton(restoreButton, buttonOpacity);
           
            InputCursor cursor = de.getDragCursor();
            Vector3D restoreButtonIntersection = restoreButton.getIntersectionGlobal(Tools3D.getCameraPickRay(getRenderer(), restoreButton, cursor.getCurrentEvtPosX(), cursor.getCurrentEvtPosY()));
            if (restoreButtonIntersection != null){
              logger.debug("--> RESTORE!");
              MTSceneMenu.this.sceneTexture.restore();
            }
            Vector3D closeButtonIntersection = closeButton.getIntersectionGlobal(Tools3D.getCameraPickRay(getRenderer(), closeButton, cursor.getCurrentEvtPosX(), cursor.getCurrentEvtPosY()));
            if (closeButtonIntersection != null){
//              if (app.popScene()){
//                app.removeScene(scene); //FIXME wont work if the scene has a transition because we cant remove the still active scene
////                destroy(); //this will be destroyed with the scene
//                sceneTexture.destroy(); //destroys also the MTSceneWindow and with it the scene
//                logger.debug("--> CLOSE!");
//              }
              if (sceneTexture.restore()){
//                app.removeScene(scene); //FIXME wont work if the scene has a transition because we cant remove the still active scene
//                destroy(); //this will be destroyed with the scene
                sceneTexture.destroy(); //destroys also the MTSceneWindow and with it the scene
                logger.debug("--> CLOSE!");
              }
            }
           
            restoreButton.setVisible(false);
            closeButton.setVisible(false);
            break;
          default:
            break;
          }
          return false;
        }
      });
    }else{
      if (scene != null){
        menuShape.addGestureListener(DragProcessor.class, new IGestureEventListener() {
          public boolean processGestureEvent(MTGestureEvent ge) {
            DragEvent de = (DragEvent)ge;
            switch (de.getId()) {
            case MTGestureEvent.GESTURE_DETECTED:
              closeButton.setVisible(true);
              unhighlightButton(closeButton, buttonOpacity);
              break;
            case MTGestureEvent.GESTURE_UPDATED:
              //Mouse over effect
              if (closeButton.containsPointGlobal(de.getTo())){
                highlightButton(closeButton);
              }else{
                unhighlightButton(closeButton, buttonOpacity);
              }
              break;
            case MTGestureEvent.GESTURE_ENDED:
              unhighlightButton(closeButton, buttonOpacity);
             
              InputCursor cursor = de.getDragCursor();
              Vector3D closeButtonIntersection = closeButton.getIntersectionGlobal(Tools3D.getCameraPickRay(getRenderer(), closeButton, cursor.getCurrentEvtPosX(), cursor.getCurrentEvtPosY()));
              if (closeButtonIntersection != null){
                if (app.popScene()){
                  destroy(); //Destroy this
                  scene.destroy(); //Destroy the scene
                  logger.debug("--> CLOSE!");
View Full Code Here

TOP

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

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.