forked from Github/frigate
calculate aspect ratio of container to prevent overflow (#11495)
This commit is contained in:
@@ -98,8 +98,11 @@ export default function MasksAndZones({
|
|||||||
}, [config, selectedCamera]);
|
}, [config, selectedCamera]);
|
||||||
|
|
||||||
const stretch = true;
|
const stretch = true;
|
||||||
// may need tweaking for mobile
|
|
||||||
const fitAspect = isDesktop ? 16 / 9 : 3 / 4;
|
const fitAspect = useMemo(
|
||||||
|
() => (isDesktop ? containerWidth / containerHeight : 3 / 4),
|
||||||
|
[containerWidth, containerHeight],
|
||||||
|
);
|
||||||
|
|
||||||
const scaledHeight = useMemo(() => {
|
const scaledHeight = useMemo(() => {
|
||||||
if (containerRef.current && aspectRatio && detectHeight) {
|
if (containerRef.current && aspectRatio && detectHeight) {
|
||||||
|
|||||||
Reference in New Issue
Block a user