@scratch/scratch-render 12.1.0-login-from-editor → 12.1.0-membership-program

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scratch/scratch-render",
3
- "version": "12.1.0-login-from-editor",
3
+ "version": "12.1.0-membership-program",
4
4
  "description": "WebGL Renderer for Scratch 3.0",
5
5
  "author": "Massachusetts Institute of Technology",
6
6
  "license": "AGPL-3.0-only",
@@ -18,13 +18,15 @@
18
18
  },
19
19
  "files": [
20
20
  "dist",
21
- "src"
21
+ "src",
22
+ "LICENSE",
23
+ "TRADEMARK"
22
24
  ],
23
25
  "scripts": {
24
26
  "build": "webpack --progress && npm run docs",
25
27
  "clean": "rimraf dist playground",
26
28
  "docs": "jsdoc -c .jsdoc.json",
27
- "lint": "eslint .",
29
+ "lint": "eslint",
28
30
  "prepublish": "npm run build",
29
31
  "prepublish-watch": "npm run watch",
30
32
  "start": "webpack-dev-server",
@@ -44,7 +46,7 @@
44
46
  "iOS >= 8"
45
47
  ],
46
48
  "dependencies": {
47
- "@scratch/scratch-svg-renderer": "12.1.0-login-from-editor",
49
+ "@scratch/scratch-svg-renderer": "12.1.0-membership-program",
48
50
  "grapheme-breaker": "0.3.2",
49
51
  "hull.js": "0.2.10",
50
52
  "ify-loader": "1.1.0",
@@ -57,29 +59,28 @@
57
59
  "scratch-render-fonts": "^1.0.0"
58
60
  },
59
61
  "devDependencies": {
60
- "@babel/core": "7.28.4",
61
- "@babel/eslint-parser": "7.28.4",
62
+ "@babel/core": "7.28.5",
62
63
  "@babel/polyfill": "7.12.1",
63
- "@babel/preset-env": "7.28.3",
64
- "@scratch/scratch-vm": "12.1.0-login-from-editor",
64
+ "@babel/preset-env": "7.28.5",
65
+ "@scratch/scratch-vm": "12.1.0-membership-program",
65
66
  "babel-loader": "9.2.1",
66
67
  "copy-webpack-plugin": "6.4.1",
67
68
  "docdash": "0.4.0",
68
- "eslint": "8.57.1",
69
- "eslint-config-scratch": "9.0.9",
69
+ "eslint": "9.39.1",
70
+ "eslint-config-scratch": "12.0.38",
70
71
  "gh-pages": "1.2.0",
71
- "html-webpack-plugin": "5.6.4",
72
+ "globals": "16.5.0",
73
+ "html-webpack-plugin": "5.6.5",
72
74
  "jsdoc": "3.6.11",
73
- "json": "9.0.6",
74
- "playwright-chromium": "1.56.0",
75
- "scratch-render-fonts": "1.0.238",
76
- "scratch-semantic-release-config": "3.0.0",
77
- "scratch-storage": "4.1.11",
75
+ "playwright-chromium": "1.57.0",
76
+ "scratch-render-fonts": "1.0.252",
77
+ "scratch-semantic-release-config": "4.0.0",
78
+ "scratch-storage": "5.0.10",
78
79
  "scratch-webpack-configuration": "3.1.0",
79
80
  "semantic-release": "19.0.5",
80
- "tap": "21.1.1",
81
+ "tap": "21.4.0",
81
82
  "terser-webpack-plugin": "5.3.14",
82
- "webpack": "5.102.1",
83
+ "webpack": "5.103.0",
83
84
  "webpack-cli": "5.1.4",
84
85
  "webpack-dev-server": "5.2.2"
85
86
  }
