Make maximum scale configurable (#1006)

This commit is contained in:
Justin Halsall
2022-09-26 18:10:19 +02:00
committed by GitHub
parent 3924aafd61
commit 6f63cf1584
2 changed files with 15 additions and 11 deletions

View File

@@ -14,6 +14,7 @@
export let width = 1024;
export let height = 576;
export let maxScale = 1;
export let events: eventWithTime[] = [];
export let skipInactive = true;
export let autoPlay = true;
@@ -55,8 +56,10 @@
) => {
const widthScale = width / frameDimension.width;
const heightScale = height / frameDimension.height;
const scale = [widthScale, heightScale];
if (maxScale) scale.push(maxScale);
el.style.transform =
`scale(${Math.min(widthScale, heightScale, 1)})` +
`scale(${Math.min(...scale)})` +
'translate(-50%, -50%)';
};