Skip to content

Commit

Permalink
1.9.39
Browse files Browse the repository at this point in the history
  • Loading branch information
quinton-ashley committed Jun 6, 2024
1 parent cee750b commit cf0be7d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "q5",
"version": "1.9.38",
"version": "1.9.39",
"description": "The sequel to p5.js!",
"author": "quinton-ashley",
"contributors": [
Expand Down
4 changes: 2 additions & 2 deletions src/q5-2d-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Q5.modules.q2d_canvas = ($) => {
function parentResized() {
if ($.frameCount > 1) {
$._shouldResize = true;
if ($._applyDisplayMode) $._applyDisplayMode();
if ($._displayMode) $._displayMode();
}
}
if (typeof ResizeObserver == 'function') {
Expand Down Expand Up @@ -127,7 +127,7 @@ Q5.modules.q2d_canvas = ($) => {
$.height = h;
} else $.flexibleCanvas($._dau);

if (frameCount != 0 && $._applyDisplayMode) $._applyDisplayMode();
if (frameCount != 0 && $._displayMode) $._displayMode();
}

$.resizeCanvas = (w, h) => {
Expand Down
2 changes: 1 addition & 1 deletion src/q5-core.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* q5.js
* @version 2.0-beta3
* @version 2.0-beta4
* @author quinton-ashley, Tezumie, and LingDong-
* @license LGPL-3.0
*/
Expand Down
18 changes: 9 additions & 9 deletions src/q5-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ main {
);
}

$._applyDisplayMode = () => {
$._displayMode = () => {
let s = c.style;
if (!s) return;
if (!s || !c.displayMode) return;
let p = c.parentElement;
if (c.renderQuality == 'pixelated') {
c.classList.add('q5-pixelated');
$.pixelDensity(1);
if ($.noSmooth) $.noSmooth();
if ($.textFont) $.textFont('monospace');
}
if (c.mode == 'normal') {
if (c.displayMode == 'normal') {
p.classList.remove('q5-centered', 'q5-fullscreen');
s.width = c.w * c.displayScale + 'px';
s.height = c.h * c.displayScale + 'px';
} else {
p.classList.add('q5-' + c.mode);
p.classList.add('q5-' + c.displayMode);
p = p.getBoundingClientRect();
if (c.w / c.h > p.width / p.height) {
if (c.mode == 'centered') {
if (c.displayMode == 'centered') {
s.width = c.w * c.displayScale + 'px';
s.maxWidth = '100%';
} else s.width = '100%';
Expand All @@ -67,19 +67,19 @@ main {
} else {
s.width = 'auto';
s.maxWidth = '';
if (c.mode == 'centered') {
if (c.displayMode == 'centered') {
s.height = c.h * c.displayScale + 'px';
s.maxHeight = '100%';
} else s.height = '100%';
}
}
};

$.displayMode = (mode, renderQuality = 'default', displayScale = 1) => {
$.displayMode = (displayMode, renderQuality = 'default', displayScale = 1) => {
if (typeof displayScale == 'string') {
displayScale = parseFloat(displayScale.slice(1));
}
Object.assign(c, { mode, renderQuality, displayScale });
$._applyDisplayMode();
Object.assign(c, { displayMode, renderQuality, displayScale });
$._displayMode();
};
};

0 comments on commit cf0be7d

Please sign in to comment.