Skip to content
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

Cannot set box hit color from JSON #664

Closed
Lysarina opened this issue Jun 14, 2024 · 2 comments
Closed

Cannot set box hit color from JSON #664

Lysarina opened this issue Jun 14, 2024 · 2 comments

Comments

@Lysarina
Copy link

Currently, setting a color for a hit object of type box in a JSON event file does not work. For example, here the color attribute is set to 0xff00ff (fuchsia) for all hits in the collection ecalClusters, but the boxes still appear red. This seems to only be a problem with box hits, as setting e.g. point hits and tracks to the same color works just fine.
image
Attached is the JSON file in question.
clusters copy.json
It is possible to change the hit color in the Phoenix menu, so it is possible for boxes to have a different color, just not from a JSON file.
I have tried loading in the JSON file in my own Phoenix setup, in the Phoenix playground, as well as from the locally run yarn project pulled from the Phoenix GitHub, and the result is the same in all cases.
I looked around in the Phoenix code, and the issue seems to be in /phoenix/packages/phoenix-event-display/src/loaders/objects/phoenix-objects.ts, where box type hits are loaded in hitsToBoxes(); the color is not parsed correctly when creating the MeshPhongMaterial object.

@Lysarina
Copy link
Author

Changing line 480 in phoenix-objects.ts (hitsToBoxes() method) to
color: parseInt(hitsParams[0].color) ?? EVENT_DATA_TYPE_COLORS.Hits
solved it for me.
I tried to push this change to a new branch but did not have permission.

@EdwardMoyse
Copy link
Collaborator

Hi @Lysarina - thanks very much for this (and apologies for not having found the time to investigate for myself yet). You should always be able to open a PR - but you need to do this from your own fork. Can you try this?

EdwardMoyse added a commit that referenced this issue Jul 29, 2024
Fix for Cannot set box hit color from JSON #664
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

No branches or pull requests

2 participants