Add type definition for leaflet-deepzoom (#36355)

https://github.com/alfarisi/leaflet-deepzoom/
This commit is contained in:
hlovdal 2019-06-28 16:49:17 +00:00 committed by Ben Lichtman
parent c2953f446b
commit e37a0f98c0
4 changed files with 61 additions and 0 deletions

28
types/leaflet-deepzoom/index.d.ts vendored Normal file
View File

@ -0,0 +1,28 @@
// Type definitions for leaflet-deepzoom 2.0
// Project: https://github.com/alfarisi/leaflet-deepzoom/
// Definitions by: Håkon Løvdal <https://github.com/hlovdal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as L from 'leaflet';
declare module 'leaflet' {
namespace TileLayer {
interface DeepZoomOptions {
width?: number;
height?: number;
imageFormat?: string;
tileSize?: number;
maxZoom?: number;
}
class DeepZoom extends TileLayer {
constructor(urlTemplate: string, options?: DeepZoomOptions);
// getTileUrl(tilePoint: Coords): string;
}
}
namespace tileLayer {
function deepzoom(urlTemplate: string, options?: TileLayer.DeepZoomOptions): TileLayer.DeepZoom;
}
}

View File

@ -0,0 +1,8 @@
import * as L from 'leaflet';
import 'leaflet-deepzoom';
const map = L.map('image2d').setView(new L.LatLng(0, 0), 0);
const dzLayer = L.tileLayer.deepzoom('DeepZoomImage/hubble_files/', {
width: 2400,
height: 3000,
}).addTo(map);

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"leaflet-deepzoom-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }