1L.Photo = L.FeatureGroup.extend({ 2 options: { 3 icon: { 4 iconSize: [40, 40] 5 } 6 }, 7 8 initialize: function (photos, options) { 9 L.setOptions(this, options); 10 L.FeatureGroup.prototype.initialize.call(this, photos); 11 }, 12 13 addLayers: function (photos) { 14 if (photos) { 15 for (var i = 0, len = photos.length; i < len; i++) { 16 this.addLayer(photos[i]); 17 } 18 } 19 return this; 20 }, 21 22 addLayer: function (photo) { 23 L.FeatureGroup.prototype.addLayer.call(this, this.createMarker(photo)); 24 }, 25 26 createMarker: function (photo) { 27 var marker = L.marker(photo, { 28 icon: L.divIcon(L.extend({ 29 html: '<div style="background-image: url(' + photo.thumbnail + ');"></div>â', 30 className: 'leaflet-marker-photo' 31 }, photo, this.options.icon)), 32 title: photo.caption || '' 33 }); 34 marker.photo = photo; 35 return marker; 36 } 37}); 38 39L.photo = function (photos, options) { 40 return new L.Photo(photos, options); 41}; 42 43if (L.MarkerClusterGroup) { 44 45 L.Photo.Cluster = L.MarkerClusterGroup.extend({ 46 options: { 47 featureGroup: L.photo, 48 maxClusterRadius: 100, 49 showCoverageOnHover: false, 50 iconCreateFunction: function(cluster) { 51 return new L.DivIcon(L.extend({ 52 className: 'leaflet-marker-photo', 53 html: '<div style="background-image: url(' + cluster.getAllChildMarkers()[0].photo.thumbnail + ');"></div>â<b>' + cluster.getChildCount() + '</b>' 54 }, this.icon)); 55 }, 56 icon: { 57 iconSize: [40, 40] 58 } 59 }, 60 61 initialize: function (options) { 62 options = L.Util.setOptions(this, options); 63 L.MarkerClusterGroup.prototype.initialize.call(this); 64 this._photos = options.featureGroup(null, options); 65 }, 66 67 add: function (photos) { 68 this.addLayer(this._photos.addLayers(photos)); 69 return this; 70 }, 71 72 clear: function () { 73 this._photos.clearLayers(); 74 this.clearLayers(); 75 } 76 77 }); 78 79 L.photo.cluster = function (options) { 80 return new L.Photo.Cluster(options); 81 }; 82 83}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.