fix positioning of movie layers on large screens

Oops, movie canvases were drawing larger than the images, if there was more than 600px of space available! fixed!
This commit is contained in:
Emi Matchu 2020-10-10 04:32:53 -07:00
parent 394e8178c4
commit 7102772f63

View file

@ -128,9 +128,17 @@ export function OutfitLayers({
React.useLayoutEffect(() => { React.useLayoutEffect(() => {
function computeAndSaveCanvasSize() { function computeAndSaveCanvasSize() {
setCanvasSize( setCanvasSize(
// Follow an algorithm similar to the <img> sizing: a square that
// covers the available space, without exceeding the natural image size
// (which is 600px).
//
// TODO: Once we're entirely off PNGs, we could drop the 600
// requirement, and let SVGs and movies scale up as far as they
// want...
Math.min( Math.min(
containerRef.current.offsetWidth, containerRef.current.offsetWidth,
containerRef.current.offsetHeight containerRef.current.offsetHeight,
600
) )
); );
} }