Skip to content

Commit b6f69a9

Browse files
committed
Update 3.highlight-results-with-custom-style.html
1 parent 9dc8d73 commit b6f69a9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

4.use-case/3.highlight-results-with-custom-style.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787
const convertedP2 = scanner.convertToClientCoordinates(p2);
8888
mask = document.createElement("div");
8989
mask.style.position = "fixed";
90-
mask.style.left = convertedP1.x+"px";
91-
mask.style.top = convertedP1.y+"px";
92-
mask.style.width = convertedP2.x-convertedP1.x+"px";
93-
mask.style.height = convertedP2.y-convertedP1.y+"px";
90+
mask.style.left = Math.min(convertedP1.x, convertedP2.x)+"px";
91+
mask.style.top = Math.min(convertedP1.y, convertedP2.y)+"px";
92+
mask.style.width = Math.abs(convertedP2.x-convertedP1.x)+"px";
93+
mask.style.height = Math.abs(convertedP2.y-convertedP1.y)+"px";
9494
mask.style.border = "2px dashed red";
9595
document.body.append(mask);
9696
highlightResultMasks.push(mask);

0 commit comments

Comments
 (0)