Skip to content

Commit

Permalink
force minimum inspector window size on window resize events
Browse files Browse the repository at this point in the history
  • Loading branch information
rpl committed Jul 17, 2015
1 parent 17b3ac1 commit 36060f8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions chrome/content/inspector-window.xul
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,29 @@
<script type="application/x-javascript">
window.gFindBar = document.getElementById("FindToolbar");
</script>

<script type="application/x-javascript">
<![CDATA[
const MIN_WIDTH=700, MIN_HEIGHT=600;
let resizeTaskID;
window.addEventListener("resize", (event) => {
let { outerWidth, outerHeight } = window;
let newWidth = outerWidth >= MIN_WIDTH ? outerWidth : MIN_WIDTH;
let newHeight = outerHeight >= MIN_HEIGHT ? outerHeight : MIN_HEIGHT;
if (outerWidth < MIN_WIDTH || outerHeight < MIN_HEIGHT) {
event.preventDefault();
if (resizeTaskID) {
clearTimeout(resizeTaskID);
}
resizeTaskID = setTimeout(() => window.resizeTo(newWidth, newHeight), 200);
return false;
}
}, false)
]]>
</script>

</vbox>
</window>

0 comments on commit 36060f8

Please sign in to comment.