From 69cbcf2a2e8eac56f313da1f9aab95341c7fb984 Mon Sep 17 00:00:00 2001 From: Weijie Sun <41133182+swjcpy@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:30:43 -0500 Subject: [PATCH] Scale devtools threshold for large screens --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 196d467..fc29136 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ const devtools = { orientation: undefined, }; -const threshold = 170; +const baseThreshold = 170; const emitEvent = (isOpen, orientation) => { globalThis.dispatchEvent(new globalThis.CustomEvent('devtoolschange', { @@ -22,6 +22,11 @@ const emitEvent = (isOpen, orientation) => { }; const main = ({emitEvents = true} = {}) => { + const threshold = Math.max( + baseThreshold, + globalThis.outerWidth * 0.1, + globalThis.outerHeight * 0.1, + ); const widthThreshold = globalThis.outerWidth - globalThis.innerWidth > threshold; const heightThreshold = globalThis.outerHeight - globalThis.innerHeight > threshold; const orientation = widthThreshold ? 'vertical' : 'horizontal';