@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scratch/scratch-render",
|
|
3
|
-
"version": "12.0.0-react-18",
|
|
3
|
+
"version": "12.0.0-react-18-face-sensing",
|
|
4
4
|
"description": "WebGL Renderer for Scratch 3.0",
|
|
5
5
|
"author": "Massachusetts Institute of Technology",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"iOS >= 8"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@scratch/scratch-svg-renderer": "12.0.0-react-18",
|
|
50
|
+
"@scratch/scratch-svg-renderer": "12.0.0-react-18-face-sensing",
|
|
51
51
|
"grapheme-breaker": "0.3.2",
|
|
52
52
|
"hull.js": "0.2.10",
|
|
53
53
|
"ify-loader": "1.1.0",
|
|
@@ -60,29 +60,29 @@
|
|
|
60
60
|
"scratch-render-fonts": "^1.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@babel/core": "7.28.
|
|
63
|
+
"@babel/core": "7.28.3",
|
|
64
64
|
"@babel/eslint-parser": "7.28.0",
|
|
65
65
|
"@babel/polyfill": "7.12.1",
|
|
66
|
-
"@babel/preset-env": "7.28.
|
|
67
|
-
"@scratch/scratch-vm": "12.0.0-react-18",
|
|
66
|
+
"@babel/preset-env": "7.28.3",
|
|
67
|
+
"@scratch/scratch-vm": "12.0.0-react-18-face-sensing",
|
|
68
68
|
"babel-loader": "9.2.1",
|
|
69
69
|
"copy-webpack-plugin": "6.4.1",
|
|
70
70
|
"docdash": "0.4.0",
|
|
71
71
|
"eslint": "8.57.1",
|
|
72
72
|
"eslint-config-scratch": "9.0.9",
|
|
73
73
|
"gh-pages": "1.2.0",
|
|
74
|
-
"html-webpack-plugin": "5.6.
|
|
74
|
+
"html-webpack-plugin": "5.6.4",
|
|
75
75
|
"jsdoc": "3.6.11",
|
|
76
76
|
"json": "9.0.6",
|
|
77
77
|
"playwright-chromium": "1.54.2",
|
|
78
|
-
"scratch-render-fonts": "1.0.
|
|
78
|
+
"scratch-render-fonts": "1.0.223",
|
|
79
79
|
"scratch-semantic-release-config": "3.0.0",
|
|
80
|
-
"scratch-storage": "4.0.
|
|
80
|
+
"scratch-storage": "4.0.214",
|
|
81
81
|
"scratch-webpack-configuration": "3.0.0",
|
|
82
82
|
"semantic-release": "19.0.5",
|
|
83
83
|
"tap": "16.3.10",
|
|
84
84
|
"terser-webpack-plugin": "5.3.14",
|
|
85
|
-
"webpack": "5.101.
|
|
85
|
+
"webpack": "5.101.2",
|
|
86
86
|
"webpack-cli": "5.1.4",
|
|
87
87
|
"webpack-dev-server": "5.2.2"
|
|
88
88
|
}
|
package/src/RenderWebGL.js
CHANGED
|
@@ -1069,6 +1069,54 @@ class RenderWebGL extends EventEmitter {
|
|
|
1069
1069
|
return false;
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
|
+
/**
|
|
1073
|
+
* Determine if the drawable is touching a rectangle.
|
|
1074
|
+
*
|
|
1075
|
+
* @param {int} drawableID The ID of the drawable to check.
|
|
1076
|
+
* @param {int} left - The left X coordinate of the rectangle.
|
|
1077
|
+
* @param {int} top - The top Y coordinate of the rectangle.
|
|
1078
|
+
* @param {int} right - The right X coordinate of the rectangle.
|
|
1079
|
+
* @param {int} bottom - The bottom Y coordinate of the rectangle.
|
|
1080
|
+
* @returns {boolean} If the drawable has any pixels that would draw in the rectangle area
|
|
1081
|
+
*/
|
|
1082
|
+
drawableTouchingScratchRect (drawableID, left, top, right, bottom) {
|
|
1083
|
+
const drawable = this._allDrawables[drawableID];
|
|
1084
|
+
if (!drawable) {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
const bounds = new Rectangle();
|
|
1088
|
+
bounds.initFromBounds(left, right, bottom, top);
|
|
1089
|
+
const worldPos = twgl.v3.create();
|
|
1090
|
+
|
|
1091
|
+
drawable.updateCPURenderAttributes();
|
|
1092
|
+
|
|
1093
|
+
for (worldPos[1] = bounds.bottom; worldPos[1] <= bounds.top; worldPos[1]++) {
|
|
1094
|
+
for (worldPos[0] = bounds.left; worldPos[0] <= bounds.right; worldPos[0]++) {
|
|
1095
|
+
if (drawable.isTouching(worldPos)) {
|
|
1096
|
+
return true;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return false;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Determine if the drawable is touching a point in the Scratch coordinate system
|
|
1105
|
+
*
|
|
1106
|
+
* @param {int} drawableID The ID of the drawable to check.
|
|
1107
|
+
* @param {int} x The x coordinate of the point.
|
|
1108
|
+
* @param {int} y The y coordinate of the point.
|
|
1109
|
+
* @returns {boolean} If the drawable is touching the point
|
|
1110
|
+
*/
|
|
1111
|
+
drawableTouchingScratchPoint (drawableID, x, y) {
|
|
1112
|
+
const drawable = this._allDrawables[drawableID];
|
|
1113
|
+
if (!drawable) {
|
|
1114
|
+
return false;
|
|
1115
|
+
}
|
|
1116
|
+
drawable.updateCPURenderAttributes();
|
|
1117
|
+
return drawable.isTouching([x, y]);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1072
1120
|
/**
|
|
1073
1121
|
* Detect which sprite, if any, is at the given location.
|
|
1074
1122
|
* This function will pick all drawables that are visible, unless specific
|