Changing leaflet dependency handling

This commit is contained in:
Önder Ceylan
2017-11-25 23:54:25 +01:00
parent 10dbe17f78
commit af67c5568d
2 changed files with 15 additions and 11 deletions
+4 -3
View File
@@ -1,12 +1,12 @@
// Type definitions for Leaflet.heat v0.2.0
// Type definitions for Leaflet.heat 0.2
// Project: https://github.com/Leaflet/Leaflet.heat
// Definitions by: Önder Ceylan <https://github.com/onderceylan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="leaflet" />
import * as L from 'leaflet';
declare namespace L {
declare module 'leaflet' {
type HeatLatLngTuple = [number, number, number];
interface ColorGradientConfig {
@@ -26,6 +26,7 @@ declare namespace L {
setOptions(options: HeatMapOptions): HeatLayer;
addLatLng(latlng: LatLng | HeatLatLngTuple): HeatLayer;
setLatLngs(latlngs: Array<LatLng | HeatLatLngTuple>): HeatLayer;
redraw(): TileLayer;
}
function heatLayer(latlngs: Array<LatLng | HeatLatLngTuple>, options: HeatMapOptions): HeatLayer;
+11 -8
View File
@@ -1,11 +1,14 @@
const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
map = new L.Map('map', {
layers: [osm],
center: new L.LatLng(50.5, 30.5),
zoom: 15,
});
import * as L from 'leaflet';
import 'leaflet.heat';
const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
const osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
const map = new L.Map('map', {
layers: [osm],
center: new L.LatLng(50.5, 30.5),
zoom: 15,
});
// Each point in the input array can be either an array like [50.5, 30.5, 0.5], or a Leaflet LatLng object.
const heat: L.HeatLayer = L.heatLayer([