Skip to content

feat: implement entity selection and highlighting system#51

Merged
zuhanit merged 3 commits intomasterfrom
feat/viewport-selection
Jun 27, 2025
Merged

feat: implement entity selection and highlighting system#51
zuhanit merged 3 commits intomasterfrom
feat/viewport-selection

Conversation

@zuhanit
Copy link
Copy Markdown
Owner

@zuhanit zuhanit commented Jun 27, 2025

Summary

  • Add entity click detection and selection functionality in viewport
  • Implement green selection highlight overlay with proper rendering
  • Add keyboard delete functionality (Delete key) for selected entities
  • Fix entity deletion to automatically clear selection when deleted entity is selected

Key Changes

  • Entity Selection: Click detection with proper coordinate transformation and hit testing
  • Visual Feedback: Green stroke highlight overlay for selected entities that properly appears/disappears
  • Keyboard Controls: Delete key support with tabIndex focus management
  • State Management: Improved entity store with proper null handling and selection clearing
  • Canvas Rendering: Fixed layering and clearing issues for proper highlight display
  • Transform Schema: Updated size structure from width/height to left/top/right/bottom bounds for better collision detection

Technical Improvements

  • Centered unit and sprite rendering at transform positions
  • Fixed canvas clearing and re-rendering pipeline
  • Improved drag vs click detection in viewport interactions
  • Added entity utility functions for position-based lookups
  • Enhanced state synchronization between map and entity stores

Test Plan

  • Test entity selection by clicking on units in viewport
  • Verify green highlight appears around selected entity
  • Test highlight disappears when clicking elsewhere
  • Test Delete key removes selected entity and clears highlight
  • Verify drag vs click distinction works properly
  • Test multiple entity selection scenarios

🤖 Generated with Claude Code

zuhanit and others added 3 commits June 28, 2025 01:48
- Add entity click detection and selection in viewport
- Implement green selection highlight overlay for selected entities
- Add keyboard delete functionality (Delete key) for selected entities
- Fix entity deletion to clear selection when deleted entity is selected
- Improve canvas rendering with proper clearing and layering
- Update transform size structure from width/height to left/top/right/bottom bounds
- Center unit and sprite rendering at their transform positions
- Add tabIndex to canvas for keyboard event handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@zuhanit zuhanit merged commit 2602f7e into master Jun 27, 2025
3 checks passed
@zuhanit zuhanit deleted the feat/viewport-selection branch March 26, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant