com.threerings.stage.tools.editor
Class PortalTool

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by javax.swing.event.MouseInputAdapter
          extended by com.threerings.stage.tools.editor.PortalTool
All Implemented Interfaces:
ExtrasPainter, MouseListener, MouseMotionListener, MouseWheelListener, EventListener, MouseInputListener

public class PortalTool
extends MouseInputAdapter
implements ExtrasPainter

A tool for setting a portal.


Field Summary
protected  Point _center
          Center coordinates.
protected  EditorScenePanel _panel
          The panel.
protected  EditablePortal _portal
          Our newly created portal.
protected  StageScene _scene
          The scene.
 
Constructor Summary
PortalTool()
           
 
Method Summary
protected  void calculateOrientation(int x, int y)
          Updates the orientation of the portal based on the current mouse position and potentially repaints.
protected  void dispose()
          Get rid of ourselves.
 void init(EditorScenePanel panel, int centerx, int centery)
           
 void mouseDragged(MouseEvent event)
          When the mouse is dragged we update the current portal.
 void mouseReleased(MouseEvent event)
          If button1 is released, we store the new portal, if button3: we cancel.
 void paintExtras(Graphics2D gfx)
          Paint what the clusters would look like if we were to add them to the scene.
protected  boolean portalNameExists(String name)
          See if the portal name already exists.
protected  void savePortal()
          Adds our portal to the scene.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed
 
Methods inherited from interface java.awt.event.MouseMotionListener
mouseMoved
 

Field Detail

_panel

protected EditorScenePanel _panel
The panel.


_scene

protected StageScene _scene
The scene.


_center

protected Point _center
Center coordinates.


_portal

protected EditablePortal _portal
Our newly created portal.

Constructor Detail

PortalTool

public PortalTool()
Method Detail

init

public void init(EditorScenePanel panel,
                 int centerx,
                 int centery)

mouseDragged

public void mouseDragged(MouseEvent event)
When the mouse is dragged we update the current portal.

Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class MouseAdapter

mouseReleased

public void mouseReleased(MouseEvent event)
If button1 is released, we store the new portal, if button3: we cancel.

Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class MouseAdapter

paintExtras

public void paintExtras(Graphics2D gfx)
Paint what the clusters would look like if we were to add them to the scene.

Specified by:
paintExtras in interface ExtrasPainter

calculateOrientation

protected void calculateOrientation(int x,
                                    int y)
Updates the orientation of the portal based on the current mouse position and potentially repaints.


savePortal

protected void savePortal()
Adds our portal to the scene.


portalNameExists

protected boolean portalNameExists(String name)
See if the portal name already exists.


dispose

protected void dispose()
Get rid of ourselves.