How can I center the screen and display it to fit the current screen size?
danhk0612 opened this issue · comments
I use code below.
const screenSize = {
"w": Math.max(document.documentElement.clientWidth, window.innerWidth || 0),
"h": Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
};
let initalZoom = (screenSize.w / elemWid < screenSize.h / elemHei) ? screenSize.w / elemWid : screenSize.h / elemHei;
panzoomObj.zoomAbs(0, 0, initalZoom);
panzoomObj.moveTo((screenSize.w - elemWid * initalZoom) / 2, (screenSize.h - elemHei * initalZoom) / 2);
It works well.
but I want to know Is there a way to make this code more efficient, or is there an internal method?
I found this:
Line 39 in 87eac07