Skip to content

Fix view cone alignment when agent markers resize - #178

Merged
SunkenInTime merged 2 commits into
mainfrom
fix/view-cone-marker-anchor
Sep 22, 2026
Merged

SunkenInTime merged 2 commits into
mainfrom
fix/view-cone-marker-anchor

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Changing agent marker size kept the icon centered but moved the position used to calculate its cone. This shifted wall cutouts away from the map artwork, producing visible notches around Haven's B entrance. Animated agent paths also mixed resized marker anchors with saved positions.

Use the existing stored agent anchor for attached cones, drag previews, elevation menus, sightline reports, and conversion between saved positions and animated path centers. Marker size remains a visual layout setting. The path planner and transition renderer now agree on the same center.

Validation:

  • 45 focused tests pass with native acceleration, covering Haven resizing, dragging, transition previews and paths, navigation, sightline reports, and SVG-height app integration.
  • The Haven regression checks identical rendered pixels across marker sizes on both sides. The new path regression checks both the marker center and cone origin at the start, midpoint, and end across four sizes and both sides.
  • Both regressions failed before their fixes. The Haven regression also passes with Dart rendering.
  • Analysis of the changed files passes with no issues.

Release is held for more changes.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d6b8069f-95cd-46aa-9ceb-b1c58aea48cb

📥 Commits

Reviewing files that changed from the base of the PR and between 490f3e0 and e447d7e.

📒 Files selected for processing (4)
  • lib/page_transition/agent_path.dart
  • lib/widgets/page_transition_overlay.dart
  • test/navigation_geometry_provider_test.dart
  • test/page_transition_overlay_test.dart

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 33b09838-c26d-4a8c-8e87-5da5ebcebd8d

📥 Commits

Reviewing files that changed from the base of the PR and between 8ae7af3 and 490f3e0.

📒 Files selected for processing (4)
  • lib/widgets/draggable_widgets/agents/agent_widget.dart
  • lib/widgets/draggable_widgets/agents/placed_view_cone_agent_widget.dart
  • test/page_transition_overlay_test.dart
  • test/view_cone_agent_anchor_test.dart

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change replaces marker-size center offsets with the stored agent anchor for view cone rendering, sightline reporting, geometry clipping, and drag previews. Tests verify alignment across sizes, sides, previews, and gestures.

Changes

View cone anchor alignment

Layer / File(s) Summary
Propagate the stored anchor
lib/widgets/draggable_widgets/agents/agent_widget.dart
View cone SVG origins and sightline reports now use storedAgentAnchor.
Apply the anchor to placement and dragging
lib/widgets/draggable_widgets/agents/placed_view_cone_agent_widget.dart
Geometry clipping and drag preview origins now use the stored anchor converted to world coordinates.
Validate rendering and drag alignment
test/page_transition_overlay_test.dart, test/view_cone_agent_anchor_test.dart
Tests cover attached previews, both sides, multiple marker sizes, rendered wall contacts, and drag previews.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 490f3

View-cone origins now remain aligned with the rendered agent as marker sizes change, including during dragging. No merge-blocking risk remains after the supplied regression coverage and normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing view cone alignment when agent marker sizes change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.

  • P1 Animated transition mixes marker anchors lib/widgets/page_transition_overlay.dart:252

    The transition renderer converts the animated saved center to a top-left using the runtime marker size, then the attached cone composite adds storedAgentAnchor before raycasting. With a 20px marker, the focused regression measured (609, 309) for an animated anchor of (600, 300) on both map sides. Keep the animated saved anchor as the cone origin (or pass an explicit origin override), using the runtime-size top-left only for visual marker placement.

  • P1 Animated attached-cone transitions use a runtime marker anchor as the ray origin

    • Bug
      • A transition path supplies an animated agent center. _EntryRenderer.buildEntry converts that center to a runtime-size top-left (animatedCenter - runtime agentSize/2), then passes it as coordinatePosition to ViewConeAgentComposite. The composite adds storedAgentAnchor before raycasting. With runtime size 20 and stored size 38, the origin is shifted by 9px per axis: expected (600,300), actual (609,309). The focused test reproduces this on both attack and defense sides.
    • Cause
      • The transition renderer changes the semantic coordinate from the animated saved anchor/center to a runtime-size top-left before the attached-cone composite applies its saved-anchor offset, combining two different anchor conventions.
    • Fix
      • Preserve the animated saved anchor as the ViewConeWidget.worldOrigin for PlacedViewConeAgent transition previews (for example, provide an explicit world-origin override to ViewConeAgentComposite from the animated path position), while using runtime marker size only for visual layout/top-left placement. Add the focused regression for both sides and multiple marker sizes.

Copy link
Copy Markdown
Owner Author

Addressed the animated-path finding in e447d7e. Both the path planner and transition renderer now convert through storedAgentAnchor, keeping the marker center and ray origin on the animated path. Added a failing-before regression covering both sides, four marker sizes, and start/midpoint/end; 45 focused tests and changed-file analysis pass. @greptileai please re-review the current head.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile has paused reviews on this repository — it used its 300 free open-source review credits for this billing period. Reviews resume automatically on September 28. To continue before then, an organization admin can keep reviews running past the free credits — those bill as normal usage.

@SunkenInTime SunkenInTime reopened this Sep 22, 2026
@SunkenInTime
SunkenInTime merged commit 80f751e into main Sep 22, 2026
2 checks passed
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