q5 1.0.25 → 1.0.26

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 +1 -1
  2. package/q5.js +13 -7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "quinton-ashley",
3
3
  "name": "q5",
4
- "version": "1.0.25",
4
+ "version": "1.0.26",
5
5
  "description": "An implementation of the p5.js 2D API that's smaller and faster",
6
6
  "main": "q5.js",
7
7
  "scripts": {
package/q5.js CHANGED
@@ -836,6 +836,8 @@ function Q5(scope, parent) {
836
836
  ctx.fillStyle = col;
837
837
  };
838
838
  $.noFill = () => ($._doFill = false);
839
+ $.smooth = () => ($._smooth = true);
840
+ $.noSmooth = () => ($._smooth = false);
839
841
  $.blendMode = (x) => (ctx.globalCompositeOperation = x);
840
842
  $.strokeCap = (x) => (ctx.lineCap = x);
841
843
  $.strokeJoin = (x) => (ctx.lineJoin = x);
@@ -2219,10 +2221,10 @@ function Q5(scope, parent) {
2219
2221
  };
2220
2222
  }
2221
2223
  function isTouchUnaware() {
2222
- return $._touchStarted.isPlaceHolder && $._touchMoved.isPlaceHolder && $._touchEnded.isPlaceHolder;
2224
+ return $._touchStartedFn.isPlaceHolder && $._touchMovedFn.isPlaceHolder && $._touchEndedFn.isPlaceHolder;
2223
2225
  }
2224
- $.canvas.ontouchstart = (e) => {
2225
- $.touches = e.touches.map(getTouchInfo);
2226
+ $._ontouchstart = (e) => {
2227
+ $.touches = [...e.touches].map(getTouchInfo);
2226
2228
  if (isTouchUnaware()) {
2227
2229
  $.pmouseX = $.mouseX;
2228
2230
  $.pmouseY = $.mouseY;
@@ -2238,8 +2240,8 @@ function Q5(scope, parent) {
2238
2240
  e.preventDefault();
2239
2241
  }
2240
2242
  };
2241
- $.canvas.ontouchmove = (e) => {
2242
- $.touches = e.touches.map(getTouchInfo);
2243
+ $._ontouchmove = (e) => {
2244
+ $.touches = [...e.touches].map(getTouchInfo);
2243
2245
  if (isTouchUnaware()) {
2244
2246
  $.pmouseX = $.mouseX;
2245
2247
  $.pmouseY = $.mouseY;
@@ -2255,8 +2257,8 @@ function Q5(scope, parent) {
2255
2257
  e.preventDefault();
2256
2258
  }
2257
2259
  };
2258
- $.canvas.ontouchend = $.canvas.ontouchcancel = (e) => {
2259
- $.touches = e.touches.map(getTouchInfo);
2260
+ $._ontouchend = (e) => {
2261
+ $.touches = [...e.touches].map(getTouchInfo);
2260
2262
  if (isTouchUnaware()) {
2261
2263
  $.pmouseX = $.mouseX;
2262
2264
  $.pmouseY = $.mouseY;
@@ -2271,6 +2273,9 @@ function Q5(scope, parent) {
2271
2273
  e.preventDefault();
2272
2274
  }
2273
2275
  };
2276
+ $.canvas.ontouchstart = (e) => $._ontouchstart(e);
2277
+ $.canvas.ontouchmove = (e) => $._ontouchmove(e);
2278
+ $.canvas.ontouchcancel = $.canvas.ontouchend = (e) => $._ontouchend(e);
2274
2279
 
2275
2280
  $.hasSensorPermission =
2276
2281
  (!window.DeviceOrientationEvent && !window.DeviceMotionEvent) ||
@@ -2444,6 +2449,7 @@ function Q5(scope, parent) {
2444
2449
  'keyReleased',
2445
2450
  'keyTyped',
2446
2451
  'touchStarted',
2452
+ 'touchMoved',
2447
2453
  'touchEnded'
2448
2454
  ];
2449
2455
  for (let k of eventNames) {