Skip to content

Commit

Permalink
bar: support for debug bar at top of screen AJAX fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 3, 2018
1 parent ead5141 commit 0ae69e1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Tracy/assets/Bar/bar.js
Expand Up @@ -282,8 +282,8 @@
setPosition(panel.elem, {
right: pos.right - getOffset(link).left + pos.width - getPosition(link).width - 4 + getOffset(panel.elem).left,
bottom: _this.isAtTop()
? getPosition(elem).bottom - pos.height - 4
: pos.bottom - getOffset(elem).top + pos.height + 4 + getOffset(panel.elem).top
? getPosition(_this.elem).bottom - pos.height - 4
: pos.bottom - getOffset(_this.elem).top + pos.height + 4 + getOffset(panel.elem).top
});
}
});
Expand Down Expand Up @@ -313,14 +313,15 @@
};

Bar.prototype.savePosition = function() {
var pos = getPosition(document.getElementById(this.id));
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom}));
var pos = getPosition(this.elem),
atTop = this.isAtTop();
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom + (atTop ? pos.height : 0), atTop: atTop}));
};

Bar.prototype.restorePosition = function() {
var pos = JSON.parse(localStorage.getItem(this.id));
if (pos) {
setPosition(document.getElementById(this.id), pos);
setPosition(this.elem, {right: pos.right, bottom: pos.bottom - (pos.atTop ? getPosition(this.elem).height : 0)});
}
};

Expand Down Expand Up @@ -375,7 +376,11 @@
Debug.layer.insertAdjacentHTML('beforeend', content);
evalScripts(Debug.layer);
ajaxBar = document.getElementById('tracy-ajax-bar');
document.getElementById(Bar.prototype.id).appendChild(ajaxBar);
var pos = getPosition(Debug.bar.elem);
Debug.bar.elem.appendChild(ajaxBar);
if (Debug.bar.isAtTop()) {
setPosition(Debug.bar.elem, {right: pos.right, bottom: pos.bottom + pos.height - getPosition(Debug.bar.elem).height});
}

forEach(document.querySelectorAll('.tracy-panel'), function(panel) {
if (!Debug.panels[panel.id]) {
Expand Down

0 comments on commit 0ae69e1

Please sign in to comment.