Skip to content

Commit 3bce60a

Browse files
authored
Merge pull request #218 from Malvoz/debug-mode-css
Update debug mode styles
2 parents bb93648 + e2e75db commit 3bce60a

File tree

3 files changed

+74
-53
lines changed

3 files changed

+74
-53
lines changed

src/mapml.css

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@
7474
border-style: inherit;
7575
}
7676

77+
.mapml-contextmenu,
78+
.mapml-debug,
7779
.leaflet-bar,
7880
.leaflet-control-layers,
79-
.mapml-contextmenu,
81+
.leaflet-popup-content-wrapper,
82+
.leaflet-tooltip-pane .leaflet-tooltip,
8083
.leaflet-touch .leaflet-control-layers,
8184
.leaflet-touch .leaflet-bar {
8285
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgb(0, 0, 0, 0.3);
@@ -224,6 +227,45 @@
224227
margin: 5px 0;
225228
}
226229

230+
/*
231+
* Debug mode.
232+
*/
233+
234+
.mapml-debug {
235+
contain: content;
236+
max-height: 100%;
237+
max-width: 100%;
238+
border-radius: 4px;
239+
padding: 10px;
240+
background-color: #fff;
241+
cursor: default;
242+
}
243+
244+
.mapml-debug-banner {
245+
margin-left: 4px;
246+
font-weight: bold;
247+
text-transform: uppercase;
248+
}
249+
250+
.mapml-debug-panel,
251+
.mapml-debug-grid {
252+
font-family: monospace;
253+
}
254+
255+
.mapml-debug-panel {
256+
margin-top: 4px;
257+
}
258+
259+
.mapml-debug-tile {
260+
text-indent: 6px;
261+
line-height: 1.8;
262+
}
263+
264+
.mapml-debug-coordinates {
265+
padding-left: 4px;
266+
padding-right: 4px;
267+
}
268+
227269
/*
228270
* User interaction.
229271
*/
@@ -236,7 +278,8 @@
236278

