q5 1.8.3 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/q5.js +7 -5
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "author": "quinton-ashley",
3
3
  "name": "q5",
4
- "version": "1.8.3",
4
+ "version": "1.8.4",
5
5
  "description": "An implementation of the p5.js 2D API that's smaller and faster",
6
6
  "main": "q5.js",
7
7
  "scripts": {
8
8
  "min": "minify q5.js > q5.min.js",
9
- "dist": "bun min && cp q5.min.js ../../web/p5play-web/v3/q5.min.js",
9
+ "dist": "cp q5.js ../../web/p5play-web/v3/q5.js && bun min && cp q5.min.js ../../web/p5play-web/v3/q5.min.js",
10
10
  "v": "npm version patch --force",
11
11
  "V": "npm version minor --force",
12
12
  "version": "git add -A",
package/q5.js CHANGED
@@ -9,7 +9,12 @@
9
9
  * @type {Q5}
10
10
  */
11
11
  function Q5(scope, parent) {
12
- if (typeof scope == 'undefined') scope = 'global';
12
+ let preloadCnt = 0;
13
+ if (typeof scope == 'undefined') {
14
+ scope = 'global';
15
+ preloadCnt++;
16
+ setTimeout(() => preloadCnt--, 32);
17
+ }
13
18
  if (scope == 'auto') {
14
19
  if (typeof window.setup == 'undefined') return;
15
20
  else scope = 'global';
@@ -639,7 +644,6 @@ function Q5(scope, parent) {
639
644
  let looper = null;
640
645
  let firstVertex = true;
641
646
  let curveBuff = [];
642
- let preloadCnt = 0;
643
647
  let keysHeld = {};
644
648
  let millisStart = 0;
645
649
  let tmpCtx = null;
@@ -2391,9 +2395,7 @@ function Q5(scope, parent) {
2391
2395
  $._preloadFn();
2392
2396
  millisStart = performance.now();
2393
2397
  function _start() {
2394
- if (preloadCnt > 0) {
2395
- return requestAnimationFrame(_start);
2396
- }
2398
+ if (preloadCnt > 0) return requestAnimationFrame(_start);
2397
2399
  ctx.save();
2398
2400
  $._setupFn();
2399
2401
  $._setupDone = true;