@scratch/scratch-render 12.1.0-login-from-editor → 12.1.1-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.
@@ -4,7 +4,7 @@ const twgl = require('twgl.js');
4
4
  class ShaderManager {
5
5
  /**
6
6
  * @param {WebGLRenderingContext} gl WebGL rendering context to create shaders for
7
- * @constructor
7
+ * @class
8
8
  */
9
9
  constructor (gl) {
10
10
  this._gl = gl;
@@ -63,10 +63,10 @@ class ShaderManager {
63
63
 
64
64
  const definesText = `${defines.join('\n')}\n`;
65
65
 
66
- /* eslint-disable global-require */
66
+
67
67
  const vsFullText = definesText + require('raw-loader!./shaders/sprite.vert');
68
68
  const fsFullText = definesText + require('raw-loader!./shaders/sprite.frag');
69
- /* eslint-enable global-require */
69
+
70
70
 
71
71
  return twgl.createProgramInfo(this._gl, [vsFullText, fsFullText]);
72
72
  }
@@ -74,11 +74,11 @@ class ShaderManager {
74
74
 
75
75
  /**
76
76
  * @typedef {object} ShaderManager.Effect
77
- * @prop {int} mask - The bit in 'effectBits' representing the effect.
78
- * @prop {function} converter - A conversion function which takes a Scratch value (generally in the range
77
+ * @property {int} mask - The bit in 'effectBits' representing the effect.
78
+ * @property {function} converter - A conversion function which takes a Scratch value (generally in the range
79
79
  * 0..100 or -100..100) and maps it to a value useful to the shader. This
80
80
  * mapping may not be reversible.
81
- * @prop {boolean} shapeChanges - Whether the effect could change the drawn shape.
81
+ * @property {boolean} shapeChanges - Whether the effect could change the drawn shape.
82
82
  */
83
83
 
84
84
  /**
package/src/Silhouette.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @fileoverview
2
+ * @file
3
3
  * A representation of a Skin's silhouette that can test if a point on the skin
4
4
  * renders a pixel where it is drawn.
5
5
  */
@@ -22,7 +22,7 @@ const intMax = (i, j) => i ^ ((i ^ j) & ((i - j) >> 31));
22
22
  * @param {Silhouette} silhouette - has data width and height
23
23
  * @param {number} x - x
24
24
  * @param {number} y - y
25
- * @return {number} Alpha value for x/y position
25
+ * @returns {number} Alpha value for x/y position
26
26
  */
27
27
  const getPoint = ({_width: width, _height: height, _colorData: data}, x, y) => {
28
28
  // 0 if outside bounds, otherwise read from data.
@@ -49,7 +49,7 @@ const __cornerWork = [
49
49
  * @param {number} x X position of texture [0, width).
50
50
  * @param {number} y Y position of texture [0, height).
51
51
  * @param {Uint8ClampedArray} dst A color 4b space.
52
- * @return {Uint8ClampedArray} The dst vector.
52
+ * @returns {Uint8ClampedArray} The dst vector.
53
53
  */
54
54
  const getColor4b = ({_width: width, _height: height, _colorData: data}, x, y, dst) => {
55
55
  // Clamp coords to edge, matching GL_CLAMP_TO_EDGE.
@@ -78,7 +78,7 @@ const getColor4b = ({_width: width, _height: height, _colorData: data}, x, y, ds
78
78
  * @param {number} x X position of texture [0, width).
79
79
  * @param {number} y Y position of texture [0, height).
80
80
  * @param {Uint8ClampedArray} dst A color 4b space.
81
- * @return {Uint8ClampedArray} The dst vector.
81
+ * @returns {Uint8ClampedArray} The dst vector.
82
82
  */
83
83
  const getPremultipliedColor4b = ({_width: width, _height: height, _colorData: data}, x, y, dst) => {
84
84
  // Clamp coords to edge, matching GL_CLAMP_TO_EDGE.
@@ -214,7 +214,7 @@ class Silhouette {
214
214
  /**
215
215
  * Test if texture coordinate touches the silhouette using nearest neighbor.
216
216
  * @param {twgl.v3} vec A texture coordinate.
217
- * @return {boolean} If the nearest pixel has an alpha value.
217
+ * @returns {boolean} If the nearest pixel has an alpha value.
218
218
  */
219
219
  isTouchingNearest (vec) {
220
220
  if (!this._colorData) return;
@@ -229,7 +229,7 @@ class Silhouette {
229
229
  * Test to see if any of the 4 pixels used in the linear interpolate touch
230
230
  * the silhouette.
231
231
  * @param {twgl.v3} vec A texture coordinate.
232
- * @return {boolean} Any of the pixels have some alpha.
232
+ * @returns {boolean} Any of the pixels have some alpha.
233
233
  */
234
234
  isTouchingLinear (vec) {
235
235
  if (!this._colorData) return;
@@ -244,7 +244,7 @@ class Silhouette {
244
244
  /**
245
245
  * Get the canvas element reused by Silhouettes to update their data with.
246
246
  * @private
247
- * @return {CanvasElement} A canvas to draw bitmap data to.
247
+ * @returns {CanvasElement} A canvas to draw bitmap data to.
248
248
  */
249
249
  static _updateCanvas () {
250
250
  if (typeof __SilhouetteUpdateCanvas === 'undefined') {
package/src/Skin.js CHANGED
@@ -9,7 +9,7 @@ class Skin extends EventEmitter {
9
9
  /**
10
10
  * Create a Skin, which stores and/or generates textures for use in rendering.
11
11
  * @param {int} id - The unique ID for this Skin.
12
- * @constructor
12
+ * @class
13
13
  */
14
14
  constructor (id) {
15
15
  super();
@@ -60,7 +60,7 @@ class Skin extends EventEmitter {
60
60
  }
61
61
 
62
62
  /**
63
- * @return {int} the unique ID for this Skin.
63
+ * @returns {int} the unique ID for this Skin.
64
64
  */
65
65
  get id () {
66
66
  return this._id;
@@ -75,7 +75,7 @@ class Skin extends EventEmitter {
75
75
 
76
76
  /**
77
77
  * @abstract
78
- * @return {Array<number>} the "native" size, in texels, of this skin.
78
+ * @returns {Array<number>} the "native" size, in texels, of this skin.
79
79
  */
80
80
  get size () {
81
81
  return [0, 0];
@@ -83,10 +83,10 @@ class Skin extends EventEmitter {
83
83
 
84
84
  /**
85
85
  * Should this skin's texture be filtered with nearest-neighbor or linear interpolation at the given scale?
86
- * @param {?Array<Number>} scale The screen-space X and Y scaling factors at which this skin's texture will be
86
+ * @param {?Array<number>} scale The screen-space X and Y scaling factors at which this skin's texture will be
87
87
  * displayed, as percentages (100 means 1 "native size" unit is 1 screen pixel; 200 means 2 screen pixels, etc).
88
88
  * @param {Drawable} drawable The drawable that this skin's texture will be applied to.
89
- * @return {boolean} True if this skin's texture, as returned by {@link getTexture}, should be filtered with
89
+ * @returns {boolean} True if this skin's texture, as returned by {@link getTexture}, should be filtered with
90
90
  * nearest-neighbor interpolation.
91
91
  */
92
92
  // eslint-disable-next-line no-unused-vars
@@ -96,7 +96,7 @@ class Skin extends EventEmitter {
96
96
 
97
97
  /**
98
98
  * Get the center of the current bounding box
99
- * @return {Array<number>} the center of the current bounding box
99
+ * @returns {Array<number>} the center of the current bounding box
100
100
  */
101
101
  calculateRotationCenter () {
102
102
  return [this.size[0] / 2, this.size[1] / 2];
@@ -105,7 +105,7 @@ class Skin extends EventEmitter {
105
105
  /**
106
106
  * @abstract
107
107
  * @param {Array<number>} scale - The scaling factors to be used.
108
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
108
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given size.
109
109
  */
110
110
  // eslint-disable-next-line no-unused-vars
111
111
  getTexture (scale) {
@@ -116,7 +116,7 @@ class Skin extends EventEmitter {
116
116
  * Get the bounds of the drawable for determining its fenced position.
117
117
  * @param {Array<number>} drawable - The Drawable instance this skin is using.
118
118
  * @param {?Rectangle} result - Optional destination for bounds calculation.
119
- * @return {!Rectangle} The drawable's bounds. For compatibility with Scratch 2, we always use getAABB.
119
+ * @returns {!Rectangle} The drawable's bounds. For compatibility with Scratch 2, we always use getAABB.
120
120
  */
121
121
  getFenceBounds (drawable, result) {
122
122
  return drawable.getAABB(result);
@@ -199,7 +199,7 @@ class Skin extends EventEmitter {
199
199
  * @see updateSilhouette
200
200
  * @see Drawable.updateCPURenderAttributes
201
201
  * @param {twgl.v3} vec A texture coordinate.
202
- * @return {boolean} Did it touch?
202
+ * @returns {boolean} Did it touch?
203
203
  */
204
204
  isTouchingNearest (vec) {
205
205
  return this._silhouette.isTouchingNearest(vec);
@@ -212,7 +212,7 @@ class Skin extends EventEmitter {
212
212
  * @see updateSilhouette
213
213
  * @see Drawable.updateCPURenderAttributes
214
214
  * @param {twgl.v3} vec A texture coordinate.
215
- * @return {boolean} Did it touch?
215
+ * @returns {boolean} Did it touch?
216
216
  */
217
217
  isTouchingLinear (vec) {
218
218
  return this._silhouette.isTouchingLinear(vec);
@@ -30,8 +30,8 @@ class TextBubbleSkin extends Skin {
30
30
  * Create a new text bubble skin.
31
31
  * @param {!int} id - The ID for this Skin.
32
32
  * @param {!RenderWebGL} renderer - The renderer which will use this skin.
33
- * @constructor
34
- * @extends Skin
33
+ * @class
34
+ * @augments Skin
35
35
  */
36
36
  constructor (id, renderer) {
37
37
  super(id);
@@ -85,7 +85,7 @@ class TextBubbleSkin extends Skin {
85
85
  }
86
86
 
87
87
  /**
88
- * @return {Array<number>} the dimensions, in Scratch units, of this skin.
88
+ * @returns {Array<number>} the dimensions, in Scratch units, of this skin.
89
89
  */
90
90
  get size () {
91
91
  if (this._textDirty) {
@@ -248,7 +248,7 @@ class TextBubbleSkin extends Skin {
248
248
 
249
249
  /**
250
250
  * @param {Array<number>} scale - The scaling factors to be used, each in the [0,100] range.
251
- * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
251
+ * @returns {WebGLTexture} The GL texture representation of this skin when drawing at the given scale.
252
252
  */
253
253
  getTexture (scale) {
254
254
  // The texture only ever gets uniform scale. Take the larger of the two axes.
@@ -80,7 +80,6 @@ const fudgePropertyInput = document.getElementById('fudgeproperty');
80
80
  const fudgeMinInput = document.getElementById('fudgeMin');
81
81
  const fudgeMaxInput = document.getElementById('fudgeMax');
82
82
 
83
- /* eslint require-jsdoc: 0 */
84
83
  const updateFudgeProperty = event => {
85
84
  fudgeProperty = event.target.value;
86
85
  };
@@ -3,13 +3,12 @@
3
3
  * adapted from http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv.
4
4
  * Assumes r, g, and b are in the range [0, 255] and
5
5
  * returns h, s, and v in the range [0, 1].
6
- *
7
6
  * @param {Array<number>} rgb The RGB color value
8
7
  * @param {number} rgb.r The red color value
9
8
  * @param {number} rgb.g The green color value
10
9
  * @param {number} rgb.b The blue color value
11
10
  * @param {Array<number>} dst The array to store the HSV values in
12
- * @return {Array<number>} The `dst` array passed in
11
+ * @returns {Array<number>} The `dst` array passed in
13
12
  */
14
13
  const rgbToHsv = ([r, g, b], dst) => {
15
14
  let K = 0.0;
@@ -52,13 +51,12 @@ const rgbToHsv = ([r, g, b], dst) => {
52
51
  * adapted from https://gist.github.com/mjackson/5311256.
53
52
  * Assumes h, s, and v are contained in the set [0, 1] and
54
53
  * returns r, g, and b in the set [0, 255].
55
- *
56
54
  * @param {Array<number>} hsv The HSV color value
57
55
  * @param {number} hsv.h The hue
58
56
  * @param {number} hsv.s The saturation
59
57
  * @param {number} hsv.v The value
60
58
  * @param {Uint8Array|Uint8ClampedArray} dst The array to store the RGB values in
61
- * @return {Uint8Array|Uint8ClampedArray} The `dst` array passed in
59
+ * @returns {Uint8Array|Uint8ClampedArray} The `dst` array passed in
62
60
  */
63
61
  const hsvToRgb = ([h, s, v], dst) => {
64
62
  if (s === 0) {
package/src/.eslintrc.js DELETED
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['scratch', 'scratch/es6', 'scratch/node'],
4
- env: {
5
- node: false,
6
- browser: true // TODO: disable this
7
- },
8
- globals: {
9
- Buffer: true // TODO: remove this?
10
- }
11
- };
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- extends: ['scratch'],
3
- env: {
4
- browser: true
5
- },
6
- rules: {
7
- 'no-console': 'off'
8
- }
9
- };