Skip to content

Commit

Permalink
moved targetViewport object
Browse files Browse the repository at this point in the history
  • Loading branch information
mountler committed Sep 17, 2024
1 parent 33de293 commit c6491e5
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export default function H5PContent({
}) {
const h5pContainerRef = useRef<HTMLDivElement>(null);

const targetViewPort = {
height: window.innerHeight,
width: window.innerWidth,
ratio: window.innerWidth / window.innerHeight,
};

function h5pResizing() {
if (h5pContainerRef.current?.style.visibility) {
const h5pRef = h5pContainerRef.current;
const h5pRatio = h5pRef.clientWidth / h5pRef.clientHeight;

const targetViewPort = {
height: window.innerHeight,
width: window.innerWidth,
ratio: window.innerWidth / window.innerHeight,
};

if (h5pRatio < targetViewPort.ratio) {
h5pRef.style.width = targetViewPort.height * h5pRatio - 20 + "px";
h5pRef.style.height = targetViewPort.height + "px";
Expand Down

0 comments on commit c6491e5

Please sign in to comment.