From eef6a3c887d16a71a1acff97ede9764a74b9a7f4 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 18 Apr 2026 20:27:13 +0200 Subject: [PATCH] Add terrain brush functionality in ViewportHost --- src/viewport-three/viewport-host.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/viewport-three/viewport-host.ts b/src/viewport-three/viewport-host.ts index 38f01820..c46d3ef9 100644 --- a/src/viewport-three/viewport-host.ts +++ b/src/viewport-three/viewport-host.ts @@ -7909,6 +7909,10 @@ export class ViewportHost { return; } + if (this.beginTerrainBrushStroke(event)) { + return; + } + const candidates = this.getSelectionCandidates(event); if (candidates.length === 0) { @@ -8004,6 +8008,20 @@ export class ViewportHost { return; } + if (this.continueTerrainBrushStroke(event)) { + return; + } + + if (this.isTerrainBrushActive()) { + this.setHoveredSelection({ + kind: "none" + }); + this.setTerrainBrushHover( + this.getTerrainBrushHitAtClientPosition(event.clientX, event.clientY) + ); + return; + } + if (this.toolMode === "select") { const hoveredCandidate = this.getSelectionCandidates(event)[0] ?.selection ?? { kind: "none" }; @@ -8058,6 +8076,10 @@ export class ViewportHost { return; } + if (this.finishTerrainBrushStroke(event)) { + return; + } + if (this.activeCameraDragPointerId !== event.pointerId) { return; } @@ -8079,6 +8101,7 @@ export class ViewportHost { this.setHoveredSelection({ kind: "none" }); + this.setTerrainBrushHover(null); // Keep the shared creation preview alive across panel boundaries; the next // viewport panel will update it as the pointer continues moving.