Compare commits
17 Commits
greenkeepe
...
greenkeepe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d4c72c028 | ||
|
|
5f9ca5b4fa | ||
|
|
834c5eb984 | ||
|
|
ef91583603 | ||
|
|
3e084dfe26 | ||
|
|
fdea47d31c | ||
|
|
24737982f0 | ||
|
|
cfaadfcc75 | ||
|
|
997062c851 | ||
|
|
90b1c47c3e | ||
|
|
550cd7aacf | ||
|
|
9b5a33ce3c | ||
|
|
2eca0a8326 | ||
|
|
7d55dec445 | ||
|
|
24c28cbb19 | ||
|
|
54a2aaf9ba | ||
|
|
32bd87933a |
10
package.json
10
package.json
@@ -34,15 +34,15 @@
|
||||
"docdash": "^0.4.0",
|
||||
"eslint": "^4.6.1",
|
||||
"eslint-config-scratch": "^5.0.0",
|
||||
"gh-pages": "^1.0.0",
|
||||
"gh-pages": "^2.0.1",
|
||||
"jsdoc": "^3.5.5",
|
||||
"json": "^9.0.4",
|
||||
"scratch-vm": "0.2.0-prerelease.20180802142248",
|
||||
"scratch-vm": "0.2.0-prerelease.20180824135031",
|
||||
"tap": "^11.0.0",
|
||||
"travis-after-all": "^1.4.4",
|
||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||
"webpack": "^4.8.0",
|
||||
"webpack-cli": "^2.0.15",
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-dev-server": "^3.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -52,8 +52,8 @@
|
||||
"linebreak": "0.3.0",
|
||||
"minilog": "3.1.0",
|
||||
"raw-loader": "^0.5.1",
|
||||
"scratch-storage": "^0.4.0",
|
||||
"scratch-svg-renderer": "0.2.0-prerelease.20180817005452",
|
||||
"scratch-storage": "^1.0.0",
|
||||
"scratch-svg-renderer": "0.2.0-prerelease.20180926143036",
|
||||
"twgl.js": "4.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,9 @@ class RenderWebGL extends EventEmitter {
|
||||
/** @type {function} */
|
||||
this._exitRegion = null;
|
||||
|
||||
/** @type {Array.<snapshotCallback>} */
|
||||
this._snapshotCallbacks = [];
|
||||
|
||||
this._svgTextBubble = new SVGTextBubble();
|
||||
|
||||
this._createGeometry();
|
||||
@@ -201,6 +204,13 @@ class RenderWebGL extends EventEmitter {
|
||||
return this._gl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {HTMLCanvasElement} the canvas of the WebGL rendering context associated with this renderer.
|
||||
*/
|
||||
get canvas () {
|
||||
return this._gl && this._gl.canvas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the physical size of the stage in device-independent pixels.
|
||||
* This will be multiplied by the device's pixel ratio on high-DPI displays.
|
||||
@@ -589,6 +599,11 @@ class RenderWebGL extends EventEmitter {
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
this._drawThese(this._drawList, ShaderManager.DRAW_MODE.default, this._projection);
|
||||
if (this._snapshotCallbacks.length > 0) {
|
||||
const snapshot = gl.canvas.toDataURL();
|
||||
this._snapshotCallbacks.forEach(cb => cb(snapshot));
|
||||
this._snapshotCallbacks = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -953,7 +968,12 @@ class RenderWebGL extends EventEmitter {
|
||||
if (candidateIDs.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bounds = this.clientSpaceToScratchBounds(centerX, centerY, touchWidth, touchHeight);
|
||||
if (bounds.left === -Infinity || bounds.bottom === -Infinity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const hits = [];
|
||||
const worldPos = twgl.v3.create(0, 0, 0);
|
||||
// Iterate over the scratch pixels and check if any candidate can be
|
||||
@@ -1704,6 +1724,18 @@ class RenderWebGL extends EventEmitter {
|
||||
dst[2] += blendAlpha * 255;
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @callback RenderWebGL#snapshotCallback
|
||||
* @param {string} dataURI Data URI of the snapshot of the renderer
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {snapshotCallback} callback Function called in the next frame with the snapshot data
|
||||
*/
|
||||
requestSnapshot (callback) {
|
||||
this._snapshotCallbacks.push(callback);
|
||||
}
|
||||
}
|
||||
|
||||
// :3
|
||||
|
||||
Reference in New Issue
Block a user