Skip to content

Commit 7943c0b

Browse files
author
Lauren McCarthy
committed
adding pixel scaling toggle issue #452
1 parent 48a1490 commit 7943c0b

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

lib/p5.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,14 @@ var environment = function (require, core, constants) {
21052105
}
21062106
}
21072107
};
2108+
p5.prototype.devicePixelScaling = function (val) {
2109+
if (val) {
2110+
this._pixelDensity = window.devicePixelRatio || 1;
2111+
} else {
2112+
this._pixelDensity = 1;
2113+
}
2114+
this.resizeCanvas(this.width, this.height);
2115+
};
21082116
function launchFullscreen(element) {
21092117
var enabled = document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled;
21102118
if (!enabled) {

0 commit comments

Comments
 (0)