From 982b7afdc4ee433191a653e7a731c8180994c6a6 Mon Sep 17 00:00:00 2001 From: airslice Date: Thu, 19 Sep 2024 17:15:52 +0800 Subject: [PATCH] fix: remove scroll bar size --- .../Crust/Plugins/PluginFrame/SafeIFrame/hooks.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/SafeIFrame/hooks.ts b/web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/SafeIFrame/hooks.ts index 91175f62fe..a1850add7c 100644 --- a/web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/SafeIFrame/hooks.ts +++ b/web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/SafeIFrame/hooks.ts @@ -153,10 +153,8 @@ export default function useHook({ const st = win.getComputedStyle(html, ""); horizontalMargin = parseInt(st.getPropertyValue("margin-left"), 10) + parseInt(st.getPropertyValue("margin-right"), 10); verticalMargin = parseInt(st.getPropertyValue("margin-top"), 10) + parseInt(st.getPropertyValue("margin-bottom"), 10); - const horizontalScrollbarHeight = window.innerHeight - document.documentElement.clientHeight; - const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth; - const width = html.offsetWidth + horizontalMargin + verticalScrollbarWidth; - const height = html.offsetHeight + verticalMargin + horizontalScrollbarHeight; + const width = html.offsetWidth + horizontalMargin; + const height = html.offsetHeight + verticalMargin; if(parent){ parent.postMessage({ [${JSON.stringify(autoResizeMessageKey)}]: { width, height }