Skip to content

Commit 1cb5bd2

Browse files
committed
force minimum inspector window size on window resize events
1 parent a169c1f commit 1cb5bd2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

chrome/content/inspector-window.xul

+24
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,29 @@
4444
<script type="application/x-javascript">
4545
window.gFindBar = document.getElementById("FindToolbar");
4646
</script>
47+
48+
<script type="application/x-javascript">
49+
<![CDATA[
50+
const MIN_WIDTH=700, MIN_HEIGHT=600;
51+
let resizeTaskID;
52+
53+
window.addEventListener("resize", (event) => {
54+
let { outerWidth, outerHeight } = window;
55+
56+
let newWidth = outerWidth >= MIN_WIDTH ? outerWidth : MIN_WIDTH;
57+
let newHeight = outerHeight >= MIN_HEIGHT ? outerHeight : MIN_HEIGHT;
58+
59+
if (outerWidth < MIN_WIDTH || outerHeight < MIN_HEIGHT) {
60+
event.preventDefault();
61+
if (resizeTaskID) {
62+
clearTimeout(resizeTaskID);
63+
}
64+
resizeTaskID = setTimeout(() => window.resizeTo(newWidth, newHeight), 200);
65+
return false;
66+
}
67+
}, false)
68+
]]>
69+
</script>
70+
4771
</vbox>
4872
</window>

0 commit comments

Comments
 (0)