Skip to content

Commit 4e1aa16

Browse files
author
Cube
authored
Merge pull request #129 from Dynamsoft/Keillion-patch-3
Update 3.show-result-texts-on-the-video.html
2 parents fb90de1 + a907a8c commit 4e1aa16

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
.bubble-box{
2020
max-width: 20rem; /* You are likely to change it */
2121
position: absolute;
22+
right: -999px;
2223
background: white;
2324
border-radius: 4px;
2425
padding: 4px;
2526
word-break: break-all;
2627
word-wrap: break-word;
2728
box-shadow: 5px 5px 5px 3px rgba(0,0,0,0.2);
28-
transform: translate(-50%, -4px);
29+
transform: translate(-50%, calc(-100% - 4px));
2930
}
3031
.bubble-box::after{
3132
content: '';
@@ -116,15 +117,15 @@
116117
if (bodyStyle.position === "static") {
117118
Object.assign(divInf.style, {
118119
left: `${(convertedP1.x + convertedP2.x) / 2}px`,
119-
bottom: `${document.documentElement.clientHeight - convertedP1.y}px`,
120+
top: `${convertedP1.y}px`,
120121
});
121122
} else { // if you set body `position` as `relative`, `absolute`, things can get complicated
122123
const bodyRect = document.body.getBoundingClientRect();
123124
const bodyBorderLeft = parseFloat(bodyStyle.borderLeftWidth);
124-
const bodyBorderBottom = parseFloat(bodyStyle.borderBottomWidth);
125+
const bodyBorderTop = parseFloat(bodyStyle.borderTopWidth);
125126
Object.assign(divInf.style, {
126-
left: `${(convertedP1.x + convertedP2.x) / 2 - bodyRect.left - bodyBorderLeft}px`,
127-
bottom: `${bodyRect.bottom - convertedP1.y - bodyBorderBottom}px`,
127+
left: `${(convertedP1.x + convertedP2.x) / 2 - (bodyRect.left + document.documentElement.scrollLeft) - bodyBorderLeft}px`,
128+
top: `${convertedP1.y - (bodyRect.top + document.documentElement.scrollTop) - bodyBorderTop}px`,
128129
});
129130
}
130131
divInf.innerText = result.barcodeText;

0 commit comments

Comments
 (0)