playcanvas / playcanvas/react

AnnotationManager props do not apply to the variables

Open
#306 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
528
Forks
60
Avg merge
1m
Merged PRs (30d)
1

Description

When creating annotations using the Script component such as this:

import { AnnotationManager } from 'playcanvas/scripts/esm/annotations.mjs';
...
<Script
  script={AnnotationManager}
  hotspotSize={200}
  opacity={0.5}
  hotspotColor={[0, 1, 0, 0.5]} // just example numbers
  hoverColor={[1, 0, 0, 1]}
/>

In this case, the hotspotSize is applying correctly, but the hotspotColor and hoverColor do not work.

Is there a better way to use this? The docs do not mention useScript, but I see that the Script component uses this under the hood.

I guess the real question is if Annotations should be created via the Script component, or manually created in useEffects in a custom script or similar.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AnnotationManager entry point in playcanvas/scripts/esm/annotations.mjs and trace how the Script component passes props, comparing hotspotSize with hotspotColor and hoverColor. Reproduce the issue with the provided Script example; it is done when both color props affect the created annotation or the supported usage is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.