mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
add-leaflet-awesome-markers
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
// Type definitions for Leaflet.awesome-markers plugin v2.0
|
||||
// Project: https://github.com/lvoogdt/Leaflet.awesome-markers
|
||||
// Definitions by: Egor Komarov <https://github.com/Odrin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../leaflet/leaflet.d.ts" />
|
||||
|
||||
declare module L {
|
||||
module AwesomeMarkers {
|
||||
var version: string;
|
||||
|
||||
function icon(options: AwesomeMarkers.IconOptions): AwesomeMarkers.Icon;
|
||||
|
||||
export interface IconStatic extends L.IconStatic {
|
||||
/**
|
||||
* Creates an icon instance with the given options.
|
||||
*/
|
||||
new (options: IconOptions): Icon;
|
||||
|
||||
Default: {
|
||||
/**
|
||||
* Creates a default icon instance with the given options.
|
||||
*/
|
||||
new (options?: IconOptions): Icon.Default;
|
||||
|
||||
imagePath: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface Icon extends L.Icon {
|
||||
options: AwesomeMarkers.IconOptions;
|
||||
}
|
||||
|
||||
interface IconOptions extends L.IconOptions {
|
||||
/**
|
||||
* Name of the icon. See glyphicons or font-awesome.
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
/**
|
||||
* Select de icon library. 'fa' for font-awesome or 'glyphicon' for bootstrap 3.
|
||||
*/
|
||||
prefix?: 'fa' | 'glyphicon';
|
||||
|
||||
/**
|
||||
* Color of the marker
|
||||
*/
|
||||
markerColor?: 'red' | 'darkred' | 'orange' | 'green' | 'darkgreen' | 'blue' | 'purple' | 'darkpuple' | 'cadetblue';
|
||||
|
||||
/**
|
||||
* Color of the icon. 'white', 'black' or css code (hex, rgba etc).
|
||||
*/
|
||||
iconColor?: 'white' | 'black' | string;
|
||||
|
||||
/**
|
||||
* Make the icon spin. true or false. Font-awesome required
|
||||
*/
|
||||
spin?: boolean;
|
||||
|
||||
/**
|
||||
* Additional classes in the created tag
|
||||
*/
|
||||
extraClasses?: string;
|
||||
}
|
||||
|
||||
var Icon: AwesomeMarkers.IconStatic;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/// <reference path="leaflet-awesome-markers.d.ts" />
|
||||
|
||||
var map: L.Map;
|
||||
//var markerClusterGroup: L.MarkerClusterGroup;
|
||||
|
||||
//// CircleMarker
|
||||
//var circleMarker: L.CircleMarker = new L.CircleMarker(new L.LatLng(0, 0));
|
||||
|
||||
//markerClusterGroup.addLayer(circleMarker);
|
||||
//map.addLayer(markerClusterGroup);
|
||||
//map.removeLayer(markerClusterGroup);
|
||||
|
||||
//// Marker
|
||||
//var marker = new L.Marker(new L.LatLng(0, 0));
|
||||
|
||||
//markerClusterGroup.addLayers([circleMarker, marker]);
|
||||
//map.addLayer(markerClusterGroup);
|
||||
//markerClusterGroup.refreshClusters();
|
||||
//map.removeLayer(markerClusterGroup);
|
||||
|
||||
var redMarker = L.AwesomeMarkers.icon({
|
||||
icon: 'coffee',
|
||||
markerColor: 'red'
|
||||
});
|
||||
|
||||
var blueMarker = new L.AwesomeMarkers.Icon({
|
||||
icon: 'star',
|
||||
markerColor: 'blue'
|
||||
});
|
||||
|
||||
L.marker([51.941196, 4.512291], { icon: redMarker }).addTo(map);
|
||||
L.marker([51.941196, 4.512291], { icon: blueMarker }).addTo(map);
|
||||
|
||||
L.AwesomeMarkers.Icon.prototype.options.prefix = 'ion';
|
||||
Reference in New Issue
Block a user