CesiumGS/cesium

Cannot use CSS sprites in ProviderViewModel

Open

#3.792 geöffnet am 30. März 2016

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (3.324 Forks)batch import
category - widgetsgood first issuetype - enhancement

Repository-Metriken

Stars
 (11.758 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 15T 12h) (23 gemergte PRs in 30 T)

Beschreibung

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.

Contributor Guide