Skip to content

Commit 14b6aae

Browse files
Styling
1 parent d0b301f commit 14b6aae

File tree

6 files changed

+33
-30
lines changed

6 files changed

+33
-30
lines changed

Public/css/balloon.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
font-size: 70%;
33
white-space: nowrap;
44
border-radius: 5px;
5-
background-color: #555;
5+
background-color: rgba(85, 85, 85, 0.9);
66
color: #fff;
77
padding: 2px 8px;
88
position: absolute;
@@ -13,9 +13,9 @@
1313
content: "";
1414
position: absolute;
1515
top: 34px;
16-
left: calc(50% - 9px);
16+
left: calc(24% - 9px);
1717
border: 9px solid transparent;
18-
border-top: 9px solid #555;
18+
border-top: 9px solid rgba(85, 85, 85, 0.9);
1919
}
2020

2121
.balloon-content .title {

Public/css/tree_view.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,28 @@
55

66
.tree-view ul {
77
margin: 0;
8-
padding-left: 20px;
8+
padding-left: 0;
99
}
1010

1111
.tree-view li.entry {
1212
position: relative;
1313
list-style: none;
1414
margin: 0;
15-
padding: 5px 5px 0 5px;
15+
padding: 5px 5px 0 25px;
1616
cursor: pointer;
1717
}
1818

19+
.tree-view li.entry div {
20+
display: inline-block;
21+
}
22+
1923
.tree-view li.entry.hover {
2024
background-color: rgb(100, 149, 237, 0.25);
2125
}
2226

2327
.tree-view li .caret {
2428
position: absolute;
25-
left: -20px;
29+
left: 0;
2630
color: #a9a9a9;
2731
}
2832

Public/js/lookup_view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class LoopupView {
8484
popover.content = dl;
8585

8686
popover.show(element, {
87-
lowerLimit: tabContainerRect.top + tabContainerRect.height,
87+
containerRect: tabContainerRect,
8888
offsetX: 40,
8989
});
9090
});

Public/js/popover.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,18 @@ export class Popover {
4747
}
4848

4949
show(target, options = {}) {
50-
const lowerLimit = options.lowerLimit;
50+
const containerRect = options.containerRect;
5151
const offsetX = options.offsetX || 0;
5252

5353
this.popover.classList.remove("d-none");
5454

5555
const targetRect = target.getBoundingClientRect();
5656
const popoverRect = this.popover.getBoundingClientRect();
5757

58+
const bottom = containerRect.top + containerRect.height;
5859
const top = targetRect.top - 6;
59-
if (top + popoverRect.height > lowerLimit) {
60-
this.popover.style.top = `${lowerLimit - popoverRect.height}px`;
60+
if (top + popoverRect.height > bottom) {
61+
this.popover.style.top = `${bottom - popoverRect.height}px`;
6162
} else {
6263
this.popover.style.top = `${top}px`;
6364
}

Public/js/structure_view.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ export class StructureView {
4343
.querySelector(".tab-content")
4444
.getBoundingClientRect();
4545

46-
const parent = target.parentElement;
47-
const caret = parent.querySelector(":scope > div > .caret");
48-
this.popover.show(caret || target, {
49-
lowerLimit: tabContainerRect.top + tabContainerRect.height,
50-
offsetX: caret ? 0 : 24,
46+
this.popover.show(target, {
47+
containerRect: tabContainerRect,
48+
offsetX: 24,
5149
});
5250
};
5351

Public/js/tree_view.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,41 @@ export class TreeView {
4545
const li = document.createElement("li");
4646
li.classList.add("entry");
4747

48-
const element = document.createElement("div");
48+
const content = document.createElement("div");
4949

5050
if (this.hasChildren(node.id)) {
5151
const caret = downCaret.cloneNode(true);
52-
element.appendChild(caret);
52+
content.appendChild(caret);
5353

5454
const div = document.createElement("div");
55-
div.classList = `${node.type}-syntax`;
55+
div.classList.add(`${node.type}-syntax`);
5656
div.innerHTML = node.text;
57-
element.appendChild(div);
58-
li.appendChild(element);
57+
content.appendChild(div);
58+
li.appendChild(content);
5959

6060
const children = this.getChildren(node.id);
6161
for (const child of children) {
6262
li.appendChild(this.renderNode(child));
6363
}
6464

65-
element.addEventListener("click", (event) => {
65+
content.addEventListener("click", (event) => {
6666
event.preventDefault();
6767
event.stopPropagation();
6868

69-
if (element.classList.contains("collapsed")) {
70-
this.expand(node, element, li);
69+
if (content.classList.contains("collapsed")) {
70+
this.expand(node, content, li);
7171
} else {
72-
this.collapse(node, element, li);
72+
this.collapse(node, content, li);
7373
}
7474
});
7575
} else {
76-
element.classList.add("token");
76+
content.classList.add("token");
7777
if (node.text.length === 0) {
78-
element.innerHTML = `<span class="badge">Empty</span>`;
78+
content.innerHTML = `<span class="badge">Empty</span>`;
7979
} else {
80-
element.innerHTML = node.text;
80+
content.innerHTML = node.text;
8181
}
82-
li.appendChild(element);
82+
li.appendChild(content);
8383
}
8484

8585
li.addEventListener(
@@ -88,7 +88,7 @@ export class TreeView {
8888
event.stopPropagation();
8989

9090
li.classList.add("hover");
91-
this.onmouseover(event, element, node);
91+
this.onmouseover(event, content, node);
9292
},
9393
{ capture: false, once: false, passive: false }
9494
);
@@ -98,7 +98,7 @@ export class TreeView {
9898
event.stopPropagation();
9999

100100
li.classList.remove("hover");
101-
this.onmouseout(event, element, node);
101+
this.onmouseout(event, content, node);
102102
},
103103
{ capture: false, once: false, passive: false }
104104
);

0 commit comments

Comments
 (0)