We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9dc8d73 commit b6f69a9Copy full SHA for b6f69a9
1 file changed
4.use-case/3.highlight-results-with-custom-style.html
@@ -87,10 +87,10 @@
87
const convertedP2 = scanner.convertToClientCoordinates(p2);
88
mask = document.createElement("div");
89
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";
+ mask.style.left = Math.min(convertedP1.x, convertedP2.x)+"px";
+ mask.style.top = Math.min(convertedP1.y, convertedP2.y)+"px";
+ mask.style.width = Math.abs(convertedP2.x-convertedP1.x)+"px";
+ mask.style.height = Math.abs(convertedP2.y-convertedP1.y)+"px";
94
mask.style.border = "2px dashed red";
95
document.body.append(mask);
96
highlightResultMasks.push(mask);
0 commit comments