From 092c14b88044ea48a372633a2109e47bfafdaf83 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Tue, 7 Mar 2017 13:30:46 +0100 Subject: [PATCH] Leaflet: Fixed the test-case for leaflet (and using the correct MouseEvent in getMousePosition) --- types/leaflet/index.d.ts | 2 +- types/leaflet/leaflet-tests.ts | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 0e340d921a..16b5dbba04 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -1277,7 +1277,7 @@ declare namespace L { function stop(ev: Event): typeof DomEvent; - function getMousePosition(ev: MouseEvent, container?: HTMLElement): Point; + function getMousePosition(ev: {clientX: number, clientY: number} /*MouseEvent from lib.d.ts*/, container?: HTMLElement): Point; function getWheelDelta(ev: Event): number; diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index b7107c55fa..5936742a13 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -13,10 +13,6 @@ latLng = L.latLng([12, 13, 0]); latLng = new L.LatLng(12, 13); latLng = new L.LatLng(12, 13, 0); -latLng = new L.LatLng(latLngLiteral); -latLng = new L.LatLng({lat: 12, lng: 13, alt: 0}); -latLng = new L.LatLng(latLngTuple); -latLng = new L.LatLng([12, 13, 0]); const latLngBoundsLiteral: L.LatLngBoundsLiteral = [[12, 13], latLngTuple]; @@ -39,8 +35,6 @@ point = L.point({x: 12, y: 13}); point = new L.Point(12, 13); point = new L.Point(12, 13, true); -point = new L.Point(pointTuple); -point = new L.Point({x: 12, y: 13}); let distance: number; point.distanceTo(point); @@ -67,18 +61,13 @@ bounds = new L.Bounds(boundsLiteral); let points: L.Point[]; points = L.LineUtil.simplify([point, point], 1); -points = L.LineUtil.simplify([pointTuple, pointTuple], 2); distance = L.LineUtil.pointToSegmentDistance(point, point, point); -distance = L.LineUtil.pointToSegmentDistance(pointTuple, pointTuple, pointTuple); point = L.LineUtil.closestPointOnSegment(point, point, point); -point = L.LineUtil.closestPointOnSegment(pointTuple, pointTuple, pointTuple); points = L.PolyUtil.clipPolygon(points, bounds); points = L.PolyUtil.clipPolygon(points, bounds, true); -points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral); -points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral, true); let mapOptions: L.MapOptions = {}; mapOptions = { @@ -275,8 +264,8 @@ L.DomEvent .disableClickPropagation(htmlElement) .preventDefault(domEvent) .stop(domEvent); -point = L.DomEvent.getMousePosition(domEvent); -point = L.DomEvent.getMousePosition(domEvent, htmlElement); +point = L.DomEvent.getMousePosition(domEvent as MouseEvent); +point = L.DomEvent.getMousePosition(domEvent as MouseEvent, htmlElement); const wheelDelta: number = L.DomEvent.getWheelDelta(domEvent); map = map @@ -391,7 +380,7 @@ let twoCoords: [number, number] = [1, 2]; latLng = L.GeoJSON.coordsToLatLng(twoCoords); twoCoords = L.GeoJSON.latLngToCoords(latLng); -let threeCoords: [number, number, number] = [1, 2, 3]; +let threeCoords: [number, number] = [1, 2]; latLng = L.GeoJSON.coordsToLatLng(threeCoords); threeCoords = L.GeoJSON.latLngToCoords(latLng);