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

consolidate "selector ref" functionality into a re-usable class or function, make it search downwards not just upwards #300

Open
trusktr opened this issue Apr 30, 2024 · 0 comments

Comments

@trusktr
Copy link
Member

trusktr commented Apr 30, 2024

Some elements such as TextureProjector, ClipPlane, and SpotLight support referencing or being referenced via attributes that specify a CSS selector. For example,

<lume-clip-plane id="clipPlane1"></lume-clip-plane>
<lume-clip-plane class="clipPlane2"></lume-clip-plane>

<lume-mesh ... has="clip-planes" clip-planes="#clipPlane1, .clipPlane2"></lume-mesh>

This works across shadow roots, but currently upwards shadow trees only. It does not search into sibling shadow trees or downwards. For example the lume-mesh in the example will not be able to reference any lume-clip-planes in a shadow tree that is sibling to the shadow tree it is in or any tree below itself or the siblings', which may be limiting. Let's make it search all reachable roots of the given element, not just in upwards shadow trees.

The implementation of this is currently repeated in a similar way in several classes:

  • ClipPlanesBehavior
  • SpotLight
  • ProjectedMaterialBehavior which is has an improved version of the last two
  • and we're working on more

As we add more elements with references to other elements, we want to stop duplicating the logic.

@trusktr trusktr changed the title consolidate "selector ref" functionality into a re-usable class or function consolidate "selector ref" functionality into a re-usable class or function, make it search downwards not just upwards Apr 30, 2024
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

1 participant