}
@Override
public void handleEvent(Event evt) {
if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEDOWN)) {
SVGPoint dragPoint = getCoordinates(evt);
if(startDrag(dragPoint, evt)) {
// LoggingUtil.warning("Starting drag: "+dragPoint);
startDragPoint = dragPoint;
enableStop();
}
}
else if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEMOVE)) {
if(startDragPoint != null) {
SVGPoint dragPoint = getCoordinates(evt);
if(!duringDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
// cancel the drag operation
startDragPoint = null;
disableStop();
}
}
}
else if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEUP)) {
if(startDragPoint != null) {
SVGPoint dragPoint = getCoordinates(evt);
if(endDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
// LoggingUtil.warning("Drag completed: "+dragPoint);
startDragPoint = null;
disableStop();
}
}
}
else if(evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEOUT)) {
// When leaving the document with the mouse!
if(startDragPoint != null && evt.getTarget() == evt.getCurrentTarget()) {
// LoggingUtil.warning("Mouseout: "+evt.getTarget().toString());
SVGPoint dragPoint = getCoordinates(evt);
if(endDrag(startDragPoint, dragPoint, evt, false)) {
// LoggingUtil.warning("Drag completed: "+dragPoint);
startDragPoint = null;
disableStop();
}