@vectojs/core 0.2.1 → 0.2.2
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/index.js +21 -12
- package/dist/index.mjs +21 -12
- package/dist/tree/Scene.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -656,6 +656,17 @@ var Scene = (_class2 = class _Scene {
|
|
|
656
656
|
this.caretBlinkTimer = null;
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
+
/**
|
|
660
|
+
* Manually advance the scene clock by `dt` milliseconds and render synchronously.
|
|
661
|
+
* Essential for deterministic rendering (e.g. video export).
|
|
662
|
+
* Note: You should call `scene.stop()` before using this to avoid conflict with the rAF loop.
|
|
663
|
+
*/
|
|
664
|
+
step(dt) {
|
|
665
|
+
const time = this.lastTime + dt;
|
|
666
|
+
this.lastTime = time;
|
|
667
|
+
this.render(this.renderer, dt, time);
|
|
668
|
+
this.dirty = false;
|
|
669
|
+
}
|
|
659
670
|
/**
|
|
660
671
|
* Mark the scene as needing a redraw on the next frame.
|
|
661
672
|
*
|
|
@@ -1109,19 +1120,17 @@ var Scene = (_class2 = class _Scene {
|
|
|
1109
1120
|
}
|
|
1110
1121
|
this.render(this.renderer, dt, time);
|
|
1111
1122
|
const hasActiveAnimation = this.hasAnyPendingAnimation(this.root) || this.hasAnyPendingAnimation(this.overlayRoot);
|
|
1112
|
-
|
|
1123
|
+
const hasInteractive = this.hasAnyInteractive(this.root) || this.hasAnyInteractive(this.overlayRoot);
|
|
1124
|
+
const shouldSyncInterval = this.a11ySyncInterval <= 0 || time - this.lastA11ySync >= this.a11ySyncInterval;
|
|
1125
|
+
if ((hasInteractive || this.a11yElements.size > 0) && (shouldSyncInterval || this.a11yPendingSyncAfterAnimation)) {
|
|
1126
|
+
this.lastA11ySync = time;
|
|
1127
|
+
if (hasInteractive) {
|
|
1128
|
+
this.syncA11y(this.root);
|
|
1129
|
+
}
|
|
1130
|
+
this.enforceA11yDomOrder();
|
|
1131
|
+
this.a11yPendingSyncAfterAnimation = hasActiveAnimation;
|
|
1132
|
+
} else if (hasActiveAnimation) {
|
|
1113
1133
|
this.a11yPendingSyncAfterAnimation = true;
|
|
1114
|
-
} else {
|
|
1115
|
-
const hasInteractive = this.hasAnyInteractive(this.root) || this.hasAnyInteractive(this.overlayRoot);
|
|
1116
|
-
const shouldSyncInterval = this.a11ySyncInterval <= 0 || time - this.lastA11ySync >= this.a11ySyncInterval;
|
|
1117
|
-
if ((hasInteractive || this.a11yElements.size > 0) && (shouldSyncInterval || this.a11yPendingSyncAfterAnimation)) {
|
|
1118
|
-
this.lastA11ySync = time;
|
|
1119
|
-
if (hasInteractive) {
|
|
1120
|
-
this.syncA11y(this.root);
|
|
1121
|
-
}
|
|
1122
|
-
this.enforceA11yDomOrder();
|
|
1123
|
-
this.a11yPendingSyncAfterAnimation = false;
|
|
1124
|
-
}
|
|
1125
1134
|
}
|
|
1126
1135
|
this.dirty = false;
|
|
1127
1136
|
this.scheduleFrame();
|
package/dist/index.mjs
CHANGED
|
@@ -656,6 +656,17 @@ var Scene = class _Scene {
|
|
|
656
656
|
this.caretBlinkTimer = null;
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
+
/**
|
|
660
|
+
* Manually advance the scene clock by `dt` milliseconds and render synchronously.
|
|
661
|
+
* Essential for deterministic rendering (e.g. video export).
|
|
662
|
+
* Note: You should call `scene.stop()` before using this to avoid conflict with the rAF loop.
|
|
663
|
+
*/
|
|
664
|
+
step(dt) {
|
|
665
|
+
const time = this.lastTime + dt;
|
|
666
|
+
this.lastTime = time;
|
|
667
|
+
this.render(this.renderer, dt, time);
|
|
668
|
+
this.dirty = false;
|
|
669
|
+
}
|
|
659
670
|
/**
|
|
660
671
|
* Mark the scene as needing a redraw on the next frame.
|
|
661
672
|
*
|
|
@@ -1109,19 +1120,17 @@ var Scene = class _Scene {
|
|
|
1109
1120
|
}
|
|
1110
1121
|
this.render(this.renderer, dt, time);
|
|
1111
1122
|
const hasActiveAnimation = this.hasAnyPendingAnimation(this.root) || this.hasAnyPendingAnimation(this.overlayRoot);
|
|
1112
|
-
|
|
1123
|
+
const hasInteractive = this.hasAnyInteractive(this.root) || this.hasAnyInteractive(this.overlayRoot);
|
|
1124
|
+
const shouldSyncInterval = this.a11ySyncInterval <= 0 || time - this.lastA11ySync >= this.a11ySyncInterval;
|
|
1125
|
+
if ((hasInteractive || this.a11yElements.size > 0) && (shouldSyncInterval || this.a11yPendingSyncAfterAnimation)) {
|
|
1126
|
+
this.lastA11ySync = time;
|
|
1127
|
+
if (hasInteractive) {
|
|
1128
|
+
this.syncA11y(this.root);
|
|
1129
|
+
}
|
|
1130
|
+
this.enforceA11yDomOrder();
|
|
1131
|
+
this.a11yPendingSyncAfterAnimation = hasActiveAnimation;
|
|
1132
|
+
} else if (hasActiveAnimation) {
|
|
1113
1133
|
this.a11yPendingSyncAfterAnimation = true;
|
|
1114
|
-
} else {
|
|
1115
|
-
const hasInteractive = this.hasAnyInteractive(this.root) || this.hasAnyInteractive(this.overlayRoot);
|
|
1116
|
-
const shouldSyncInterval = this.a11ySyncInterval <= 0 || time - this.lastA11ySync >= this.a11ySyncInterval;
|
|
1117
|
-
if ((hasInteractive || this.a11yElements.size > 0) && (shouldSyncInterval || this.a11yPendingSyncAfterAnimation)) {
|
|
1118
|
-
this.lastA11ySync = time;
|
|
1119
|
-
if (hasInteractive) {
|
|
1120
|
-
this.syncA11y(this.root);
|
|
1121
|
-
}
|
|
1122
|
-
this.enforceA11yDomOrder();
|
|
1123
|
-
this.a11yPendingSyncAfterAnimation = false;
|
|
1124
|
-
}
|
|
1125
1134
|
}
|
|
1126
1135
|
this.dirty = false;
|
|
1127
1136
|
this.scheduleFrame();
|
package/dist/tree/Scene.d.ts
CHANGED
|
@@ -243,6 +243,12 @@ export declare class Scene {
|
|
|
243
243
|
* Call {@link start} again to resume rendering.
|
|
244
244
|
*/
|
|
245
245
|
stop(): void;
|
|
246
|
+
/**
|
|
247
|
+
* Manually advance the scene clock by `dt` milliseconds and render synchronously.
|
|
248
|
+
* Essential for deterministic rendering (e.g. video export).
|
|
249
|
+
* Note: You should call `scene.stop()` before using this to avoid conflict with the rAF loop.
|
|
250
|
+
*/
|
|
251
|
+
step(dt: number): void;
|
|
246
252
|
/**
|
|
247
253
|
* Mark the scene as needing a redraw on the next frame.
|
|
248
254
|
*
|