@luma.gl/engine 9.4.0-beta.7 → 9.4.1
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/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +19 -6
- package/dist/animation-loop/animation-loop.js.map +1 -1
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +3 -1
- package/dist/animation-loop/make-animation-loop.js.map +1 -1
- package/dist/dist.dev.js +19 -7
- package/dist/dist.min.js +4 -4
- package/dist/index.cjs +19 -7
- package/dist/index.cjs.map +1 -1
- package/package.json +4 -4
- package/src/animation-loop/animation-loop.ts +20 -7
- package/src/animation-loop/make-animation-loop.ts +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1251,8 +1251,11 @@ var AnimationLoop = class _AnimationLoop {
|
|
|
1251
1251
|
this.destroy();
|
|
1252
1252
|
}
|
|
1253
1253
|
reportError(error) {
|
|
1254
|
-
this.props.onError(error);
|
|
1255
1254
|
this._error = error;
|
|
1255
|
+
this.props.onError(error);
|
|
1256
|
+
if (this.props.onError === _AnimationLoop.defaultAnimationLoopProps.onError && typeof window !== "undefined" && typeof ErrorEvent !== "undefined") {
|
|
1257
|
+
window.dispatchEvent(new ErrorEvent("error", { error, message: error.message }));
|
|
1258
|
+
}
|
|
1256
1259
|
}
|
|
1257
1260
|
/** Flags this animation loop as needing redraw */
|
|
1258
1261
|
setNeedsRedraw(reason) {
|
|
@@ -1318,14 +1321,15 @@ var AnimationLoop = class _AnimationLoop {
|
|
|
1318
1321
|
/** Stops a render loop if already running, finalizing */
|
|
1319
1322
|
stop() {
|
|
1320
1323
|
if (this._running) {
|
|
1321
|
-
|
|
1322
|
-
this.props.onFinalize(this.animationProps);
|
|
1323
|
-
}
|
|
1324
|
+
const animationProps = this.animationProps;
|
|
1324
1325
|
this._cancelAnimationFrame();
|
|
1325
1326
|
this._nextFramePromise = null;
|
|
1326
1327
|
this._resolveNextFrame = null;
|
|
1327
1328
|
this._running = false;
|
|
1328
1329
|
this._lastFrameTime = 0;
|
|
1330
|
+
if (animationProps) {
|
|
1331
|
+
this.props.onFinalize(animationProps);
|
|
1332
|
+
}
|
|
1329
1333
|
}
|
|
1330
1334
|
return this;
|
|
1331
1335
|
}
|
|
@@ -1415,8 +1419,14 @@ var AnimationLoop = class _AnimationLoop {
|
|
|
1415
1419
|
if (!this._running) {
|
|
1416
1420
|
return;
|
|
1417
1421
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1422
|
+
try {
|
|
1423
|
+
this.redraw(time, animationFrame ?? null);
|
|
1424
|
+
this._requestAnimationFrame();
|
|
1425
|
+
} catch (error) {
|
|
1426
|
+
const renderError = error instanceof Error ? error : new Error(String(error));
|
|
1427
|
+
this.reportError(renderError);
|
|
1428
|
+
this.stop();
|
|
1429
|
+
}
|
|
1420
1430
|
}
|
|
1421
1431
|
// Called on each frame, can be overridden to call onRender multiple times
|
|
1422
1432
|
// to support e.g. stereoscopic rendering
|
|
@@ -1645,7 +1655,9 @@ function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
|
|
|
1645
1655
|
} catch (error) {
|
|
1646
1656
|
console.error(error);
|
|
1647
1657
|
renderLoop = null;
|
|
1648
|
-
|
|
1658
|
+
const initializationError = error instanceof Error ? error : new Error(String(error));
|
|
1659
|
+
setError(animationProps.animationLoop.device, initializationError);
|
|
1660
|
+
animationProps.animationLoop.reportError(initializationError);
|
|
1649
1661
|
animationProps.animationLoop.stop();
|
|
1650
1662
|
return null;
|
|
1651
1663
|
}
|