Skip to content

Commit d3cb9a1

Browse files
committed
remove 'divInfVerticalOffset'
1 parent 4cbcca2 commit d3cb9a1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

4.use-case/3.show-result-texts-on-the-video.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
word-break: break-all;
2626
word-wrap: break-word;
2727
box-shadow: 5px 5px 5px 3px rgba(0,0,0,0.2);
28-
transform: translateX(-50%);
28+
transform: translate(-50%, -4px);
2929
}
3030
.bubble-box::after{
3131
content: '';
@@ -112,20 +112,19 @@
112112

113113
divInf = document.createElement("div");
114114
divInf.className = 'bubble-box';
115-
const divInfVerticalOffset = 4; //px
116115
const bodyStyle = getComputedStyle(document.body);
117116
if (bodyStyle.position === "static") {
118117
Object.assign(divInf.style, {
119118
left: `${(convertedP1.x + convertedP2.x) / 2}px`,
120-
bottom: `${document.documentElement.clientHeight - convertedP1.y + divInfVerticalOffset}px`,
119+
bottom: `${document.documentElement.clientHeight - convertedP1.y}px`,
121120
});
122121
} else { // if you set body `position` as `relative`, `absolute`, things can get complicated
123122
const bodyRect = document.body.getBoundingClientRect();
124123
const bodyBorderLeft = parseFloat(bodyStyle.borderLeftWidth);
125124
const bodyBorderBottom = parseFloat(bodyStyle.borderBottomWidth);
126125
Object.assign(divInf.style, {
127126
left: `${(convertedP1.x + convertedP2.x) / 2 - bodyRect.left - bodyBorderLeft}px`,
128-
bottom: `${bodyRect.bottom - convertedP1.y - bodyBorderBottom + divInfVerticalOffset}px`,
127+
bottom: `${bodyRect.bottom - convertedP1.y - bodyBorderBottom}px`,
129128
});
130129
}
131130
divInf.innerText = result.barcodeText;

0 commit comments

Comments
 (0)