Skip to content

Commit 2a7e1c6

Browse files
committed
Tracy core updates for panel zIndex issues, and module updates to go with new approach to setting the panel base zIndex.
1 parent 42f7e23 commit 2a7e1c6

File tree

9 files changed

+26
-51
lines changed

9 files changed

+26
-51
lines changed

TracyDebugger.module

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
3232
'summary' => __('Tracy debugger from Nette with several PW specific custom tools.', __FILE__),
3333
'author' => 'Adrian Jones',
3434
'href' => 'https://processwire.com/talk/topic/12208-tracy-debugger/',
35-
'version' => '4.9.21',
35+
'version' => '4.9.22',
3636
'autoload' => true,
3737
'singular' => true,
3838
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
@@ -871,31 +871,17 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
871871
}
872872
modifyTracyLogo();
873873

874-
875874
function bsZIndex() {
876875
if(!document.getElementById("tracy-bs")) {
877876
window.requestAnimationFrame(bsZIndex);
878877
} else {
879878
if(document.getElementById("tracy-bs"))
880-
document.getElementById("tracy-bs").style.zIndex = z = '.$this->data['panelZindex'].';
879+
document.getElementById("tracy-bs").style.zIndex = ' . $this->data['panelZindex'] .';
881880
}
882881
}
883882
bsZIndex();
884883

885-
function panelsZIndex() {
886-
if(!document.getElementById("tracy-debug-bar")) {
887-
window.requestAnimationFrame(panelsZIndex);
888-
} else {
889-
window.Tracy.DebugPanel.zIndex = z = '.$this->data['panelZindex'].';
890-
var panels = document.getElementsByClassName("tracy-panel");
891-
if(panels.length > 0) {
892-
for (var i = 0; i < panels.length; i++) {
893-
panels[i].style.zIndex = z++;
894-
}
895-
}
896-
}
897-
}
898-
panelsZIndex();
884+
window.Tracy.panelZIndex = ' . ($this->data['panelZindex'] + 1) . ';
899885
';
900886

901887
if($this->data['hideDebugBar'] && $this->showServerTypeIndicator() && $this->data['styleAdminType'] == 'custom' && !$this->wire('input')->cookie->tracyShow) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
$this = 2;

tracy-master/examples/fatal-error.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,8 @@
1515

1616
<?php
1717

18-
19-
function first($arg1, $arg2)
20-
{
21-
second(true, false);
22-
}
23-
24-
25-
function second($arg1, $arg2)
26-
{
27-
third([1, 2, 3]);
28-
}
29-
30-
31-
function third($arg1)
32-
{
33-
echo html_special_chars($arg1); // this function doesn't exist
34-
}
35-
36-
3718
if (Debugger::$productionMode) {
3819
echo '<p><b>For security reasons, Tracy is visible only on localhost. Look into the source code to see how to enable Tracy.</b></p>';
3920
}
4021

41-
first(10, 'any string');
22+
require __DIR__ . '/assets/E_COMPILE_ERROR.php';

tracy-master/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The Debugger Bar is a floating panel. It is displayed in the bottom right corner
6868

6969
You can add other useful panels into the Debugger Bar. You can find interesing ones in [Addons](https://addons.nette.org) or you can create your own.
7070

71-
Implementation of custom bar is easy, just implement interface `Tracy\IBarPanel` with two methods `getTab` and `getContent`, both returning content to be displayed.
71+
Implementation of custom panel is easy, just implement interface `Tracy\IBarPanel` with two methods `getTab` and `getPanel`, both returning HTML content to be displayed.
7272
Afterward, registering via `Debugger::getBar()->addPanel(new CustomPanel());` is everything you will need to do.
7373

7474

tracy-master/src/Tracy/Debugger.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace Tracy;
99

1010
use ErrorException;
11-
use Tracy;
1211

1312

1413
/**

tracy-master/src/Tracy/Dumper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace Tracy;
99

10-
use Tracy;
11-
1210

1311
/**
1412
* Dumps a variable.

tracy-master/src/Tracy/FireLogger.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace Tracy;
99

10-
use Tracy;
11-
1210

1311
/**
1412
* FireLogger console logger.

tracy-master/src/Tracy/assets/Bar/bar.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ body#tracy-debug { /* in popup window */
205205
background: white;
206206
color: #333;
207207
text-align: left;
208-
z-index: 20001;
209208
}
210209

211210
body#tracy-debug .tracy-panel { /* in popup window */
@@ -360,4 +359,4 @@ body#tracy-debug .tracy-panel { /* in popup window */
360359
#tracy-debug * {
361360
display: none;
362361
}
363-
}
362+
}

tracy-master/src/Tracy/assets/Bar/bar.js

Lines changed: 17 additions & 6 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 = 20000;
29+
Panel.zIndexCounter = 1;
2830

2931
Panel.prototype.init = function() {
3032
var _this = this, elem = this.elem;
@@ -39,15 +41,22 @@
3941
handles: elem.querySelectorAll('h1'),
4042
start: function() {
4143
_this.toFloat();
44+
_this.focus();
4245
}
4346
});
4447

45-
elem.addEventListener('mouseover', function(e) {
48+
elem.addEventListener('mousedown', function(e) {
4649
if (isTargetChanged(e.relatedTarget, this)) {
4750
_this.focus();
4851
}
4952
});
5053

54+
elem.addEventListener('mouseover', function(e) {
55+
if (isTargetChanged(e.relatedTarget, this)) {
56+
clearTimeout(elem.Tracy.displayTimeout);
57+
}
58+
});
59+
5160
elem.addEventListener('mouseout', function(e) {
5261
if (isTargetChanged(e.relatedTarget, this)) {
5362
_this.blur();
@@ -74,7 +83,7 @@
7483
clearTimeout(elem.Tracy.displayTimeout);
7584
if (this.rel === 'close') {
7685
_this.toPeek();
77-
} else if (this.rel === 'window') {
86+
} else {
7887
_this.toWindow();
7988
}
8089
e.preventDefault();
@@ -98,7 +107,7 @@
98107
clearTimeout(elem.Tracy.displayTimeout);
99108
elem.Tracy.displayTimeout = setTimeout(function() {
100109
elem.classList.add(Panel.FOCUSED);
101-
elem.style.zIndex = Panel.zIndex++;
110+
elem.style.zIndex = Tracy.panelZIndex + Panel.zIndexCounter++;
102111
if (callback) {
103112
callback();
104113
}
@@ -184,7 +193,7 @@
184193
if (this.is(Panel.WINDOW)) {
185194
localStorage.setItem(this.id, JSON.stringify({window: true}));
186195
} else if (pos.width) {
187-
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom}));
196+
localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom, zIndex: this.elem.style.zIndex - Tracy.panelZIndex}));
188197
} else {
189198
localStorage.removeItem(this.id);
190199
}
@@ -201,6 +210,8 @@
201210
this.init();
202211
this.toFloat();
203212
setPosition(this.elem, pos);
213+
this.elem.style.zIndex = Tracy.panelZIndex + (pos.zIndex || 1);
214+
Panel.zIndexCounter = Math.max(Panel.zIndexCounter, (pos.zIndex || 1)) + 1;
204215
}
205216
};
206217

@@ -588,4 +599,4 @@
588599
Array.prototype.forEach.call(arr, cb);
589600
}
590601

591-
})();
602+
})();

0 commit comments

Comments
 (0)