fix: only on tick
This commit is contained in:
parent
48a45533f5
commit
a58e1b6b89
|
@ -7,6 +7,7 @@ export default class Interpolator {
|
||||||
accept(state) {
|
accept(state) {
|
||||||
const packet = state;
|
const packet = state;
|
||||||
if ('Tick' !== packet.type) {
|
if ('Tick' !== packet.type) {
|
||||||
|
postMessage(packet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.penultimate = this.latest;
|
this.penultimate = this.latest;
|
||||||
|
@ -93,7 +94,7 @@ const interpolate = (now) => {
|
||||||
|
|
||||||
onmessage = async (event) => {
|
onmessage = async (event) => {
|
||||||
interpolator.accept(event.data);
|
interpolator.accept(event.data);
|
||||||
if (interpolator.penultimate) {
|
if (interpolator.penultimate && 'Tick' === event.data.type) {
|
||||||
postMessage({
|
postMessage({
|
||||||
type: 'Tick',
|
type: 'Tick',
|
||||||
payload: {
|
payload: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user