Skip to content

fix(event-display): apply custom color to line and circular hits and … - #1061

Merged
EdwardMoyse merged 1 commit into
HSF:mainfrom
RuhaaBhalerao:fix/line-hits-color-and-length-leak
Nov 11, 2026
Merged

EdwardMoyse merged 1 commit into
HSF:mainfrom
RuhaaBhalerao:fix/line-hits-color-and-length-leak

Conversation

@RuhaaBhalerao

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR resolves three related issues in PhoenixObjects.getHits and its hit-generation methods:

  1. Custom colors completely ignored for Line hits:
    In hitsToLines, line color was accessed as hitsParams.color ?? EVENT_DATA_TYPE_COLORS.Hits. Since hitsParams is an array of hit objects (Hit[]), hitsParams.color was always undefined. As a result, custom colors supplied for line hits were completely ignored and always fell back to default hits color.

  2. Inconsistent hex color parsing for Line and CircularPoint hits:
    In commit 4be833ae (fix(app): Fix/sync config to gui #996), parseColor was introduced so that hex colors in event data without # (e.g. '00ff00') are properly handled. While hitsToPoints and hitsToBoxes were updated to use parseColor, hitsToCircularPoints and hitsToLines were missed. Both methods now use parseColor(hitsParams[0]?.color) ?? EVENT_DATA_TYPE_COLORS.Hits.

  3. Global variable leak & dead code in getHits:

    • In getHits, if (isSimpleArray) length = hitLength; assigned to an undeclared identifier length, leaking to the global scope (window.length in browser environments), and was never used.
    • An unused variable let positions: any[]; was declared and never referenced.

Testing

  • Added unit tests in phoenix-objects.test.ts:
    • Added Line to the default hit color test suite.
    • Added test verifying Line hits correctly render custom colors in all accepted formats ('00ff00', '#00ff00', '0x00ff00').

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

🚀 Preview deployed: http://phoenix-pr-1061.surge.sh

Built from a9a7772.

@RuhaaBhalerao

Copy link
Copy Markdown
Contributor Author

Hi @EdwardMoyse,

Following up on PR #1053, while looking through PhoenixObjects, I noticed that when parseColor was introduced in commit 4be833a for hit types, hitsToCircularPoints and hitsToLines were missed. In addition, hitsToLines was checking hitsParams.color directly on the array instead of reading from the hit parameters, which caused custom line colors to always fall back to the default.

I've aligned both with hitsToPoints/hitsToBoxes, cleaned up an undeclared length assignment in getHits, and added unit tests covering custom colors for line hits across hex string formats.

Whenever you have a moment, I'd appreciate your review!

@EdwardMoyse

Copy link
Copy Markdown
Member

Thanks for the fixes!

@EdwardMoyse
EdwardMoyse merged commit e46c6d7 into HSF:main Nov 11, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
pull-request — a9a77722 Deployed Nov 9, 2026 by github-actions[bot]
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.

2 participants