protected int getRelativeY (Touch touch, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * touch.getRelativeY(target)); }
protected int getRelativeY (Touch touch, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * touch.getRelativeY(target)); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY (NativeEvent e, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY (NativeEvent e, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop())); }
protected int getRelativeY ( final Touch touch, final CanvasElement target ) { final float yScaleRatio = ( target.getHeight() * 1f ) / target.getClientHeight(); // Correct // for // canvas // CSS // scaling return Math.round( yScaleRatio * touch.getRelativeY( target ) ); }
protected int getRelativeY (Touch touch, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * touch.getRelativeY(target)); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY (NativeEvent e, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY ( final NativeEvent e, final CanvasElement target ) { final float yScaleRatio = ( target.getHeight() * 1f ) / target.getClientHeight(); // Correct // for // canvas // CSS // scaling return Math.round( yScaleRatio * ( ( e.getClientY() - target.getAbsoluteTop() ) + target.getScrollTop() + target.getOwnerDocument().getScrollTop() ) ); }