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';