//---------------------------------------------------------------------------------------------
@Override
public void moveTo(PointQuery pointQuery) {
// Since moving takes time, only do it if we're not already at the desired point.
Point2D sourcePoint = retrieveMouseLocation();
Point2D targetPoint = pointQuery.query();
if (!isPointAtMouseLocation(targetPoint)) {
moveMouseStepwiseBetween(sourcePoint, targetPoint);
}
// If the target has moved while we were moving the mouse, update to the new position.
Point2D finalPoint = pointQuery.query();
moveMouseDirectlyTo(finalPoint);
}