Skip to content

Commit b220df3

Browse files
authored
Fixed doc of reverseGeocodingLimit, added backward compatibility of MapTiler SDK. (#80)
* updated limit/types warning/documentation * added compatibility for older maptiler sdk * updated documentation
1 parent e44c888 commit b220df3

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@maptiler/geocoding-control",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "The Javascript & TypeScript Map Control component for MapTiler Geocoding service. Easy to be integrated into any JavaScript mapping application.",
55
"type": "module",
66
"author": {

src/GeocodingControl.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@
556556
effTypes?.length !== 1
557557
) {
558558
console.warn(
559-
"For reverse geocoding when `limit` > 1 then `types` must contain single value.",
559+
"For reverse geocoding when limit > 1 then types must contain single value.",
560560
);
561561
}
562562

src/maptilersdk.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import * as maptilersdk from "@maptiler/sdk";
22
import type * as maplibregl from "maplibre-gl";
33
import type { Map } from "maplibre-gl";
4+
import { name, version } from "../package.json";
45
import {
56
crateClasses,
67
type MapLibreBaseControlOptions,
78
} from "./MapLibreBasedGeocodingControl";
89

9-
import { name, version } from "../package.json";
10-
1110
export { createMapLibreGlMapController } from "./maplibregl-controller";
1211

1312
const { MapLibreBasedGeocodingControl, events } =
@@ -42,7 +41,7 @@ export class GeocodingControl
4241
implements maptilersdk.IControl
4342
{
4443
onAdd(map: maptilersdk.Map): HTMLElement {
45-
map.telemetry.registerModule(name, version);
44+
map.telemetry?.registerModule(name, version);
4645
return super.onAddInt(map as unknown as maplibregl.Map);
4746
}
4847
}

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,11 @@ export type ControlOptions = {
339339

340340
/**
341341
* Limits results for reverse geocoding.
342-
* Applied only if effective types contain a single value.
342+
* Applied only if value is 1 or effective types contain a single value.
343343
*
344344
* See also `reverseGeocodingTypes` option.
345345
*
346-
* Default: Value of the `limit` option if set, otherwise `1`.
346+
* Default: The value of the `limit` option if set. If effective types contain a single value, the default is `1`. In all other cases, this option is not used.
347347
*/
348348
reverseGeocodingLimit?: number;
349349

0 commit comments

Comments
 (0)