Skip to content

Commit f711e31

Browse files
authored
Merge pull request #5747 from msed21/main
Fix issue #5702
2 parents 9cffb21 + 94b83c7 commit f711e31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dom/dom.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,8 @@ p5.Element.prototype.style = function(prop, val) {
19931993
) {
19941994
let styles = window.getComputedStyle(self.elt);
19951995
let styleVal = styles.getPropertyValue(prop);
1996-
let numVal = styleVal.replace(/\D+/g, '');
1997-
this[prop] = parseInt(numVal, 10);
1996+
let numVal = styleVal.replace(/[^\d.]/g, '');
1997+
this[prop] = Math.round(parseFloat(numVal, 10));
19981998
}
19991999
}
20002000
return this;

0 commit comments

Comments
 (0)