Examples of IMTComponent3D


Examples of org.mt4j.components.interfaces.IMTComponent3D

  /* (non-Javadoc)
   * @see org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor#cursorUpdated(org.mt4j.input.inputData.InputCursor, org.mt4j.input.inputData.MTFingerInputEvt)
   */
  @Override
  public void cursorUpdated(InputCursor c, MTFingerInputEvt fe) {
    IMTComponent3D comp = fe.getTargetComponent();
    if (getLockedCursors().contains(c)){
      dc.updateDragPosition();
      this.fireGestureEvent(new DragEvent(this, MTGestureEvent.GESTURE_UPDATED, comp, c, dc.getLastPosition(), dc.getNewPosition()));
    }
  }
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  /* (non-Javadoc)
   * @see org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor#cursorEnded(org.mt4j.input.inputData.InputCursor, org.mt4j.input.inputData.MTFingerInputEvt)
   */
  @Override
  public void cursorEnded(InputCursor c, MTFingerInputEvt fe) {
    IMTComponent3D comp = fe.getTargetComponent();
    logger.debug(this.getName() + " INPUT_ENDED RECIEVED - MOTION: " + c.getId());
    if (getLockedCursors().contains(c)){ //cursors was a actual gesture cursors
      dc.updateDragPosition();
      //Check if we can resume the gesture with another cursor
      InputCursor[] availableCursors = getFreeComponentCursorsArray();
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

   * @see org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor#cursorStarted(org.mt4j.input.inputData.InputCursor, org.mt4j.input.inputData.MTFingerInputEvt)
   */
  @Override
  public void cursorStarted(InputCursor inputCursor,  MTFingerInputEvt positionEvent) {
    DragContext dc = new DragContext(inputCursor);
    IMTComponent3D comp = positionEvent.getTargetComponent();
    if (!dc.gestureAborted){
      motionToDragContext.put(inputCursor, dc);
      this.fireGestureEvent(new DragEvent(this, DragEvent.GESTURE_DETECTED, comp, inputCursor, dc.lastPosition, dc.newPosition));
    }
  }
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  /* (non-Javadoc)
   * @see org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor#cursorUpdated(org.mt4j.input.inputData.InputCursor, org.mt4j.input.inputData.MTFingerInputEvt)
   */
  @Override
  public void cursorUpdated(InputCursor inputCursor, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    DragContext dc = motionToDragContext.get(inputCursor);
    if (dc != null && dc.dragObject.getViewingCamera() != null){
      dc.updateDragPosition();
      this.fireGestureEvent(new DragEvent(this, MTGestureEvent.GESTURE_UPDATED, comp, inputCursor, dc.lastPosition, dc.newPosition));
    }
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  /* (non-Javadoc)
   * @see org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor#cursorEnded(org.mt4j.input.inputData.InputCursor, org.mt4j.input.inputData.MTFingerInputEvt)
   */
  @Override
  public void cursorEnded(InputCursor inputCursor, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    DragContext dc = motionToDragContext.get(inputCursor);
    if (dc != null){
      this.fireGestureEvent(new DragEvent(this, MTGestureEvent.GESTURE_ENDED, comp, inputCursor, dc.lastPosition, dc.newPosition));
      motionToDragContext.remove(inputCursor);
    }
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  /**
   * Pre.
   */
  public void pre(){
    if (lockedCursors.size() == 1){
      IMTComponent3D comp = lockedCursors.get(0).getTarget();
      InputCursor c = lockedCursors.get(0);
      long nowTime = System.currentTimeMillis();
      long elapsedTime = nowTime - this.tapStartTime;
      Vector3D screenPos = c.getPosition();
      float normalized = (float)elapsedTime / (float)this.holdTime;
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

   * @see org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor#cursorUpdated(org.mt4j.input.inputData.InputCursor, org.mt4j.input.inputData.AbstractCursorInputEvt)
   */
  @Override
  public void cursorUpdated(InputCursor c, MTFingerInputEvt positionEvent) {
    if (lockedCursors.contains(c)){ //cursor is a actual used cursor
      IMTComponent3D comp = lockedCursors.get(0).getTarget();
      long nowTime = System.currentTimeMillis();
      long elapsedTime = nowTime - this.tapStartTime;
      Vector3D screenPos = c.getPosition();
      float normalized = (float)elapsedTime / (float)this.holdTime;

View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  }

 
  @Override
  public void cursorStarted(InputCursor m, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    if (lockedMotions.size() >= 2){ //scale with 2 fingers already in progress
      unUsedMotions.add(m);
      logger.debug(this.getName() + " has already enough motions for this gesture - adding to unused ID:" + m.getId());
    }else{ //no scale in progress yet
      if (unUsedMotions.size() == 1){
        logger.debug(this.getName() + " has already has 1 unused motion - we can try start gesture! used with ID:" + unUsedMotions.get(0).getId() + " and new motion ID:" + m.getId());
        InputCursor otherMotion = unUsedMotions.get(0);
       
        //See if we can obtain a lock on both motions
        if (this.canLock(otherMotion, m)){
          float newDistance = Vector3D.distance(
              new Vector3D(otherMotion.getCurrentEvent().getPosX(), otherMotion.getCurrentEvent().getPosY(),0),
              new Vector3D(m.getCurrentEvent().getPosX(), m.getCurrentEvent().getPosY(),0));
          if (newDistance < zoomDetectRadius) {
            this.oldDistance = newDistance;
            this.getLock(otherMotion, m);
            lockedMotions.add(otherMotion);
            lockedMotions.add(m);
            unUsedMotions.remove(otherMotion);
            logger.debug(this.getName() + " we could lock both motions! And fingers in zoom distance!");
            this.fireGestureEvent(new ZoomEvent(this, MTGestureEvent.GESTURE_DETECTED, comp, m, otherMotion, 0f, comp.getViewingCamera() ));
          }else{
            logger.debug(this.getName() + " Motions not close enough to start gesture. Distance: " + newDistance);
          }
        }else{
          logger.debug(this.getName() + " we could NOT lock both motions!");
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

    }
  }

  @Override
  public void cursorUpdated(InputCursor m, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    if (lockedMotions.size() == 2 && lockedMotions.contains(m)){
      InputCursor firstMotion = lockedMotions.get(0);
      InputCursor secondMotion = lockedMotions.get(1);
      float fingerDistance = Vector3D.distance(
          new Vector3D(firstMotion.getCurrentEvent().getPosX(), firstMotion.getCurrentEvent().getPosY(), 0),
          new Vector3D(secondMotion.getCurrentEvent().getPosX(), secondMotion.getCurrentEvent().getPosY(), 0));
      float camZoomAmount = fingerDistance - oldDistance;
      oldDistance = fingerDistance;
      if (m.equals(firstMotion)){
        this.fireGestureEvent(new ZoomEvent(this, MTGestureEvent.GESTURE_UPDATED, comp, firstMotion, secondMotion, camZoomAmount, comp.getViewingCamera()));
      }else{
        this.fireGestureEvent(new ZoomEvent(this, MTGestureEvent.GESTURE_UPDATED, comp, firstMotion, secondMotion, camZoomAmount, comp.getViewingCamera()));
      }
    }
  }
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

    }
  }

  @Override
  public void cursorEnded(InputCursor m,  MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    logger.debug(this.getName() + " INPUT_ENDED RECIEVED - MOTION: " + m.getId());
   
    if (lockedMotions.size() == 2 && lockedMotions.contains(m)){
      InputCursor leftOverMotion = (lockedMotions.get(0).equals(m))? lockedMotions.get(1) : lockedMotions.get(0);
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.