CesiumGS/cesium

Cannot use CSS sprites in ProviderViewModel

Open

#3 792 ouverte le 30 mars 2016

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)JavaScript (3 324 forks)batch import
category - widgetsgood first issuetype - enhancement

Métriques du dépôt

Stars
 (11 758 stars)
Métriques de merge PR
 (Merge moyen 15j 12h) (23 PRs mergées en 30 j)

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 <uniqueClassName>';

I can create a Pull Request if I get guidance on how to generate the unique class.

Guide contributeur