237279
/* Disable text selection in controls. */
238280
.leaflet-control,
239-
.mapml-contextmenu {
281+
.mapml-contextmenu,
282+
.mapml-debug {
240283
-webkit-user-select: none;
241284
-moz-user-select: none;
242285
-ms-user-select: none;
@@ -303,27 +346,3 @@ summary {
303346
.leaflet-container .leaflet-control-container {
304347
visibility: unset!important;
305348
}
306-
.mapml-debug-panel {
307-
max-height: 100%;
308-
max-width: 100%;
309-
box-shadow: 0 1px 7px rgba(0,0,0,0.4);
310-
-webkit-border-radius: 4px;
311-
border-radius: 4px;
312-
padding: 4px 0;
313-
background-color: #fff;
314-
cursor: default;
315-
-webkit-user-select: none;
316-
-moz-user-select: none;
317-
-ms-user-select: none;
318-
user-select: none;
319-
}
320-
321-
.mapml-debug-coordinates{
322-
padding-left: 4px;
323-
padding-right: 4px;
324-
}
325-
326-
.mapml-debug-title{
327-
padding-left: 4px;
328-
padding-right: 4px;
329-
}

src/mapml/handlers/ContextMenu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export var ContextMenu = L.Handler.extend({
104104
this._keyboardEvent = false;
105105

106106
this._container = L.DomUtil.create("div", "mapml-contextmenu", map._container);
107-
this._container.style.zIndex = 10000;
107+
this._container.style.zIndex = 10001;
108108
this._container.style.position = "absolute";
109109

110110
this._container.style.width = "150px";
@@ -114,7 +114,7 @@ export var ContextMenu = L.Handler.extend({
114114
}
115115

116116
this._coordMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-submenu", this._container);
117-
this._coordMenu.style.zIndex = 10000;
117+
this._coordMenu.style.zIndex = 10001;
118118
this._coordMenu.style.position = "absolute";
119119

120120
this._coordMenu.style.width = "80px";
@@ -130,7 +130,7 @@ export var ContextMenu = L.Handler.extend({
130130
this._items[7].el = this._createItem(this._container, this._items[7]);
131131

132132
this._layerMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-layer-menu", map._container);
133-
this._layerMenu.style.zIndex = 10000;
133+
this._layerMenu.style.zIndex = 10001;
134134
this._layerMenu.style.position = "absolute";
135135
this._layerMenu.style.width = "150px";
136136
for (let i = 0; i < this._layerItems.length; i++) {

src/mapml/layers/DebugLayer.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
export var DebugOverlay = L.Layer.extend({
22

33
onAdd: function (map) {
4-
this._container = L.DomUtil.create("div", "mapml-debug", map._container);
5-
6-
//adds a control panel
7-
/* this._controlPanel = L.DomUtil.create("div", "mapml-debug-control mapml-debug-panel", this._container);
8-
let toggleGridBtn = document.createElement('button'), gridBtnText = document.createTextNode("Toggle Grid");
9-
toggleGridBtn.appendChild(gridBtnText);
10-
toggleGridBtn.overlay = this;
11-
L.DomEvent.on(toggleGridBtn, 'click',this._toggleGrid);
12-
this._controlPanel.appendChild(toggleGridBtn); */
4+
5+
let mapSize = map.getSize();
6+
7+
//conditionally show container for debug panel/banner only when the map has enough space for it
8+
if (mapSize.x > 400 || mapSize.y > 300) {
9+
this._container = L.DomUtil.create("div", "mapml-debug", map._container);
10+
11+
//adds a control panel
12+
/* this._controlPanel = L.DomUtil.create("div", "mapml-debug-control mapml-debug-panel", this._container);
13+
let toggleGridBtn = document.createElement('button'), gridBtnText = document.createTextNode("Toggle Grid");
14+
toggleGridBtn.appendChild(gridBtnText);
15+
toggleGridBtn.overlay = this;
16+
L.DomEvent.on(toggleGridBtn, 'click',this._toggleGrid);
17+
this._controlPanel.appendChild(toggleGridBtn); */
18+
19+
this._container.style.width = 150;
20+
this._container.style.zIndex = 10000;
21+
this._container.style.position = "absolute";
22+
this._container.style.top = "auto";
23+
this._container.style.bottom = "10px";
24+
this._container.style.left = "10px";
25+
this._container.style.right = "auto";
26+
}
1327

1428
this._grid = debugGrid({
1529
className: "mapml-debug-grid",
@@ -56,17 +70,13 @@ export var DebugPanel = L.Layer.extend({
5670

5771
//conditionally show debug panel only when the map has enough space for it
5872
if (mapSize.x > 400 || mapSize.y > 300) {
73+
this._title = L.DomUtil.create("div", "mapml-debug-banner", this.options.pane);
74+
this._title.innerHTML = "Debug mode";
75+
5976
map.debug = {};
6077
map.debug._infoContainer = this._debugContainer = L.DomUtil.create("div", "mapml-debug-panel", this.options.pane);
6178

6279
let infoContainer = map.debug._infoContainer;
63-
infoContainer.style.zIndex = 10000;
64-
infoContainer.style.width = 150;
65-
infoContainer.style.position = "absolute";
66-
infoContainer.style.top = "auto";
67-
infoContainer.style.bottom = "4px";
68-
infoContainer.style.right = "auto";
69-
infoContainer.style.left = "4px";
7080

7181
map.debug._tileCoord = L.DomUtil.create("div", "mapml-debug-coordinates", infoContainer);
7282
map.debug._tileMatrixCoord = L.DomUtil.create("div", "mapml-debug-coordinates", infoContainer);
@@ -78,14 +88,6 @@ export var DebugPanel = L.Layer.extend({
7888
this._map.on("mousemove", this._updateCoords);
7989
}
8090

81-
this._title = L.DomUtil.create("div", "mapml-debug-banner", this.options.pane);
82-
this._title.innerHTML = "DEBUG MODE";
83-
this._title.style.zIndex = 10000;
84-
this._title.style.position = "absolute";
85-
this._title.style.top = "4px";
86-
this._title.style.bottom = "auto";
87-
this._title.style.left = "auto";
88-
this._title.style.right = "4px";
8991
},
9092
onRemove: function () {
9193
L.DomUtil.remove(this._title);

0 commit comments

Comments
 (0)