We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 47f642a commit 39c6997Copy full SHA for 39c6997
src/image/loading_displaying.js
@@ -216,8 +216,16 @@ p5.prototype.image =
216
_sw = _sAssign(_sw, defW);
217
_sh = _sAssign(_sh, defH);
218
219
+
220
+ // This part needs cleanup and unit tests
221
+ // see issues https://github.com/processing/p5.js/issues/1741
222
+ // and https://github.com/processing/p5.js/issues/1673
223
var pd = 1;
- if (img.elt && img.elt.width && img.elt.style.width) {
224
225
+ if (img.elt && img.elt.videoWidth && img.elt.style.width && !img.canvas) {
226
+ pd = img.elt.videoWidth / parseInt(img.elt.style.width, 10);
227
+ }
228
+ else if (img.elt && img.elt.width && img.elt.style.width) {
229
pd = img.elt.width / parseInt(img.elt.style.width, 10);
230
}
231
0 commit comments