@Override public int getBackBufferWidth () { return canvas.getWidth(); }
@Override public int getWidth () { return canvas.getWidth(); }
@Override public int getWidth () { return canvas.getWidth(); }
@Override public int getBackBufferWidth () { return canvas.getWidth(); }
protected int getRelativeX (Touch touch, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * touch.getRelativeX(target)); }
protected int getRelativeX (Touch touch, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * touch.getRelativeX(target)); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** * Gets the width of the internal canvas coordinate space. * * @return the width, in pixels * @see #setCoordinateSpaceWidth(int) */ public int getCoordinateSpaceWidth() { return getCanvasElement().getWidth(); }
@Override public int getBackBufferWidth () { return canvas.getWidth(); }
@Override public int getWidth () { return canvas.getWidth(); }
/** * Gets the width of the internal canvas coordinate space. * * @return the width, in pixels * @see #setCoordinateSpaceWidth(int) */ public int getCoordinateSpaceWidth() { return getCanvasElement().getWidth(); }
/** * Gets the width of the internal canvas coordinate space. * * @return the width, in pixels * @see #setCoordinateSpaceWidth(int) */ public int getCoordinateSpaceWidth() { return getCanvasElement().getWidth(); }
public HtmlImage (Graphics gfx, Scale scale, CanvasElement elem, String source) { super(gfx, scale, elem.getWidth(), elem.getHeight(), source, elem); this.canvas = elem; }
protected int getRelativeX ( final Touch touch, final CanvasElement target ) { final float xScaleRatio = ( target.getWidth() * 1f ) / target.getClientWidth(); // Correct // for // canvas // CSS // scaling return Math.round( xScaleRatio * touch.getRelativeX( target ) ); }
protected int getRelativeX (Touch touch, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * touch.getRelativeX(target)); }
@Override public void setWidth(int width) { this.width = width; if (getCanvas() != null && getCanvas().getWidth() != width) { getCanvas().setWidth(width); } } @Override
/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX ( final NativeEvent e, final CanvasElement target ) { final float xScaleRatio = ( target.getWidth() * 1f ) / target.getClientWidth(); // Correct // for // canvas // CSS // scaling return Math.round( xScaleRatio * ( ( e.getClientX() - target.getAbsoluteLeft() ) + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft() ) ); }
HtmlGLContext(HtmlPlatform platform, float scaleFactor, WebGLRenderingContext gl, CanvasElement canvas) { super(platform, new HtmlGL20(gl), scaleFactor, HtmlUrlParameters.checkGLErrors); this.glc = gl; // try basic GL operations to detect failure cases early tryBasicGLCalls(); setSize(MathUtil.iceil(canvas.getWidth() / scaleFactor), MathUtil.iceil(canvas.getHeight() / scaleFactor)); init(); glc.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, ONE); }