/** * Gets the mouse x-position relative to the canvas element. * @param clientX The event's clientX value. * @return the relative x-position */ private double getRelativeX(final double clientX) { return clientX - getCanvasElement().getAbsoluteLeft() + getCanvasElement().getScrollLeft() + getCanvasElement().getOwnerDocument().getScrollLeft(); }
/** * Gets the mouse y-position relative to the canvas element. * @param clientY The event's clienty value. * @return the relative y-position */ private double getRelativeY(final double clientY) { return clientY - getCanvasElement().getAbsoluteTop() + getCanvasElement().getScrollTop() + getCanvasElement().getOwnerDocument().getScrollTop(); }