From e4a7424c2fe94bc767998a26379ca9e486a663fd Mon Sep 17 00:00:00 2001 From: GarboMuffin Date: Sat, 2 Dec 2023 16:20:35 -0600 Subject: [PATCH] iframe: fix x/y with viewport resize behavior (#1178) closes https://github.com/TurboWarp/extensions/issues/1174 --- extensions/iframe.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/iframe.js b/extensions/iframe.js index ce87728a2c..0c312d571e 100644 --- a/extensions/iframe.js +++ b/extensions/iframe.js @@ -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 + }%`; } };