From 9c7b91000fafcfb09e70a52da250d1bd82b6fea3 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Mon, 1 May 2023 13:40:39 +0100 Subject: [PATCH] Fix brush --- src/game-loop/game-loop.ts | 4 ++++ src/pipelines/brush/brush-pipeline.ts | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/game-loop/game-loop.ts b/src/game-loop/game-loop.ts index 8763c1e..543786e 100644 --- a/src/game-loop/game-loop.ts +++ b/src/game-loop/game-loop.ts @@ -150,6 +150,10 @@ export default class GameLoop { this.device.queue.submit([commandEncoder.finish()]); + if (!this.isSwipeActive) { + this.brushPipeline.clearSwipes(); + } + if (settings.simulatedDelayMs > 0) { await sleep(settings.simulatedDelayMs); } diff --git a/src/pipelines/brush/brush-pipeline.ts b/src/pipelines/brush/brush-pipeline.ts index 9af60ab..8828bf0 100644 --- a/src/pipelines/brush/brush-pipeline.ts +++ b/src/pipelines/brush/brush-pipeline.ts @@ -126,12 +126,12 @@ export class BrushPipeline { new Float32Array([brushWidth / 2, brushWidthRandomness]) ); - if (this.linePoints.length === 0) { + this.actualPoints = this.linePoints.slice(); + + if (this.actualPoints.length === 0) { return; } - this.actualPoints = this.linePoints.slice(); - if (this.linePoints.length === 1) { this.actualPoints.push(this.linePoints[0]); // allow single point swipes }