Skip to content

Commit

Permalink
bar: added Tracy.panelZIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 25, 2018
1 parent db4f92e commit d13a9ce
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Tracy/assets/Bar/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
return contentId;
};

Tracy.panelZIndex = Tracy.panelZIndex || 20000;

var Panel = Tracy.DebugPanel = function(id) {
this.id = id;
this.elem = document.getElementById(this.id);
Expand All @@ -24,7 +26,7 @@
Panel.FLOAT = 'tracy-mode-float';
Panel.WINDOW = 'tracy-mode-window';
Panel.FOCUSED = 'tracy-focused';
Panel.zIndex = 20001;
Panel.zIndexCounter = 1;

Panel.prototype.init = function() {
var _this = this, elem = this.elem;
Expand Down Expand Up @@ -105,7 +107,7 @@
clearTimeout(elem.Tracy.displayTimeout);
elem.Tracy.displayTimeout = setTimeout(function() {
elem.classList.add(Panel.FOCUSED);
elem.style.zIndex = Panel.zIndex++;
elem.style.zIndex = Tracy.panelZIndex + Panel.zIndexCounter++;
if (callback) {
callback();
}
Expand Down Expand Up @@ -191,7 +193,7 @@
if (this.is(Panel.WINDOW)) {
localStorage.setItem(this.id, JSON.stringify({window: true}));
} else if (pos.width) {
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom, zIndex: this.elem.style.zIndex}));
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom, zIndex: this.elem.style.zIndex - Tracy.panelZIndex}));
} else {
localStorage.removeItem(this.id);
}
Expand All @@ -208,10 +210,8 @@
this.init();
this.toFloat();
setPosition(this.elem, pos);
if (pos.zIndex) {
this.elem.style.zIndex = pos.zIndex;
Panel.zIndex = Math.max(Panel.zIndex, pos.zIndex) + 1;
}
this.elem.style.zIndex = Tracy.panelZIndex + (pos.zIndex || 1);
Panel.zIndexCounter = Math.max(Panel.zIndexCounter, (pos.zIndex || 1)) + 1;
}
};

Expand Down

0 comments on commit d13a9ce

Please sign in to comment.