
public class DragableArea extends Object implements EventListener
| Modifier and Type | Class and Description | 
|---|---|
| static interface  | DragableArea.DragListenerListener interface for drag events. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected Element | coordrefThe coordinate system node. | 
| protected Element | elementOur element node. | 
| protected DragableArea.DragListener | listenerA listener to notify on drags (when not subclassing). | 
| protected org.w3c.dom.svg.SVGPoint | startDragPointThe point where the drag started. | 
| protected SVGPlot | svgpThe plot we are attached to. | 
| Constructor and Description | 
|---|
| DragableArea(SVGPlot plot,
            double x,
            double y,
            double w,
            double h)Constructor for a dragable area. use getElement() to get the DOM node. | 
| DragableArea(SVGPlot plot,
            double x,
            double y,
            double w,
            double h,
            DragableArea.DragListener listener)Constructor for a dragable area. use getElement() to get the DOM node. | 
| DragableArea(SVGPlot plot,
            Element coordref,
            double x,
            double y,
            double w,
            double h)Constructor for a dragable area. use getElement() to get the DOM node. | 
| DragableArea(SVGPlot plot,
            Element coordref,
            double x,
            double y,
            double w,
            double h,
            DragableArea.DragListener listener)Constructor for a dragable area. use getElement() to get the DOM node. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | destroy()Remove the listeners | 
| void | disableStart()Disable capturing of 'mousedown' events. | 
| protected void | disableStop()Disable capturing of 'mousemove' and 'mouseup' events. | 
| protected boolean | duringDrag(org.w3c.dom.svg.SVGPoint startPoint,
          org.w3c.dom.svg.SVGPoint dragPoint,
          Event evt,
          boolean inside)Method called during drags. | 
| void | enableStart()Enable capturing of 'mousedown' events. | 
| protected void | enableStop()Enable capturing of 'mousemove' and 'mouseup' events. | 
| protected boolean | endDrag(org.w3c.dom.svg.SVGPoint startPoint,
       org.w3c.dom.svg.SVGPoint dragPoint,
       Event evt,
       boolean inside)Method called when a drag was ended. | 
| protected org.w3c.dom.svg.SVGPoint | getCoordinates(Event evt)Return the event coordinates for this event. | 
| Element | getElement()The DOM element. | 
| void | handleEvent(Event evt) | 
| void | makeInvisible()Make the rectangle invisible. | 
| void | makeVisible()Make the rectangle visible, for debug purposes. | 
| protected boolean | startDrag(org.w3c.dom.svg.SVGPoint startPoint,
         Event evt)Action to do on drag start. | 
protected final Element element
protected final Element coordref
protected final SVGPlot svgp
protected org.w3c.dom.svg.SVGPoint startDragPoint
protected DragableArea.DragListener listener
public DragableArea(SVGPlot plot, double x, double y, double w, double h)
plot - Plot we'll be added tox - X positiony - Y positionw - Widthh - Heightpublic DragableArea(SVGPlot plot, Element coordref, double x, double y, double w, double h)
plot - Plot we'll be added tocoordref - Element defining the coordinate systemx - X positiony - Y positionw - Widthh - Heightpublic DragableArea(SVGPlot plot, double x, double y, double w, double h, DragableArea.DragListener listener)
plot - Plot we'll be added tox - X positiony - Y positionw - Widthh - Heightlistener - Drag listenerpublic DragableArea(SVGPlot plot, Element coordref, double x, double y, double w, double h, DragableArea.DragListener listener)
plot - Plot we'll be added tocoordref - Element defining the coordinate systemx - X positiony - Y positionw - Widthh - Heightlistener - Drag listenerpublic void destroy()
public Element getElement()
public void enableStart()
public void disableStart()
protected void enableStop()
protected void disableStop()
public void handleEvent(Event evt)
handleEvent in interface EventListenerprotected org.w3c.dom.svg.SVGPoint getCoordinates(Event evt)
evt - Eventprotected boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint, Event evt)
startPoint - Point where the drag was started.evt - The event objecttrue to start the drag operationprotected boolean duringDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, Event evt, boolean inside)
startPoint - Drag starting pointdragPoint - Drag end pointevt - The event objectinside - Inside the tracked elementtrue to continue the dragprotected boolean endDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, Event evt, boolean inside)
startPoint - Drag starting pointdragPoint - Drag end pointevt - The event objectinside - Success flagtrue to complete the dragpublic void makeInvisible()
public void makeVisible()