@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.
@@ -34508,6 +34508,56 @@ var RenderWebGL = /*#__PURE__*/function (_EventEmitter) {
34508
34508
  return false;
34509
34509
  }
34510
34510
 
34511
+ /**
34512
+ * Determine if the drawable is touching a rectangle.
34513
+ *
34514
+ * @param {int} drawableID The ID of the drawable to check.
34515
+ * @param {int} left - The left X coordinate of the rectangle.
34516
+ * @param {int} top - The top Y coordinate of the rectangle.
34517
+ * @param {int} right - The right X coordinate of the rectangle.
34518
+ * @param {int} bottom - The bottom Y coordinate of the rectangle.
34519
+ * @returns {boolean} If the drawable has any pixels that would draw in the rectangle area
34520
+ */
34521
+ }, {
34522
+ key: "drawableTouchingScratchRect",
34523
+ value: function drawableTouchingScratchRect(drawableID, left, top, right, bottom) {
34524
+ var drawable = this._allDrawables[drawableID];
34525
+ if (!drawable) {
34526
+ return false;
34527
+ }
34528
+ var bounds = new Rectangle();
34529
+ bounds.initFromBounds(left, right, bottom, top);
34530
+ var worldPos = twgl.v3.create();
34531
+ drawable.updateCPURenderAttributes();
34532
+ for (worldPos[1] = bounds.bottom; worldPos[1] <= bounds.top; worldPos[1]++) {
34533
+ for (worldPos[0] = bounds.left; worldPos[0] <= bounds.right; worldPos[0]++) {
34534
+ if (drawable.isTouching(worldPos)) {
34535
+ return true;
34536
+ }
34537
+ }
34538
+ }
34539
+ return false;
34540
+ }
34541
+
34542
+ /**
34543
+ * Determine if the drawable is touching a point in the Scratch coordinate system
34544
+ *
34545
+ * @param {int} drawableID The ID of the drawable to check.
34546
+ * @param {int} x The x coordinate of the point.
34547
+ * @param {int} y The y coordinate of the point.
34548
+ * @returns {boolean} If the drawable is touching the point
34549
+ */
34550
+ }, {
34551
+ key: "drawableTouchingScratchPoint",
34552
+ value: function drawableTouchingScratchPoint(drawableID, x, y) {
34553
+ var drawable = this._allDrawables[drawableID];
34554
+ if (!drawable) {
34555
+ return false;
34556
+ }
34557
+ drawable.updateCPURenderAttributes();
34558
+ return drawable.isTouching([x, y]);
34559
+ }
34560
+
34511
34561
  /**
34512
34562
  * Detect which sprite, if any, is at the given location.
34513
34563
  * This function will pick all drawables that are visible, unless specific