Skip to content

Commit fcfaaf7

Browse files
authored
🤖 Merge PR DefinitelyTyped#73211 Leaflet: fix return type for getting center of overlays by @Joe-Moran
1 parent e918c2f commit fcfaaf7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎types/leaflet/index.d.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,7 @@ export class ImageOverlay extends Layer {
18931893
getBounds(): LatLngBounds;
18941894

18951895
/** Get the center of the bounds this ImageOverlay covers */
1896-
getCenter(): Point;
1896+
getCenter(): LatLng;
18971897

18981898
/** Get the img element that represents the ImageOverlay on the map */
18991899
getElement(): HTMLImageElement | undefined;
@@ -1933,7 +1933,7 @@ export class SVGOverlay extends Layer {
19331933
getBounds(): LatLngBounds;
19341934

19351935
/** Get the center of the bounds this ImageOverlay covers */
1936-
getCenter(): Point;
1936+
getCenter(): LatLng;
19371937

19381938
/** Get the img element that represents the SVGOverlay on the map */
19391939
getElement(): SVGElement | undefined;
@@ -1989,7 +1989,7 @@ export class VideoOverlay extends Layer {
19891989
getBounds(): LatLngBounds;
19901990

19911991
/** Get the center of the bounds this ImageOverlay covers */
1992-
getCenter(): Point;
1992+
getCenter(): LatLng;
19931993

19941994
/** Get the video element that represents the VideoOverlay on the map */
19951995
getElement(): HTMLVideoElement | undefined;

‎types/leaflet/leaflet-tests.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ const bottomRight = bounds.getBottomRight();
8888

8989
bounds.isValid();
9090

91+
point = bounds.getCenter();
92+
9193
let points: L.Point[];
9294
points = L.LineUtil.simplify([point, point], 1);
9395

@@ -435,7 +437,7 @@ imageOverlay.setBounds(imageOverlayBounds);
435437
imageOverlay.setZIndex(1);
436438
imageOverlayBounds = imageOverlay.getBounds();
437439
maybeHtml = imageOverlay.getElement();
438-
point = imageOverlay.getCenter();
440+
coordinates = imageOverlay.getCenter();
439441
imageOverlay = imageOverlay.setStyle({ opacity: 90 });
440442

441443
// SVGOverlay
@@ -462,7 +464,7 @@ svgOverlay.setBounds(imageOverlayBounds);
462464
svgOverlay.setZIndex(1);
463465
svgOverlayBounds = svgOverlay.getBounds();
464466
const svgElement: SVGElement | undefined = svgOverlay.getElement();
465-
point = svgOverlay.getCenter();
467+
coordinates = svgOverlay.getCenter();
466468
svgOverlay = svgOverlay.setStyle({ opacity: 90 });
467469

468470
// videoOverlay
@@ -493,7 +495,7 @@ videoOverlay.setBounds(imageOverlayBounds);
493495
videoOverlay.setZIndex(1);
494496
videoOverlayBounds = videoOverlay.getBounds();
495497
maybeHtml = videoOverlay.getElement();
496-
point = videoOverlay.getCenter();
498+
coordinates = videoOverlay.getCenter();
497499
videoOverlay = videoOverlay.setStyle(videoOverlayOptions);
498500

499501
const eventHandler = () => {};

0 commit comments

Comments
 (0)