Add iconRetinaUrl and shadowRetinaUrl to set urls for retina icons. Add a retina version of the default icon and use it.
This commit is contained in:
parent
003cf55451
commit
946a9df5f9
BIN
dist/images/marker-icon@2x.png
vendored
Normal file
BIN
dist/images/marker-icon@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
@ -16,6 +16,10 @@ L.Icon.Default = L.Icon.extend({
|
||||
return this.options[key];
|
||||
}
|
||||
|
||||
if (L.Browser.retina && name == 'icon') {
|
||||
name += '@2x';
|
||||
}
|
||||
|
||||
var path = L.Icon.Default.imagePath;
|
||||
|
||||
if (!path) {
|
||||
|
@ -2,10 +2,12 @@ L.Icon = L.Class.extend({
|
||||
options: {
|
||||
/*
|
||||
iconUrl: (String) (required)
|
||||
iconRetinaUrl: (String) (optional, used for retina devices if detected)
|
||||
iconSize: (Point) (can be set through CSS)
|
||||
iconAnchor: (Point) (centered by default, can be set in CSS with negative margins)
|
||||
popupAnchor: (Point) (if not specified, popup opens in the anchor point)
|
||||
shadowUrl: (Point) (no shadow by default)
|
||||
shadowRetinaUrl: (String) (optional, used for retina devices if detected)
|
||||
shadowSize: (Point)
|
||||
shadowAnchor: (Point)
|
||||
*/
|
||||
@ -83,6 +85,9 @@ L.Icon = L.Class.extend({
|
||||
},
|
||||
|
||||
_getIconUrl: function (name) {
|
||||
if (L.Browser.retina && this.options[name + 'RetinaUrl']) {
|
||||
return this.options[name + 'RetinaUrl'];
|
||||
}
|
||||
return this.options[name + 'Url'];
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user