Skip to content

Commit d13a9ce

Browse files
committed
bar: added Tracy.panelZIndex
1 parent db4f92e commit d13a9ce

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Tracy/assets/Bar/bar.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
return contentId;
1515
};
1616

17+
Tracy.panelZIndex = Tracy.panelZIndex || 20000;
18+
1719
var Panel = Tracy.DebugPanel = function(id) {
1820
this.id = id;
1921
this.elem = document.getElementById(this.id);
@@ -24,7 +26,7 @@
2426
Panel.FLOAT = 'tracy-mode-float';
2527
Panel.WINDOW = 'tracy-mode-window';
2628
Panel.FOCUSED = 'tracy-focused';
27-
Panel.zIndex = 20001;
29+
Panel.zIndexCounter = 1;
2830

2931
Panel.prototype.init = function() {
3032
var _this = this, elem = this.elem;
@@ -105,7 +107,7 @@
105107
clearTimeout(elem.Tracy.displayTimeout);
106108
elem.Tracy.displayTimeout = setTimeout(function() {
107109
elem.classList.add(Panel.FOCUSED);
108-
elem.style.zIndex = Panel.zIndex++;
110+
elem.style.zIndex = Tracy.panelZIndex + Panel.zIndexCounter++;
109111
if (callback) {
110112
callback();
111113
}
@@ -191,7 +193,7 @@
191193
if (this.is(Panel.WINDOW)) {
192194
localStorage.setItem(this.id, JSON.stringify({window: true}));
193195
} else if (pos.width) {
194-
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom, zIndex: this.elem.style.zIndex}));
196+
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom, zIndex: this.elem.style.zIndex - Tracy.panelZIndex}));
195197
} else {
196198
localStorage.removeItem(this.id);
197199
}
@@ -208,10 +210,8 @@
208210
this.init();
209211
this.toFloat();
210212
setPosition(this.elem, pos);
211-
if (pos.zIndex) {
212-
this.elem.style.zIndex = pos.zIndex;
213-
Panel.zIndex = Math.max(Panel.zIndex, pos.zIndex) + 1;
214-
}
213+
this.elem.style.zIndex = Tracy.panelZIndex + (pos.zIndex || 1);
214+
Panel.zIndexCounter = Math.max(Panel.zIndexCounter, (pos.zIndex || 1)) + 1;
215215
}
216216
};
217217

0 commit comments

Comments
 (0)