Skip to content

Commit

Permalink
iframe: fix x/y with viewport resize behavior (#1178)
Browse files Browse the repository at this point in the history
closes #1174
  • Loading branch information
GarboMuffin committed Dec 2, 2023
1 parent 2c2bb1d commit e4a7424
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions extensions/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@
iframe.style.height = `${(effectiveHeight / stageHeight) * 100}%`;

iframe.style.transform = "";
iframe.style.top = `${(0.5 - effectiveHeight / 2 / stageHeight) * 100}%`;
iframe.style.left = `${(0.5 - effectiveWidth / 2 / stageWidth) * 100}%`;
iframe.style.top = `${
(0.5 - effectiveHeight / 2 / stageHeight - y / stageHeight) * 100
}%`;
iframe.style.left = `${
(0.5 - effectiveWidth / 2 / stageWidth + x / stageWidth) * 100
}%`;
}
};

Expand Down

0 comments on commit e4a7424

Please sign in to comment.