Package org.mt4j.input.gestureAction

Examples of org.mt4j.input.gestureAction.InertiaDragAction


        //so the rotation of the planets doesent get changed by the gestures
    MTComponent group = new MTComponent(mtApplication);
    group.setComposite(true); //This makes the group "consume" all picking and gestures of the children
    group.registerInputProcessor(new DragProcessor(mtApplication));
    group.addGestureListener(DragProcessor.class, new DefaultDragAction());
    group.addGestureListener(DragProcessor.class, new InertiaDragAction(80, 0.8f, 10));
    group.registerInputProcessor(new RotateProcessor(mtApplication));
    group.addGestureListener(RotateProcessor.class, new DefaultRotateAction());
    //Scale the earth from the center. Else it might get distorted
    group.registerInputProcessor(new ScaleProcessor(mtApplication));
    group.addGestureListener(ScaleProcessor.class, new IGestureEventListener() {
View Full Code Here


  public MTComplexPolyClusterable getPolygon(PApplet app, TileSide top, TileSide right, TileSide bottom, TileSide left, float tileWidth, float tileHeight){
    this.init(tileWidth, tileHeight);
    Vertex[] v = getTile(top, right, bottom, left);
    MTComplexPolyClusterable poly = new MTComplexPolyClusterable(app, v);
    poly.removeAllGestureEventListeners(ScaleProcessor.class);
    poly.addGestureListener(DragProcessor.class, new InertiaDragAction());
    return poly;
  }
View Full Code Here

            }
           
            final MTSceneWindow sceneWindow = new MTSceneWindow(scene, 100,50, app);
            sceneWindow.setFillColor(new MTColor(50,50,50,200));
            sceneWindow.scaleGlobal(0.5f, 0.5f, 0.5f, sceneWindow.getCenterPointGlobal());
            sceneWindow.addGestureListener(DragProcessor.class, new InertiaDragAction());
            getCanvas().addChild(sceneWindow);
          }else{
            //No FBO available -> change to the new scene fullscreen directly
           
            float menuWidth = 64;
View Full Code Here

                            MTImage card = fotos[i];
                            card.setUseDirectGL(true);
                            card.setDisplayCloseButton(true);
                            card.setPositionGlobal(new Vector3D(ToolsMath.getRandom(10, MT4jSettings.getInstance().getWindowWidth()-100), ToolsMath.getRandom(10, MT4jSettings.getInstance().getWindowHeight()-50),0 )  );
                            card.scale(0.6f, 0.6f, 0.6f, card.getCenterPointLocal(), TransformSpace.LOCAL);
                            card.addGestureListener(DragProcessor.class, new InertiaDragAction());
                            lassoProcessor.addClusterable(card); //make fotos lasso-able
                            pictureLayer.addChild(card);
                          }
                          progressBar.setVisible(false);
                        }
View Full Code Here

          //will be executed the next time the mt4j thread runs.
          instance.invokeLater(new Runnable() {
            public void run() {
              MTRectangle r = new MTRectangle(0,0,ToolsMath.getRandom(50, 250),ToolsMath.getRandom(50, 250), instance);
              r.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
              r.addGestureListener(DragProcessor.class, new InertiaDragAction());
              instance.getCurrentScene().getCanvas().addChild(r);
              r.setPositionGlobal(new Vector3D(ToolsMath.getRandom(0, instance.width), ToolsMath.getRandom(0, instance.height)));
            }
          });
         
        }
      }
    });
        menu.add(addRectItem);
       
        JMenuItem addRoundRectItem = new JMenuItem("MTRoundRectangle", KeyEvent.VK_E);
        addRoundRectItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        if (instance.getCurrentScene() != null){
          //If we want to modify the MT4j applet from the swing thread
          //we should wrap the actions into an invokeLater runnable which
          //will be executed the next time the mt4j thread runs.
          instance.invokeLater(new Runnable() {
            public void run() {
              float arc = ToolsMath.getRandom(8, 25);
              MTRoundRectangle r = new MTRoundRectangle(0,0,0, ToolsMath.getRandom(50, 250),ToolsMath.getRandom(50, 250), arc, arc, instance);
              r.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
              r.addGestureListener(DragProcessor.class, new InertiaDragAction());
              instance.getCurrentScene().getCanvas().addChild(r);
              r.setPositionGlobal(new Vector3D(ToolsMath.getRandom(0, instance.width), ToolsMath.getRandom(0, instance.height)));
            }
          });
         
        }
      }
    });
        menu.add(addRoundRectItem);
       
        JMenuItem addEllItem = new JMenuItem("MTEllipse", KeyEvent.VK_E);
        addEllItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        if (instance.getCurrentScene() != null){
          //If we want to modify the MT4j applet from the swing thread
          //we should wrap the actions into an invokeLater runnable which
          //will be executed the next time the mt4j thread runs.
          instance.invokeLater(new Runnable() {
            public void run() {
              MTEllipse e = new MTEllipse(instance, new Vector3D(0,0), ToolsMath.getRandom(50, 150),ToolsMath.getRandom(50, 150));
              e.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
              e.addGestureListener(DragProcessor.class, new InertiaDragAction());
              instance.getCurrentScene().getCanvas().addChild(e);
              e.setPositionGlobal(new Vector3D(ToolsMath.getRandom(0, instance.width), ToolsMath.getRandom(0, instance.height)));
            }
          });
         
View Full Code Here

    registerGlobalInputProcessor(c);
    int count = 2;
    for (int i = 0; i < count; i++) {
      MTRectangle r = new MTRectangle(0,0,ToolsMath.getRandom(50, 250),ToolsMath.getRandom(50, 250),mtApplication);
      r.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
      r.addGestureListener(DragProcessor.class, new InertiaDragAction());
      getCanvas().addChild(r);
      r.setPositionGlobal(new Vector3D(ToolsMath.getRandom(0, mtApplication.width), ToolsMath.getRandom(0, mtApplication.height)));
    }
  }
View Full Code Here

    dragOnly.setStrokeColor(textAreaColor);
    dragOnly.setText("Drag me!");
    this.clearAllGestures(dragOnly);
    dragOnly.registerInputProcessor(new DragProcessor(app));
    dragOnly.addGestureListener(DragProcessor.class, new DefaultDragAction());
    dragOnly.addGestureListener(DragProcessor.class, new InertiaDragAction()); //Add inertia to dragging
    this.getCanvas().addChild(dragOnly);
   
    MTTextArea rotateOnly = new MTTextArea(mtApplication, font);
    rotateOnly.setFillColor(textAreaColor);
    rotateOnly.setStrokeColor(textAreaColor);
View Full Code Here

 
 
  @Override
  protected void setDefaultGestureActions() {
    super.setDefaultGestureActions();
    this.addGestureListener(DragProcessor.class, new InertiaDragAction());
  }
View Full Code Here

TOP

Related Classes of org.mt4j.input.gestureAction.InertiaDragAction

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.