@antv/g-plugin-css-select
v2.0.20
Published
A G plugin for using CSS select syntax in query selector
Downloads
1,713
Maintainers
Readme
@antv/g-plugin-css-select
Use CSS Selector when doing query in scene graph.
For example, if we construct a such scene:
solarSystem<Group>
| |
| sun<Circle name='sun' />
|
earthOrbit<Group>
| |
| earth<Circle>
|
moonOrbit<Group>
|
moon<Circle r='25' />
Then we can use these DOM API retrieving elements:
solarSystem.getElementsByName('sun');
// [sun]
solarSystem.getElementsByTagName('circle');
solarSystem.getElementsByTagName(Shape.CIRCLE);
// [sun, earth, moon]
solarSystem.querySelector('[name=sun]');
// sun
solarSystem.querySelectorAll('[r=25]');
// [moon]