limit max scale to 1

This commit is contained in:
Yanzhen Yu
2020-11-15 14:42:23 +08:00
parent 9434db4a6b
commit 79a8198c03
2 changed files with 17 additions and 14 deletions

View File

@@ -55,7 +55,8 @@
const widthScale = width / frameDimension.width;
const heightScale = height / frameDimension.height;
el.style.transform =
`scale(${Math.min(widthScale, heightScale)})` + 'translate(-50%, -50%)';
`scale(${Math.min(widthScale, heightScale, 1)})` +
'translate(-50%, -50%)';
};
export const triggerResize = () => {