final boolean fireDrag = (dc > 0);
if(mouseIsDown) {
if(!dragging) {
dragging = true;
//Log.debug("onMouseMove() - drag start..");
if(fireDrag) fireEvent(new DragEvent(DragMode.START, dragOffsetX, dragOffsetY));
}
final int x = event.getClientX(), y = event.getClientY();
int nx = x - dragOffsetX;
int ny = y - dragOffsetY;
// keep the drag handle within the viewable area!
if(nx < 0) nx = 0;
if(ny < 0) ny = 0;
//Log.debug("onMouseMove() - x:" + x + ",y:" + y + " | nx:" + nx + ",ny:" + ny);
final int bx = fireDrag ? getAbsoluteLeft() : 0;
final int by = fireDrag ? getAbsoluteTop() : 0;
final Style es = getElement().getStyle();
es.setPropertyPx("left", nx);
es.setPropertyPx("top", ny);
if(fireDrag) {
//Log.debug("onMouseMove() deltaX:" + (nx - bx) + ",deltaY:" + (ny - by));
fireEvent(new DragEvent(DragMode.DRAGGING, nx - bx, ny - by));
}
}
}