Cannot use CSS sprites in ProviderViewModel
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
When creating a ProviderViewModel, the iconUrl points to a single image.
For example, as per the documentation:
```
imageryViewModels.push(new Cesium.ProviderViewModel({
name : 'Open\u00adStreet\u00adMap',
iconUrl : Cesium.buildModuleUrl('Widgets/Images/ImageryProviders/openStreetMap.png'),
tooltip : 'OpenStreetMap (OSM) is a collaborative project to create a free editable \
map of the world.\nhttp://www.openstreetmap.org',
creationFunction : function() {
return Cesium.createOpenStreetMapImageryProvider({
url : '//a.tile.openstreetmap.org/'
});
}
}));
```
However as a class cannot be specified, it is not possible to use CSS sprites (i.e. bundling multiple icons in the same image).
A possible fix would be that of modifying Widgets/BaseLayerPicker/BaseLayerPicker.js, so that instead of
```
providerIcon.className = 'cesium-baseLayerPicker-itemIcon';
```
the assigned class were something like:
```
providerIcon.className = 'cesium-baseLayerPicker-itemIcon ';
```
I can create a Pull Request if I get guidance on how to generate the unique class.
Contributor guide
Research direction
Start with Widgets/BaseLayerPicker/BaseLayerPicker.js and the ProviderViewModel usage shown in the issue. Determine how an optional unique CSS class could be supplied for each provider icon, then verify that a provider can use a sprite-based icon while preserving the existing single-image behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100