diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index 9af2f63f6..4786c4bff 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -63,7 +63,7 @@ function WebPlayer(props: any) { const { firstVisualEvent: visualOffset, messagesProcessed } = contextValue.store?.get() || {}; React.useEffect(() => { - if ((messagesProcessed && session.events.length > 0) || session.errors.length > 0) { + if (messagesProcessed && (session.events.length > 0 || session.errors.length > 0)) { contextValue.player?.updateLists?.(session); } }, [session.events, session.errors, contextValue.player, messagesProcessed]); @@ -137,7 +137,7 @@ function WebPlayer(props: any) { tabs={TABS} fullscreen={fullscreen} /> - {/* @ts-ignore */} + {/* @ts-ignore */} {contextValue.player ? ( { @@ -66,11 +56,7 @@ export default class MouseTrail { }; leaveTrail = (x: number, y: number) => { - if (this.currentFrame === this.drawOnFrame) { - this.addPoint(x + 7, y + 7); - this.currentFrame = 0; - } - this.currentFrame++; + this.addPoint(x + 7, y + 7); }; init = () => { @@ -81,46 +67,27 @@ export default class MouseTrail { } }; - createSwipeTrail = ({ x, y, direction }: SwipeEvent) => { - const startCoords = this.calculateTrail({ x, y, direction }); - this.addPoint(startCoords.x, startCoords.y); - this.addPoint(x, y); - } - - calculateTrail = ({ x, y, direction }: SwipeEvent) => { - switch (direction) { - case 'up': - return { x, y: y - 20 }; - case 'down': - return { x, y: y + 20 }; - case 'left': - return { x: x - 20, y }; - case 'right': - return { x: x + 20, y }; - default: - return { x, y }; - } - } - animatePoints = () => { this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height); const duration = (this.lineDuration * 1000) / 60; + const points = this.points; let point, lastPoint; - for (let i = 0; i < this.points.length; i++) { - point = this.points[i]; + for (let i = 0; i < points.length; i++) { + point = points[i]; - if (this.points[i - 1] !== undefined) { - lastPoint = this.points[i - 1]; + if (points[i - 1] !== undefined) { + lastPoint = points[i - 1]; } else { - lastPoint = this.points[i]; + lastPoint = points[i]; } point.lifetime! += 1; + // 3500/60 = 58.333333333333336 if (point.lifetime! > duration) { - this.points.splice(i, 1); + points.splice(i, 1); continue; }