Skip to content
Snippets Groups Projects
Commit 2687b29d authored by Tomas Kulhanek's avatar Tomas Kulhanek
Browse files

FIX molstar/molstar#147 offsetWidth/offsetHeight is correct size of element...

FIX molstar/molstar#147 offsetWidth/offsetHeight is correct size of element when css transform:scale is used
parent 92649878
No related branches found
No related tags found
No related merge requests found
......@@ -12,13 +12,13 @@ export function setCanvasSize(canvas: HTMLCanvasElement, width: number, height:
}
/** Resize canvas to container element taking `devicePixelRatio` into account */
export function resizeCanvas (canvas: HTMLCanvasElement, container: Element, scale = 1) {
export function resizeCanvas (canvas: HTMLCanvasElement, container: HTMLElement, scale = 1) {
let width = window.innerWidth;
let height = window.innerHeight;
if (container !== document.body) {
let bounds = container.getBoundingClientRect();
width = bounds.right - bounds.left;
height = bounds.bottom - bounds.top;
// fixes issue #molstar/molstar#147, offsetWidth/offsetHeight is correct size when css transform:scale is used
width = container.offsetWidth;
height = container.offsetHeight;
}
setCanvasSize(canvas, width, height, scale);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment