@wodzik/cubecore 0.1.2 → 0.1.4
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/package.json +4 -2
- package/render/renderer.js +7 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.4",
|
|
7
7
|
"description": "A 3×3×3 cube library for the web, built around smart (Bluetooth) cubes: state, notation, methods, solvers and scrambles, a three.js renderer with skins, pictures, web components, React bindings.",
|
|
8
8
|
"license": "MPL-2.0",
|
|
9
9
|
"author": "Tomasz Wodzikowski <wodziszczakow@gmail.com>",
|
|
@@ -106,7 +106,9 @@
|
|
|
106
106
|
},
|
|
107
107
|
"sideEffects": [
|
|
108
108
|
"./element/index.js",
|
|
109
|
-
"./react/index.js"
|
|
109
|
+
"./react/index.js",
|
|
110
|
+
"./skin/attachments.js",
|
|
111
|
+
"./bluetooth/vendor/**"
|
|
110
112
|
],
|
|
111
113
|
"dependencies": {
|
|
112
114
|
"aes-js": "^3.1.2",
|
package/render/renderer.js
CHANGED
|
@@ -223,12 +223,18 @@ export class CubeRenderer {
|
|
|
223
223
|
disposeArrows(this.arrows.group);
|
|
224
224
|
this.resizeObserver.disconnect();
|
|
225
225
|
this.finishAll(true);
|
|
226
|
-
|
|
226
|
+
// Scene resources first, while the context is still there to free them in…
|
|
227
227
|
for (const m of this.materials.values())
|
|
228
228
|
m.dispose();
|
|
229
229
|
this.envMap?.dispose();
|
|
230
230
|
this.kit?.dispose();
|
|
231
231
|
this.attachments?.dispose();
|
|
232
|
+
this.renderer.dispose();
|
|
233
|
+
// …then give the WebGL context back now. dispose() alone leaves it alive
|
|
234
|
+
// until garbage collection, and a page that mounts cubes as they scroll
|
|
235
|
+
// into view soon passes the browser's limit (~16): "Too many active WebGL
|
|
236
|
+
// contexts. Oldest context will be lost."
|
|
237
|
+
this.renderer.forceContextLoss();
|
|
232
238
|
this.canvas.remove();
|
|
233
239
|
}
|
|
234
240
|
// ─── scene ───
|