package/src/BitmapSkin.js CHANGED
@@ -5,7 +5,7 @@ const Skin = require('./Skin');
5
5
  class BitmapSkin extends Skin {
6
6
  /**
7
7
  * Create a new Bitmap Skin.
8
- * @extends Skin
8
+ * @augments Skin
9
9
  * @param {!int} id - The ID for this Skin.
10
10
  * @param {!RenderWebGL} renderer - The renderer which will use this skin.
11
11
  */
@@ -34,7 +34,7 @@ class BitmapSkin extends Skin {
34
34
  }
35
35
 
36
36
  /**
37
- * @return {Array<number>} the "native" size, in texels, of this skin.
37
+ * @returns {Array<number>} the "native" size, in texels, of this skin.
38
38
  */
39
39
  get size () {
40
40
  return [this._textureSize[0] / this._costumeResolution, this._textureSize[1] / this._costumeResolution];
@@ -42,7 +42,7 @@ class BitmapSkin extends Skin {
42
42
 
43
43
  /**
44
44
  * @param {Array<number>} scale - The scaling factors to be used.
45
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
45
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
46
46
  */
47
47
  // eslint-disable-next-line no-unused-vars
48
48
  getTexture (scale) {
@@ -52,7 +52,7 @@ class BitmapSkin extends Skin {
52
52
  /**
53
53
  * Set the contents of this skin to a snapshot of the provided bitmap data.
54
54
  * @param {ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} bitmapData - new contents for this skin.
55
- * @param {int} [costumeResolution=1] - The resolution to use for this bitmap.
55
+ * @param {int} [costumeResolution] - The resolution to use for this bitmap.
56
56
  * @param {Array<number>} [rotationCenter] - Optional rotation center for the bitmap. If not supplied, it will be
57
57
  * calculated from the bounding box
58
58
  * @fires Skin.event:WasAltered
package/src/Drawable.js CHANGED
@@ -20,10 +20,9 @@ const FLOATING_POINT_ERROR_ALLOWANCE = 1e-6;
20
20
  * internal __isTouchingPosition as a return value, so this should be copied
21
21
  * if you ever need to get two local positions and store both. Requires that
22
22
  * the drawable inverseMatrix is up to date.
23
- *
24
23
  * @param {Drawable} drawable The drawable to get the inverse matrix and uniforms from
25
24
  * @param {twgl.v3} vec [x,y] scratch space vector
26
- * @return {twgl.v3} [x,y] texture space float vector - transformed by effects and matrix
25
+ * @returns {twgl.v3} [x,y] texture space float vector - transformed by effects and matrix
27
26
  */
28
27
  const getLocalPosition = (drawable, vec) => {
29
28
  // Transfrom from world coordinates to Drawable coordinates.
@@ -59,7 +58,7 @@ class Drawable {
59
58
  * An object which can be drawn by the renderer.
60
59
  * @todo double-buffer all rendering state (position, skin, effects, etc.)
61
60
  * @param {!int} id - This Drawable's unique ID.
62
- * @constructor
61
+ * @class
63
62
  */
64
63
  constructor (id) {
65
64
  /** @type {!int} */
@@ -108,9 +107,10 @@ class Drawable {
108
107
  this._inverseTransformDirty = true;
109
108
  this._visible = true;
110
109
 
111
- /** A bitmask identifying which effects are currently in use.
110
+ /**
111
+ * A bitmask identifying which effects are currently in use.
112
112
  * @readonly
113
- * @type {int} */
113
+ @type {int} */
114
114
  this.enabledEffects = 0;
115
115
 
116
116
  /** @todo move convex hull functionality, maybe bounds functionality overall, to Skin classes */
@@ -443,7 +443,7 @@ class Drawable {
443
443
 
444
444
  /**
445
445
  * Whether the Drawable needs convex hull points provided by the renderer.
446
- * @return {boolean} True when no convex hull known, or it's dirty.
446
+ * @returns {boolean} True when no convex hull known, or it's dirty.
447
447
  */
448
448
  needsConvexHullPoints () {
449
449
  return !this._convexHullPoints || this._convexHullDirty || this._convexHullPoints.length === 0;
@@ -481,7 +481,7 @@ class Drawable {
481
481
  * The caller is responsible for ensuring this drawable's inverse matrix & its skin's silhouette are up-to-date.
482
482
  * @see updateCPURenderAttributes
483
483
  * @param {twgl.v3} vec World coordinate vector.
484
- * @return {boolean} True if the world position touches the skin.
484
+ * @returns {boolean} True if the world position touches the skin.
485
485
  */
486
486
 
487
487
  // `updateCPURenderAttributes` sets this Drawable instance's `isTouching` method
@@ -510,7 +510,7 @@ class Drawable {
510
510
  * and then finds the minimum box along the axes.
511
511
  * Before calling this, ensure the renderer has updated convex hull points.
512
512
  * @param {?Rectangle} result optional destination for bounds calculation
513
- * @return {!Rectangle} Bounds for a tight box around the Drawable.
513
+ * @returns {!Rectangle} Bounds for a tight box around the Drawable.
514
514
  */
515
515
  getBounds (result) {
516
516
  if (this.needsConvexHullPoints()) {
@@ -531,7 +531,7 @@ class Drawable {
531
531
  * Used for calculating where to position a text bubble.
532
532
  * Before calling this, ensure the renderer has updated convex hull points.
533
533
  * @param {?Rectangle} result optional destination for bounds calculation
534
- * @return {!Rectangle} Bounds for a tight box around a slice of the Drawable.
534
+ * @returns {!Rectangle} Bounds for a tight box around a slice of the Drawable.
535
535
  */
536
536
  getBoundsForBubble (result) {
537
537
  if (this.needsConvexHullPoints()) {
@@ -558,7 +558,7 @@ class Drawable {
558
558
  * `getAABB` returns a much less accurate bounding box, but will be much
559
559
  * faster to calculate so may be desired for quick checks/optimizations.
560
560
  * @param {?Rectangle} result optional destination for bounds calculation
561
- * @return {!Rectangle} Rough axis-aligned bounding box for Drawable.
561
+ * @returns {!Rectangle} Rough axis-aligned bounding box for Drawable.
562
562
  */
563
563
  getAABB (result) {
564
564
  if (this._transformDirty) {
@@ -575,7 +575,7 @@ class Drawable {
575
575
  * I.e., returns the tight bounding box when the convex hull points are already
576
576
  * known, but otherwise return the rough AABB of the Drawable.
577
577
  * @param {?Rectangle} result optional destination for bounds calculation
578
- * @return {!Rectangle} Bounds for the Drawable.
578
+ * @returns {!Rectangle} Bounds for the Drawable.
579
579
  */
580
580
  getFastBounds (result) {
581
581
  if (!this.needsConvexHullPoints()) {
@@ -588,7 +588,7 @@ class Drawable {
588
588
  * Transform all the convex hull points by the current Drawable's
589
589
  * transform. This allows us to skip recalculating the convex hull
590
590
  * for many Drawable updates, including translation, rotation, scaling.
591
- * @return {!Array.<!Array.number>} Array of glPoints which are Array<x, y>
591
+ * @returns {!Array.<!Array.number>} Array of glPoints which are Array<x, y>
592
592
  * @private
593
593
  */
594
594
  _getTransformedHullPoints () {
@@ -723,7 +723,7 @@ class Drawable {
723
723
  const textColor =
724
724
  // commenting out to only use nearest for now
725
725
  // drawable.skin.useNearest(drawable._scale, drawable) ?
726
- drawable.skin._silhouette.colorAtNearest(localPosition, dst);
726
+ drawable.skin._silhouette.colorAtNearest(localPosition, dst);
727
727
  // : drawable.skin._silhouette.colorAtLinear(localPosition, dst);
728
728
 
729
729
  if (drawable.enabledEffects === 0) return textColor;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @fileoverview
2
+ * @file
3
3
  * A utility to transform a texture coordinate to another texture coordinate
4
4
  * representing how the shaders apply effects.
5
5
  */
@@ -11,13 +11,13 @@ const ShaderManager = require('./ShaderManager');
11
11
 
12
12
  /**
13
13
  * A texture coordinate is between 0 and 1. 0.5 is the center position.
14
- * @const {number}
14
+ * @constant {number}
15
15
  */
16
16
  const CENTER_X = 0.5;
17
17
 
18
18
  /**
19
19
  * A texture coordinate is between 0 and 1. 0.5 is the center position.
20
- * @const {number}
20
+ * @constant {number}
21
21
  */
22
22
  const CENTER_Y = 0.5;
23
23
 
@@ -123,7 +123,7 @@ class EffectTransform {
123
123
  * @param {Drawable} drawable The drawable whose effects to emulate.
124
124
  * @param {twgl.v3} vec The texture coordinate to transform.
125
125
  * @param {twgl.v3} dst A place to store the output coordinate.
126
- * @return {twgl.v3} dst - The coordinate after being transform by effects.
126
+ * @returns {twgl.v3} dst - The coordinate after being transform by effects.
127
127
  */
128
128
  static transformPoint (drawable, vec, dst) {
129
129
  twgl.v3.copy(vec, dst);
package/src/PenSkin.js CHANGED
@@ -17,7 +17,7 @@ const ShaderManager = require('./ShaderManager');
17
17
  * @type {PenSkin#PenAttributes}
18
18
  * @memberof PenSkin
19
19
  * @private
20
- * @const
20
+ * @constant
21
21
  */
22
22
  const DefaultPenAttributes = {
23
23
  color4f: [0, 0, 1, 1],
@@ -35,7 +35,7 @@ class PenSkin extends Skin {
35
35
  * Create a Skin which implements a Scratch pen layer.
36
36
  * @param {int} id - The unique ID for this Skin.
37
37
  * @param {RenderWebGL} renderer - The renderer which will use this Skin.
38
- * @extends Skin
38
+ * @augments Skin
39
39
  * @listens RenderWebGL#event:NativeSizeChanged
40
40
  */
41
41
  constructor (id, renderer) {
@@ -110,7 +110,7 @@ class PenSkin extends Skin {
110
110
  }
111
111
 
112
112
  /**
113
- * @return {Array<number>} the "native" size, in texels, of this skin. [width, height]
113
+ * @returns {Array<number>} the "native" size, in texels, of this skin. [width, height]
114
114
  */
115
115
  get size () {
116
116
  return this._size;
@@ -124,7 +124,7 @@ class PenSkin extends Skin {
124
124
 
125
125
  /**
126
126
  * @param {Array<number>} scale The X and Y scaling factors to be used, as percentages of this skin's "native" size.
127
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
127
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
128
128
  */
129
129
  // eslint-disable-next-line no-unused-vars
130
130
  getTexture (scale) {
package/src/Rectangle.js CHANGED
@@ -3,7 +3,7 @@ class Rectangle {
3
3
  * A utility for creating and comparing axis-aligned rectangles.
4
4
  * Rectangles are always initialized to the "largest possible rectangle";
5
5
  * use one of the init* methods below to set up a particular rectangle.
6
- * @constructor
6
+ * @class
7
7
  */
8
8
  constructor () {
9
9
  this.left = -Infinity;
@@ -84,7 +84,7 @@ class Rectangle {
84
84
  * Note that this is a comparison assuming the Rectangle was
85
85
  * initialized with Scratch-space bounds or points.
86
86
  * @param {!Rectangle} other Rectangle to check if intersecting.
87
- * @return {boolean} True if this Rectangle intersects other.
87
+ * @returns {boolean} True if this Rectangle intersects other.
88
88
  */
89
89
  intersects (other) {
90
90
  return (
@@ -100,7 +100,7 @@ class Rectangle {
100
100
  * Note that this is a comparison assuming the Rectangle was
101
101
  * initialized with Scratch-space bounds or points.
102
102
  * @param {!Rectangle} other Rectangle to check if fully contained.
103
- * @return {boolean} True if this Rectangle fully contains other.
103
+ * @returns {boolean} True if this Rectangle fully contains other.
104
104
  */
105
105
  contains (other) {
106
106
  return (
@@ -177,7 +177,7 @@ class Rectangle {
177
177
 
178
178
  /**
179
179
  * Width of the Rectangle.
180
- * @return {number} Width of rectangle.
180
+ * @returns {number} Width of rectangle.
181
181
  */
182
182
  get width () {
183
183
  return Math.abs(this.left - this.right);
@@ -185,7 +185,7 @@ class Rectangle {
185
185
 
186
186
  /**
187
187
  * Height of the Rectangle.
188
- * @return {number} Height of rectangle.
188
+ * @returns {number} Height of rectangle.
189
189
  */
190
190
  get height () {
191
191
  return Math.abs(this.top - this.bottom);
@@ -7,14 +7,14 @@
7
7
  module.exports = {
8
8
  /**
9
9
  * The ID value to use for "no item" or when an object has been disposed.
10
- * @const {int}
10
+ * @constant {int}
11
11
  */
12
12
  ID_NONE: -1,
13
13
 
14
14
  /**
15
15
  * Optimize for fewer than this number of Drawables sharing the same Skin.
16
16
  * Going above this may cause middleware warnings or a performance penalty but should otherwise behave correctly.
17
- * @const {int}
17
+ * @constant {int}
18
18
  */
19
19
  SKIN_SHARE_SOFT_LIMIT: 301,
20
20
 
@@ -24,7 +24,6 @@ module.exports = {
24
24
  Events: {
25
25
  /**
26
26
  * NativeSizeChanged event
27
- *
28
27
  * @event RenderWebGL#event:NativeSizeChanged
29
28
  * @type {object}
30
29
  * @property {Array<int>} newSize - the new size of the renderer
@@ -27,7 +27,7 @@ const __cpuTouchingColorPixelCount = 4e4;
27
27
  /**
28
28
  * @callback RenderWebGL#idFilterFunc
29
29
  * @param {int} drawableID The ID to filter.
30
- * @return {bool} True if the ID passes the filter, otherwise false.
30
+ * @returns {bool} True if the ID passes the filter, otherwise false.
31
31
  */
32
32
 
33
33
  /**
@@ -99,7 +99,7 @@ class RenderWebGL extends EventEmitter {
99
99
  try {
100
100
  // Create the context the same way that the constructor will: attributes may make the difference.
101
101
  return !!RenderWebGL._getContext(optCanvas || document.createElement('canvas'));
102
- } catch (e) {
102
+ } catch (e) { // eslint-disable-line no-unused-vars
103
103
  return false;
104
104
  }
105
105
  }
@@ -128,11 +128,11 @@ class RenderWebGL extends EventEmitter {
128
128
  * @see RenderWebGL#setStageSize
129
129
  * @see RenderWebGL#resize
130
130
  * @param {canvas} canvas The canvas to draw onto.
131
- * @param {int} [xLeft=-240] The x-coordinate of the left edge.
132
- * @param {int} [xRight=240] The x-coordinate of the right edge.
133
- * @param {int} [yBottom=-180] The y-coordinate of the bottom edge.
134
- * @param {int} [yTop=180] The y-coordinate of the top edge.
135
- * @constructor
131
+ * @param {int} [xLeft] The x-coordinate of the left edge.
132
+ * @param {int} [xRight] The x-coordinate of the right edge.
133
+ * @param {int} [yBottom] The y-coordinate of the bottom edge.
134
+ * @param {int} [yTop] The y-coordinate of the top edge.
135
+ * @class
136
136
  * @listens RenderWebGL#event:NativeSizeChanged
137
137
  */
138
138
  constructor (canvas, xLeft, xRight, yBottom, yTop) {
@@ -158,7 +158,7 @@ class RenderWebGL extends EventEmitter {
158
158
 
159
159
  // A list of layer group names in the order they should appear
160
160
  // from furthest back to furthest in front.
161
- /** @type {Array<String>} */
161
+ /** @type {Array<string>} */
162
162
  this._groupOrdering = [];
163
163
 
164
164
  /**
@@ -316,7 +316,7 @@ class RenderWebGL extends EventEmitter {
316
316
  }
317
317
 
318
318
  /**
319
- * @return {Array<int>} the "native" size of the stage, which is used for pen, query renders, etc.
319
+ * @returns {Array<int>} the "native" size of the stage, which is used for pen, query renders, etc.
320
320
  */
321
321
  getNativeSize () {
322
322
  return [this._nativeSize[0], this._nativeSize[1]];
@@ -337,7 +337,7 @@ class RenderWebGL extends EventEmitter {
337
337
  /**
338
338
  * Create a new bitmap skin from a snapshot of the provided bitmap data.
339
339
  * @param {ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} bitmapData - new contents for this skin.
340
- * @param {!int} [costumeResolution=1] - The resolution to use for this bitmap.
340
+ * @param {!int} [costumeResolution] - The resolution to use for this bitmap.
341
341
  * @param {?Array<number>} [rotationCenter] Optional: rotation center of the skin. If not supplied, the center of
342
342
  * the skin will be used.
343
343
  * @returns {!int} the ID for the new skin.
@@ -578,7 +578,7 @@ class RenderWebGL extends EventEmitter {
578
578
  * Returns the position of the given drawableID in the draw list. This is
579
579
  * the absolute position irrespective of layer group.
580
580
  * @param {number} drawableID The drawable ID to find.
581
- * @return {number} The postion of the given drawable ID.
581
+ * @returns {number} The postion of the given drawable ID.
582
582
  */
583
583
  getDrawableOrder (drawableID) {
584
584
  return this._drawList.indexOf(drawableID);
@@ -598,7 +598,7 @@ class RenderWebGL extends EventEmitter {
598
598
  * of the layer group.
599
599
  * @param {boolean=} optIsRelative If set, `order` refers to a relative change.
600
600
  * @param {number=} optMin If set, order constrained to be at least `optMin`.
601
- * @return {?number} New order if changed, or null.
601
+ * @returns {?number} New order if changed, or null.
602
602
  */
603
603
  setDrawableOrder (drawableID, order, group, optIsRelative, optMin) {
604
604
  if (!group || !Object.prototype.hasOwnProperty.call(this._layerGroups, group)) {
@@ -672,7 +672,7 @@ class RenderWebGL extends EventEmitter {
672
672
  /**
673
673
  * Get the precise bounds for a Drawable.
674
674
  * @param {int} drawableID ID of Drawable to get bounds for.
675
- * @return {object} Bounds for a tight box around the Drawable.
675
+ * @returns {object} Bounds for a tight box around the Drawable.
676
676
  */
677
677
  getBounds (drawableID) {
678
678
  const drawable = this._allDrawables[drawableID];
@@ -705,7 +705,7 @@ class RenderWebGL extends EventEmitter {
705
705
  * Get the precise bounds for a Drawable around the top slice.
706
706
  * Used for positioning speech bubbles more closely to the sprite.
707
707
  * @param {int} drawableID ID of Drawable to get bubble bounds for.
708
- * @return {object} Bounds for a tight box around the Drawable top slice.
708
+ * @returns {object} Bounds for a tight box around the Drawable top slice.
709
709
  */
710
710
  getBoundsForBubble (drawableID) {
711
711
  const drawable = this._allDrawables[drawableID];
@@ -737,7 +737,7 @@ class RenderWebGL extends EventEmitter {
737
737
  /**
738
738
  * Get the current skin (costume) size of a Drawable.
739
739
  * @param {int} drawableID The ID of the Drawable to measure.
740
- * @return {Array<number>} Skin size, width and height.
740
+ * @returns {Array<number>} Skin size, width and height.
741
741
  */
742
742
  getCurrentSkinSize (drawableID) {
743
743
  const drawable = this._allDrawables[drawableID];
@@ -747,7 +747,7 @@ class RenderWebGL extends EventEmitter {
747
747
  /**
748
748
  * Get the size of a skin by ID.
749
749
  * @param {int} skinID The ID of the Skin to measure.
750
- * @return {Array<number>} Skin size, width and height.
750
+ * @returns {Array<number>} Skin size, width and height.
751
751
  */
752
752
  getSkinSize (skinID) {
753
753
  const skin = this._allSkins[skinID];
@@ -757,7 +757,7 @@ class RenderWebGL extends EventEmitter {
757
757
  /**
758
758
  * Get the rotation center of a skin by ID.
759
759
  * @param {int} skinID The ID of the Skin
760
- * @return {Array<number>} The rotationCenterX and rotationCenterY
760
+ * @returns {Array<number>} The rotationCenterX and rotationCenterY
761
761
  */
762
762
  getSkinRotationCenter (skinID) {
763
763
  const skin = this._allSkins[skinID];
@@ -1005,7 +1005,6 @@ class RenderWebGL extends EventEmitter {
1005
1005
  * Convert a client based x/y position on the canvas to a Scratch 3 world space
1006
1006
  * Rectangle. This creates recangles with a radius to cover selecting multiple
1007
1007
  * scratch pixels with touch / small render areas.
1008
- *
1009
1008
  * @param {int} centerX The client x coordinate of the picking location.
1010
1009
  * @param {int} centerY The client y coordinate of the picking location.
1011
1010
  * @param {int} [width] The client width of the touch event (optional).
@@ -1041,7 +1040,6 @@ class RenderWebGL extends EventEmitter {
1041
1040
  /**
1042
1041
  * Determine if the drawable is touching a client based x/y. Helper method for sensing
1043
1042
  * touching mouse-pointer. Ignores visibility.
1044
- *
1045
1043
  * @param {int} drawableID The ID of the drawable to check.
1046
1044
  * @param {int} centerX The client x coordinate of the picking location.
1047
1045
  * @param {int} centerY The client y coordinate of the picking location.
@@ -1071,7 +1069,6 @@ class RenderWebGL extends EventEmitter {
1071
1069
 
1072
1070
  /**
1073
1071
  * Determine if the drawable is touching a rectangle.
1074
- *
1075
1072
  * @param {int} drawableID The ID of the drawable to check.
1076
1073
  * @param {int} left - The left X coordinate of the rectangle.
1077
1074
  * @param {int} top - The top Y coordinate of the rectangle.
@@ -1102,7 +1099,6 @@ class RenderWebGL extends EventEmitter {
1102
1099
 
1103
1100
  /**
1104
1101
  * Determine if the drawable is touching a point in the Scratch coordinate system
1105
- *
1106
1102
  * @param {int} drawableID The ID of the drawable to check.
1107
1103
  * @param {int} x The x coordinate of the point.
1108
1104
  * @param {int} y The y coordinate of the point.
@@ -1122,7 +1118,6 @@ class RenderWebGL extends EventEmitter {
1122
1118
  * This function will pick all drawables that are visible, unless specific
1123
1119
  * candidate drawable IDs are provided. Used for determining what is clicked
1124
1120
  * or dragged. Will not select hidden / ghosted sprites.
1125
- *
1126
1121
  * @param {int} centerX The client x coordinate of the picking location.
1127
1122
  * @param {int} centerY The client y coordinate of the picking location.
1128
1123
  * @param {int} [touchWidth] The client width of the touch event (optional).
@@ -1200,7 +1195,7 @@ class RenderWebGL extends EventEmitter {
1200
1195
  /**
1201
1196
  * Return a drawable's pixel data and bounds in screen space.
1202
1197
  * @param {int} drawableID The ID of the drawable to get pixel data for
1203
- * @return {DrawableExtraction} Data about the picked drawable
1198
+ * @returns {DrawableExtraction} Data about the picked drawable
1204
1199
  */
1205
1200
  extractDrawableScreenSpace (drawableID) {
1206
1201
  const drawable = this._allDrawables[drawableID];
@@ -1313,7 +1308,7 @@ class RenderWebGL extends EventEmitter {
1313
1308
  * @param {int} x The client x coordinate of the picking location.
1314
1309
  * @param {int} y The client y coordinate of the picking location.
1315
1310
  * @param {int} radius The client radius to extract pixels with.
1316
- * @return {?ColorExtraction} Data about the picked color
1311
+ * @returns {?ColorExtraction} Data about the picked color
1317
1312
  */
1318
1313
  extractColor (x, y, radius) {
1319
1314
  this._doExitDrawRegion();
@@ -1373,7 +1368,7 @@ class RenderWebGL extends EventEmitter {
1373
1368
  /**
1374
1369
  * Get the candidate bounding box for a touching query.
1375
1370
  * @param {int} drawableID ID for drawable of query.
1376
- * @return {?Rectangle} Rectangle bounds for touching query, or null.
1371
+ * @returns {?Rectangle} Rectangle bounds for touching query, or null.
1377
1372
  */
1378
1373
  _touchingBounds (drawableID) {
1379
1374
  const drawable = this._allDrawables[drawableID];
@@ -1402,7 +1397,7 @@ class RenderWebGL extends EventEmitter {
1402
1397
  * could possibly intersect the given bounds.
1403
1398
  * @param {int} drawableID - ID for drawable of query.
1404
1399
  * @param {Array<int>} candidateIDs - Candidates for touching query.
1405
- * @return {?Array< {id, drawable, intersection} >} Filtered candidates with useful data.
1400
+ * @returns {?Array< {id, drawable, intersection} >} Filtered candidates with useful data.
1406
1401
  */
1407
1402
  _candidatesTouching (drawableID, candidateIDs) {
1408
1403
  const bounds = this._touchingBounds(drawableID);
@@ -1445,7 +1440,7 @@ class RenderWebGL extends EventEmitter {
1445
1440
  * Helper to get the union bounds from a set of candidates returned from the above method
1446
1441
  * @private
1447
1442
  * @param {Array<object>} candidates info from _candidatesTouching
1448
- * @return {Rectangle} the outer bounding box union
1443
+ * @returns {Rectangle} the outer bounding box union
1449
1444
  */
1450
1445
  _candidatesBounds (candidates) {
1451
1446
  return candidates.reduce((memo, {intersection}) => {
@@ -1569,7 +1564,7 @@ class RenderWebGL extends EventEmitter {
1569
1564
  * Update the position object's x & y members to keep the drawable fenced in view.
1570
1565
  * @param {int} drawableID - The ID of the Drawable to update.
1571
1566
  * @param {Array.<number, number>} position to be fenced - An array of type [x, y]
1572
- * @return {Array.<number, number>} The fenced position as an array [x, y]
1567
+ * @returns {Array.<number, number>} The fenced position as an array [x, y]
1573
1568
  */
1574
1569
  getFencedPositionOfDrawable (drawableID, position) {
1575
1570
  let x = position[0];
@@ -1749,7 +1744,6 @@ class RenderWebGL extends EventEmitter {
1749
1744
  * region. Since one region may be entered from within another a exit
1750
1745
  * handle can also be registered that is called when a new region is about
1751
1746
  * to be entered to restore a common inbetween state.
1752
- *
1753
1747
  * @param {any} regionId - id of the region to enter
1754
1748
  * @param {function} enter - handle to call when first entering a region
1755
1749
  * @param {function} exit - handle to call when leaving a region
@@ -1872,7 +1866,7 @@ class RenderWebGL extends EventEmitter {
1872
1866
  * Get the convex hull points for a particular Drawable.
1873
1867
  * To do this, calculate it based on the drawable's Silhouette.
1874
1868
  * @param {int} drawableID The Drawable IDs calculate convex hull for.
1875
- * @return {Array<Array<number>>} points Convex hull points, as [[x, y], ...]
1869
+ * @returns {Array<Array<number>>} points Convex hull points, as [[x, y], ...]
1876
1870
  */
1877
1871
  _getConvexHullPointsForDrawable (drawableID) {
1878
1872
  const drawable = this._allDrawables[drawableID];
@@ -1890,11 +1884,10 @@ class RenderWebGL extends EventEmitter {
1890
1884
  *
1891
1885
  * The determinant is useful in this case to know if AC is counter-clockwise from AB.
1892
1886
  * A positive value means that AC is counter-clockwise from AB. A negative value means AC is clockwise from AB.
1893
- *
1894
1887
  * @param {Float32Array} A A 2d vector in space.
1895
1888
  * @param {Float32Array} B A 2d vector in space.
1896
1889
  * @param {Float32Array} C A 2d vector in space.
1897
- * @return {number} Greater than 0 if counter clockwise, less than if clockwise, 0 if all points are on a line.
1890
+ * @returns {number} Greater than 0 if counter clockwise, less than if clockwise, 0 if all points are on a line.
1898
1891
  */
1899
1892
  const determinant = function (A, B, C) {
1900
1893
  // AB = B - A
@@ -2009,7 +2002,7 @@ class RenderWebGL extends EventEmitter {
2009
2002
  * @param {Array<Drawables>} drawables A list of drawables with the "top most"
2010
2003
  * drawable at index 0
2011
2004
  * @param {Uint8ClampedArray} dst The color3b space to store the answer in.
2012
- * @return {Uint8ClampedArray} The dst vector with everything blended down.
2005
+ * @returns {Uint8ClampedArray} The dst vector with everything blended down.
2013
2006
  */
2014
2007
  static sampleColor3b (vec, drawables, dst) {
2015
2008
  dst = dst || new Uint8ClampedArray(3);
package/src/SVGSkin.js CHANGED
@@ -10,7 +10,7 @@ const MAX_TEXTURE_DIMENSION = 2048;
10
10
  * All scaled renderings of the SVG are stored in an array. The 1.0 scale of
11
11
  * the SVG is stored at the 8th index. The smallest possible 1 / 256 scale
12
12
  * rendering is stored at the 0th index.
13
- * @const {number}
13
+ * @constant {number}
14
14
  */
15
15
  const INDEX_OFFSET = 8;
16
16
 
@@ -19,8 +19,8 @@ class SVGSkin extends Skin {
19
19
  * Create a new SVG skin.
20
20
  * @param {!int} id - The ID for this Skin.
21
21
  * @param {!RenderWebGL} renderer - The renderer which will use this skin.
22
- * @constructor
23
- * @extends Skin
22
+ * @class
23
+ * @augments Skin
24
24
  */
25
25
  constructor (id, renderer) {
26
26
  super(id);
@@ -50,9 +50,9 @@ class SVGSkin extends Skin {
50
50
  this._largestMIPScale = 0;
51
51
 
52
52
  /**
53
- * Ratio of the size of the SVG and the max size of the WebGL texture
54
- * @type {Number}
55
- */
53
+ * Ratio of the size of the SVG and the max size of the WebGL texture
54
+ * @type {number}
55
+ */
56
56
  this._maxTextureScale = 1;
57
57
  }
58
58
 
@@ -65,7 +65,7 @@ class SVGSkin extends Skin {
65
65
  }
66
66
 
67
67
  /**
68
- * @return {Array<number>} the natural size, in Scratch units, of this skin.
68
+ * @returns {Array<number>} the natural size, in Scratch units, of this skin.
69
69
  */
70
70
  get size () {
71
71
  return [this._size[0], this._size[1]];
@@ -103,7 +103,7 @@ class SVGSkin extends Skin {
103
103
  /**
104
104
  * Create a MIP for a given scale.
105
105
  * @param {number} scale - The relative size of the MIP
106
- * @return {SVGMIP} An object that handles creating and updating SVG textures.
106
+ * @returns {SVGMIP} An object that handles creating and updating SVG textures.
107
107
  */
108
108
  createMIP (scale) {
109
109
  const [width, height] = this._size;
@@ -153,7 +153,7 @@ class SVGSkin extends Skin {
153
153
 
154
154
  /**
155
155
  * @param {Array<number>} scale - The scaling factors to be used, each in the [0,100] range.
156
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
156
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
157
157
  */
158
158
  getTexture (scale) {
159
159
  // The texture only ever gets uniform scale. Take the larger of the two axes.