Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion debug_toolbar/static/debug_toolbar/css/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@

#djDebug #djDebugToolbarHandle {
position: fixed;
transform: rotate(-90deg);
transform: translateY(-100%) rotate(-90deg);
transform-origin: right bottom;
background-color: #fff;
border: 1px solid #111;
Expand Down
23 changes: 13 additions & 10 deletions debug_toolbar/static/debug_toolbar/js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ const djdt = {
requestAnimationFrame(function () {
djdt.handleDragged = false;
});
djdt.ensure_handle_visibility();
}
});
const show =
Expand All @@ -210,23 +211,24 @@ const djdt = {
e.classList.remove("djdt-active");
});
},
ensure_handle_visibility() {
const handle = document.getElementById("djDebugToolbarHandle");
// set handle position
const handleTop = Math.min(
localStorage.getItem("djdt.top") || 0,
window.innerHeight - handle.offsetWidth
);
handle.style.top = handleTop + "px";
},
hide_toolbar() {
djdt.hide_panels();

$$.hide(document.getElementById("djDebugToolbar"));

const handle = document.getElementById("djDebugToolbarHandle");
$$.show(handle);
// set handle position
let handleTop = localStorage.getItem("djdt.top");
if (handleTop) {
handleTop = Math.min(
handleTop,
window.innerHeight - handle.offsetHeight
);
handle.style.top = handleTop + "px";
}

djdt.ensure_handle_visibility();
window.addEventListener("resize", djdt.ensure_handle_visibility);
document.removeEventListener("keydown", onKeyDown);

localStorage.setItem("djdt.show", "false");
Expand All @@ -249,6 +251,7 @@ const djdt = {
$$.hide(document.getElementById("djDebugToolbarHandle"));
$$.show(document.getElementById("djDebugToolbar"));
localStorage.setItem("djdt.show", "true");
window.removeEventListener("resize", djdt.ensure_handle_visibility);
},
cookie: {
get(key) {
Expand Down
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Change log
Next version
------------

* Ensured that the handle stays within bounds when resizing the window.


3.2.1 (2021-04-14)
------------------
Expand Down