Add a ready-made tool

From JReality Wiki
Jump to: navigation, search

Source file: AddToolExample

JavaDoc: ScaleTool

Run as Java webstart

The following example adds an existing tool to the content node of the scene. To be exact, it adds an instance of ScaleTool. What you need to know to use the tool is that it's activated by the right mouse. See what happens when you drag with the right mouse over the icosahedron.

The tool functions as follows: all movement of the mouse is considered relative to the center of the object (as determined by the bounding box). After the mouse is pressed, all motion away from this point scales up, and motion towards this point scales down.

  public static void main(String[] args) {
    SceneGraphComponent cmp = new SceneGraphComponent();
    Appearance ap = new Appearance();
    ScaleTool tool= new ScaleTool();

Previous: Developer Tutorial Developer Tutorial: Contents Next: Use the DragEventTool