Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const devtools = {
orientation: undefined,
};

const threshold = 170;
const baseThreshold = 170;

const emitEvent = (isOpen, orientation) => {
globalThis.dispatchEvent(new globalThis.CustomEvent('devtoolschange', {
Expand All @@ -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';
Expand Down