@scratch/scratch-render 12.0.0-react-18 → 12.0.0-react-18-face-sensing
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/dist/node/scratch-render.js +50 -0
- package/dist/node/scratch-render.js.map +1 -1
- package/dist/web/scratch-render.js +50 -0
- package/dist/web/scratch-render.js.map +1 -1
- package/dist/web/scratch-render.min.js +50 -0
- package/dist/web/scratch-render.min.js.map +1 -1
- package/package.json +9 -9
- package/src/RenderWebGL.js +48 -0
|
@@ -193353,6 +193353,56 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
|
|
|
193353
193353
|
return false;
|
|
193354
193354
|
}
|
|
193355
193355
|
|
|
193356
|
+
/**
|
|
193357
|
+
* Determine if the drawable is touching a rectangle.
|
|
193358
|
+
*
|
|
193359
|
+
* @param {int} drawableID The ID of the drawable to check.
|
|
193360
|
+
* @param {int} left - The left X coordinate of the rectangle.
|
|
193361
|
+
* @param {int} top - The top Y coordinate of the rectangle.
|
|
193362
|
+
* @param {int} right - The right X coordinate of the rectangle.
|
|
193363
|
+
* @param {int} bottom - The bottom Y coordinate of the rectangle.
|
|
193364
|
+
* @returns {boolean} If the drawable has any pixels that would draw in the rectangle area
|
|
193365
|
+
*/
|
|
193366
|
+
}, {
|
|
193367
|
+
key: "drawableTouchingScratchRect",
|
|
193368
|
+
value: function drawableTouchingScratchRect(drawableID, left, top, right, bottom) {
|
|
193369
|
+
var drawable = this._allDrawables[drawableID];
|
|
193370
|
+
if (!drawable) {
|
|
193371
|
+
return false;
|
|
193372
|
+
}
|
|
193373
|
+
var bounds = new Rectangle();
|
|
193374
|
+
bounds.initFromBounds(left, right, bottom, top);
|
|
193375
|
+
var worldPos = twgl.v3.create();
|
|
193376
|
+
drawable.updateCPURenderAttributes();
|
|
193377
|
+
for (worldPos[1] = bounds.bottom; worldPos[1] <= bounds.top; worldPos[1]++) {
|
|
193378
|
+
for (worldPos[0] = bounds.left; worldPos[0] <= bounds.right; worldPos[0]++) {
|
|
193379
|
+
if (drawable.isTouching(worldPos)) {
|
|
193380
|
+
return true;
|
|
193381
|
+
}
|
|
193382
|
+
}
|
|
193383
|
+
}
|
|
193384
|
+
return false;
|
|
193385
|
+
}
|
|
193386
|
+
|
|
193387
|
+
/**
|
|
193388
|
+
* Determine if the drawable is touching a point in the Scratch coordinate system
|
|
193389
|
+
*
|
|
193390
|
+
* @param {int} drawableID The ID of the drawable to check.
|
|
193391
|
+
* @param {int} x The x coordinate of the point.
|
|
193392
|
+
* @param {int} y The y coordinate of the point.
|
|
193393
|
+
* @returns {boolean} If the drawable is touching the point
|
|
193394
|
+
*/
|
|
193395
|
+
}, {
|
|
193396
|
+
key: "drawableTouchingScratchPoint",
|
|
193397
|
+
value: function drawableTouchingScratchPoint(drawableID, x, y) {
|
|
193398
|
+
var drawable = this._allDrawables[drawableID];
|
|
193399
|
+
if (!drawable) {
|
|
193400
|
+
return false;
|
|
193401
|
+
}
|
|
193402
|
+
drawable.updateCPURenderAttributes();
|
|
193403
|
+
return drawable.isTouching([x, y]);
|
|
193404
|
+
}
|
|
193405
|
+
|
|
193356
193406
|
/**
|
|
193357
193407
|
* Detect which sprite, if any, is at the given location.
|
|
193358
193408
|
* This function will pick all drawables that are visible, unless specific
|