Skip to content

Commit bbb43b0

Browse files
committed
Cleanup.
1 parent ae88acf commit bbb43b0

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/ScreenCapture.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -346,20 +346,10 @@ const deepClone = (host) => {
346346
tagName == "IMG" ||
347347
tagName == "SVG"
348348
) {
349-
var height = 0;
350-
if (node.style.boxSizing === "border-box") {
351-
height =
352-
node.height +
353-
node.marginTop +
354-
node.marginBottom +
355-
node.bordorTop +
356-
node.borderBottom;
357-
} else {
358-
height = node.height;
359-
}
360-
349+
const boundingRect = node.getBoundingClientRect();
361350
clone.setAttribute("bb-element", true);
362-
clone.setAttribute("bb-height", height);
351+
clone.setAttribute("bb-height", boundingRect.height);
352+
clone.setAttribute("bb-width", boundingRect.width);
363353
}
364354

365355
if (tagName == "DIV" && (node.scrollTop > 0 || node.scrollLeft > 0)) {
@@ -463,7 +453,7 @@ const prepareScreenshotData = (remote) => {
463453
const bbElems = clone.querySelectorAll("[bb-element=true]");
464454
for (var i = 0; i < bbElems.length; ++i) {
465455
if (bbElems[i]) {
466-
bbElems[i].style.height = bbElems[i].getAttribute("bb-height");
456+
bbElems[i].style.height = bbElems[i].getAttribute("bb-height") + "px";
467457
}
468458
}
469459

src/ScreenDrawer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class ScreenDrawer {
55
strPath;
66
strokeWidth = 12;
77
strokeWidthRect = 6;
8-
bufferSize = 8;
8+
bufferSize = 4;
99
buffer = [];
1010
startPoint = null;
1111
tool = "pen";

0 commit comments

Comments
 (0)