public class DragableArea
extends java.lang.Object
implements org.w3c.dom.events.EventListener
Modifier and Type | Class and Description |
---|---|
static interface |
DragableArea.DragListener
Listener interface for drag events.
|
Modifier and Type | Field and Description |
---|---|
protected org.w3c.dom.Element |
coordref
The coordinate system node.
|
protected org.w3c.dom.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,
org.w3c.dom.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,
org.w3c.dom.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,
org.w3c.dom.events.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,
org.w3c.dom.events.Event evt,
boolean inside)
Method called when a drag was ended.
|
protected org.w3c.dom.svg.SVGPoint |
getCoordinates(org.w3c.dom.events.Event evt)
Return the event coordinates for this event.
|
org.w3c.dom.Element |
getElement()
The DOM element.
|
void |
handleEvent(org.w3c.dom.events.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,
org.w3c.dom.events.Event evt)
Action to do on drag start.
|
protected final org.w3c.dom.Element element
protected final org.w3c.dom.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, org.w3c.dom.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, org.w3c.dom.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 org.w3c.dom.Element getElement()
public void enableStart()
public void disableStart()
protected void enableStop()
protected void disableStop()
public void handleEvent(org.w3c.dom.events.Event evt)
handleEvent
in interface org.w3c.dom.events.EventListener
protected org.w3c.dom.svg.SVGPoint getCoordinates(org.w3c.dom.events.Event evt)
evt
- Eventprotected boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.events.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, org.w3c.dom.events.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, org.w3c.dom.events.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 © 2019 ELKI Development Team. License information.