-
Notifications
You must be signed in to change notification settings - Fork 0
Fix carving tool hallway gaps and consolidate strokes #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…nability Refactor main orchestration into modular helpers
…, repoint ecs-lib
…n-simulation-iwvzyn Render analytic demo dungeon with FOV overlays
…y-items Show pickup tooltip within reach
…-mechanics Improve overlay interactions and movement
…iptref Refactor rules scripting to use shared ScriptRef
…th-emissive-torches Add emissive torch lighting with occlusion
…add-lightning-spell-mechanic Add lightning gesture casting and improve movement
wooden bow + projectile
…hanics Fix touch targeting and ranged ammo handling
…ctional-movement Add grid-based movement and wall glyph rendering
…le-for-passageway Add demo entry door and shrink player collision radius
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds capsule consolidation functionality to the world carving editor, which merges consecutive, aligned capsule primitives created during circle brush strokes to optimize the geometry representation.
Key Changes:
- Implements a new
consolidateCapsules()function that merges consecutive capsules with matching properties, similar directions, and touching endpoints - Automatically applies consolidation after circle brush strokes and when deserializing saved worlds
- Enhances the pointerup handler to add final segments, release pointer capture properly, and trigger consolidation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| window.addEventListener('pointerup',()=>{ isDragging=false; }); | ||
| window.addEventListener('pointerup',e=>{ if(!isDragging) return; isDragging=false; if(canvas.releasePointerCapture){ try{ canvas.releasePointerCapture(e.pointerId);}catch(err){/* ignore */} } | ||
| if(ui.mode.value!=='carve') return; const [x,y]=canvasToWorld(e); const dx=x-lastX,dy=y-lastY; const dist=Math.hypot(dx,dy); if(dist>0.01){ addSegment(lastX,lastY,x,y,e); lastX=x; lastY=y; } | ||
| if(ui.brush.value==='circle'){ if(Kernel.consolidateCapsules()) undoStack.length=Kernel.carves.length; } else { undoStack.length=Kernel.carves.length; } |
Copilot
AI
Nov 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The undo stack synchronization is performed in both branches of the conditional, making the code redundant. Consider simplifying to:
if(ui.brush.value==='circle') Kernel.consolidateCapsules();
undoStack.length=Kernel.carves.length;This makes the intent clearer: consolidate capsules for circle brush, then always sync the undo stack length.
| if(ui.brush.value==='circle'){ if(Kernel.consolidateCapsules()) undoStack.length=Kernel.carves.length; } else { undoStack.length=Kernel.carves.length; } | |
| if(ui.brush.value==='circle') Kernel.consolidateCapsules(); | |
| undoStack.length=Kernel.carves.length; |
Summary
Testing
Codex Task