Support black and white labels at Map of Science's comparison view
This commit is contained in:
parent
f16450b1f5
commit
eb73a306cb
17 changed files with 12 additions and 3 deletions
|
@ -81,7 +81,7 @@ var ComparisonScimapWidget = Class.extend({
|
|||
|
||||
/* create */
|
||||
if (me.disciplineLabelsControl == null) {
|
||||
me.labelsMarkerManager = new DisciplineLabelsMarkerManager(map);
|
||||
me.labelsMarkerManager = new DisciplineLabelsMarkerManager(map, getDisciplineBlackLabelImageURL);
|
||||
me.disciplineLabelsControl = new CheckBoxPanel({
|
||||
map: map,
|
||||
checked: true,
|
||||
|
|
|
@ -10,6 +10,10 @@ function getDisciplineLabelImageURL(key) {
|
|||
return disciplineLabelImageUrlPrefix + DISCIPLINES[key].image;
|
||||
}
|
||||
|
||||
function getDisciplineBlackLabelImageURL(key) {
|
||||
return disciplineBlackLabelImageUrlPrefix + DISCIPLINES[key].image;
|
||||
}
|
||||
|
||||
function createScimapType(map, mapName) {
|
||||
var sciMapTypeOptions = {
|
||||
getTileUrl: function(coord, zoom) {
|
||||
|
|
|
@ -58,9 +58,13 @@ var MarkerManager = Class.extend({
|
|||
* Customized Discipline labels MarkerManager for Science map purpose. It is an abstract class
|
||||
*/
|
||||
var DisciplineLabelsMarkerManager = MarkerManager.extend({
|
||||
init: function(map) {
|
||||
init: function(map, getLabelURL) {
|
||||
this._super();
|
||||
this.map = map;
|
||||
this.getLabelURL = getDisciplineLabelImageURL;
|
||||
if (getLabelURL != null) {
|
||||
this.getLabelURL = getLabelURL;
|
||||
}
|
||||
this.initMarkers(map);
|
||||
},
|
||||
initMarkers: function(map) {
|
||||
|
@ -69,7 +73,7 @@ var DisciplineLabelsMarkerManager = MarkerManager.extend({
|
|||
var opts = {
|
||||
map: map,
|
||||
position: createNoWrapLatLng(discipline.labelLatitude, discipline.labelLongitude),
|
||||
icon: getDisciplineLabelImageURL(id),
|
||||
icon: me.getLabelURL(id),
|
||||
clickable: false
|
||||
};
|
||||
me.addMarker(id, new Marker(opts));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue