Skip to content

Commit

Permalink
fixes #1741
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren McCarthy committed Jan 3, 2017
1 parent 47f642a commit 39c6997
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/image/loading_displaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,16 @@ p5.prototype.image =
_sw = _sAssign(_sw, defW);
_sh = _sAssign(_sh, defH);


// This part needs cleanup and unit tests
// see issues https://github.com/processing/p5.js/issues/1741
// and https://github.com/processing/p5.js/issues/1673
var pd = 1;
if (img.elt && img.elt.width && img.elt.style.width) {

if (img.elt && img.elt.videoWidth && img.elt.style.width && !img.canvas) {
pd = img.elt.videoWidth / parseInt(img.elt.style.width, 10);
}
else if (img.elt && img.elt.width && img.elt.style.width) {
pd = img.elt.width / parseInt(img.elt.style.width, 10);
}

Expand Down

0 comments on commit 39c6997

Please sign in to comment.