public class DragableArea extends Object implements EventListener
Modifier and Type | Class and Description |
---|---|
static interface |
DragableArea.DragListener
Listener interface for drag events.
|
Modifier and Type | Field and Description |
---|---|
protected Element |
coordref
The coordinate system node.
|
protected Element |
element
Our element node.
|
protected DragableArea.DragListener |
listener
A listener to notify on drags (when not subclassing).
|
protected org.w3c.dom.svg.SVGPoint |
startDragPoint
The point where the drag started.
|
protected SVGPlot |
svgp
The 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 EventListener
protected 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()
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.