@maptiler/geocoding-control 2.1.7 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +46 -0
- package/CONTRIBUTING.md +72 -0
- package/README.md +115 -43
- package/SECURITY.md +16 -0
- package/dist/index.js +860 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +263 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/leaflet.public.js +1251 -0
- package/dist/leaflet.public.js.map +1 -0
- package/dist/leaflet.public.umd.js +276 -0
- package/dist/leaflet.public.umd.js.map +1 -0
- package/dist/maplibregl.js +1275 -0
- package/dist/maplibregl.js.map +1 -0
- package/dist/maplibregl.umd.js +276 -0
- package/dist/maplibregl.umd.js.map +1 -0
- package/dist/maptilersdk.js +1283 -0
- package/dist/maptilersdk.js.map +1 -0
- package/dist/maptilersdk.umd.js +276 -0
- package/dist/maptilersdk.umd.js.map +1 -0
- package/dist/src/components/clear-icon.d.ts +10 -0
- package/dist/src/components/fail-icon.d.ts +10 -0
- package/dist/src/components/loading-icon.d.ts +10 -0
- package/dist/src/components/marker.d.ts +10 -0
- package/dist/src/components/reverse-geocoding-icon.d.ts +10 -0
- package/dist/src/components/search-icon.d.ts +10 -0
- package/dist/src/controls/base-control.d.ts +44 -0
- package/dist/src/controls/leaflet-control.d.ts +27 -0
- package/dist/src/controls/leaflet-events.d.ts +42 -0
- package/dist/src/controls/leaflet-options.d.ts +84 -0
- package/dist/src/controls/maplibregl-control.d.ts +34 -0
- package/dist/src/controls/maplibregl-events.d.ts +44 -0
- package/dist/src/controls/maplibregl-options.d.ts +104 -0
- package/dist/src/controls/maptilersdk-control.d.ts +7 -0
- package/dist/src/controls/maptilersdk-events.d.ts +2 -0
- package/dist/src/controls/maptilersdk-options.d.ts +10 -0
- package/dist/src/controls/openlayers-control.d.ts +35 -0
- package/dist/src/controls/openlayers-events.d.ts +43 -0
- package/dist/src/controls/openlayers-options.d.ts +83 -0
- package/dist/src/geocoder/geocoder-events.d.ts +46 -0
- package/dist/src/geocoder/geocoder-feature-item.d.ts +22 -0
- package/{svelte/types.d.ts → dist/src/geocoder/geocoder-options.d.ts} +23 -143
- package/dist/src/geocoder/geocoder.d.ts +113 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/leaflet.public.d.ts +7 -0
- package/dist/src/maplibregl.d.ts +7 -0
- package/dist/src/maptilersdk.d.ts +7 -0
- package/dist/src/openlayers.public.d.ts +7 -0
- package/dist/src/types.d.ts +46 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/mask.d.ts +2 -0
- package/dist/src/utils/proximity.d.ts +2 -0
- package/package.json +84 -112
- package/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/geo-coordinates-parser.t.d.ts +0 -8
- package/geoUtils.d.ts +0 -3
- package/leaflet-controller.d.ts +0 -12
- package/leaflet-controller.js +0 -2475
- package/leaflet-controller.js.map +0 -1
- package/leaflet-controller.umd.js +0 -2
- package/leaflet-controller.umd.js.map +0 -1
- package/leaflet.d.ts +0 -131
- package/leaflet.js +0 -5082
- package/leaflet.js.map +0 -1
- package/leaflet.umd.js +0 -14
- package/leaflet.umd.js.map +0 -1
- package/maplibregl-controller.d.ts +0 -19
- package/maplibregl-controller.js +0 -2418
- package/maplibregl-controller.js.map +0 -1
- package/maplibregl-controller.umd.js +0 -2
- package/maplibregl-controller.umd.js.map +0 -1
- package/maplibregl.d.ts +0 -2509
- package/maplibregl.js +0 -5142
- package/maplibregl.js.map +0 -1
- package/maplibregl.umd.js +0 -14
- package/maplibregl.umd.js.map +0 -1
- package/maptilersdk.d.ts +0 -2504
- package/maptilersdk.js +0 -5152
- package/maptilersdk.js.map +0 -1
- package/maptilersdk.umd.js +0 -14
- package/maptilersdk.umd.js.map +0 -1
- package/mask.d.ts +0 -2
- package/openlayers-controller.d.ts +0 -15
- package/openlayers-controller.js +0 -2174
- package/openlayers-controller.js.map +0 -1
- package/openlayers-controller.umd.js +0 -2
- package/openlayers-controller.umd.js.map +0 -1
- package/openlayers.d.ts +0 -109
- package/openlayers.js +0 -5045
- package/openlayers.js.map +0 -1
- package/openlayers.umd.js +0 -14
- package/openlayers.umd.js.map +0 -1
- package/proximity.d.ts +0 -2
- package/react.d.ts +0 -45
- package/react.js +0 -2795
- package/react.js.map +0 -1
- package/react.umd.js +0 -14
- package/react.umd.js.map +0 -1
- package/style.css +0 -1
- package/svelte/ClearIcon.svelte +0 -12
- package/svelte/ClearIcon.svelte.d.ts +0 -25
- package/svelte/FailIcon.svelte +0 -12
- package/svelte/FailIcon.svelte.d.ts +0 -25
- package/svelte/FeatureItem.svelte +0 -246
- package/svelte/FeatureItem.svelte.d.ts +0 -26
- package/svelte/GeocodingControl.svelte +0 -921
- package/svelte/GeocodingControl.svelte.d.ts +0 -105
- package/svelte/LoadingIcon.svelte +0 -40
- package/svelte/LoadingIcon.svelte.d.ts +0 -25
- package/svelte/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/svelte/MapLibreBasedGeocodingControl.js +0 -210
- package/svelte/MarkerIcon.svelte +0 -71
- package/svelte/MarkerIcon.svelte.d.ts +0 -18
- package/svelte/ReverseGeocodingIcon.svelte +0 -12
- package/svelte/ReverseGeocodingIcon.svelte.d.ts +0 -25
- package/svelte/SearchIcon.svelte +0 -26
- package/svelte/SearchIcon.svelte.d.ts +0 -25
- package/svelte/geo-coordinates-parser.t.d.ts +0 -8
- package/svelte/geo-coordinates-parser.t.js +0 -1
- package/svelte/geoUtils.d.ts +0 -3
- package/svelte/geoUtils.js +0 -18
- package/svelte/info.json +0 -1
- package/svelte/leaflet-controller.d.ts +0 -12
- package/svelte/leaflet-controller.js +0 -274
- package/svelte/leaflet.d.ts +0 -131
- package/svelte/leaflet.js +0 -116
- package/svelte/maplibregl-controller.d.ts +0 -19
- package/svelte/maplibregl-controller.js +0 -279
- package/svelte/maplibregl.d.ts +0 -2509
- package/svelte/maplibregl.js +0 -17
- package/svelte/maptilersdk.d.ts +0 -2504
- package/svelte/maptilersdk.js +0 -32
- package/svelte/mask.d.ts +0 -2
- package/svelte/mask.js +0 -54
- package/svelte/openlayers-controller.d.ts +0 -15
- package/svelte/openlayers-controller.js +0 -283
- package/svelte/openlayers.d.ts +0 -109
- package/svelte/openlayers.js +0 -178
- package/svelte/proximity.d.ts +0 -2
- package/svelte/proximity.js +0 -60
- package/svelte/react.d.ts +0 -45
- package/svelte/react.js +0 -106
- package/svelte/types.js +0 -1
- package/svelte/vanilla.d.ts +0 -61
- package/svelte/vanilla.js +0 -101
- package/svelte/vite-env.d.ts +0 -2
- package/types.d.ts +0 -391
- package/vanilla.d.ts +0 -61
- package/vanilla.js +0 -2799
- package/vanilla.js.map +0 -1
- package/vanilla.umd.js +0 -14
- package/vanilla.umd.js.map +0 -1
- /package/{icons → dist/icons}/10pin.svg +0 -0
- /package/{icons → dist/icons}/9pin.svg +0 -0
- /package/{icons → dist/icons}/advertising_column.svg +0 -0
- /package/{icons → dist/icons}/aerodrome.svg +0 -0
- /package/{icons → dist/icons}/alcohol.svg +0 -0
- /package/{icons → dist/icons}/alpine_hut.svg +0 -0
- /package/{icons → dist/icons}/amusement_arcade.svg +0 -0
- /package/{icons → dist/icons}/amusement_park.svg +0 -0
- /package/{icons → dist/icons}/apartment.svg +0 -0
- /package/{icons → dist/icons}/archaeological_site.svg +0 -0
- /package/{icons → dist/icons}/area.svg +0 -0
- /package/{icons → dist/icons}/art.svg +0 -0
- /package/{icons → dist/icons}/arts_centre.svg +0 -0
- /package/{icons → dist/icons}/artwork.svg +0 -0
- /package/{icons → dist/icons}/audioguide.svg +0 -0
- /package/{icons → dist/icons}/bag.svg +0 -0
- /package/{icons → dist/icons}/beauty.svg +0 -0
- /package/{icons → dist/icons}/bed.svg +0 -0
- /package/{icons → dist/icons}/bell_tower.svg +0 -0
- /package/{icons → dist/icons}/beverages.svg +0 -0
- /package/{icons → dist/icons}/bicycle_repair_station.svg +0 -0
- /package/{icons → dist/icons}/biergarten.svg +0 -0
- /package/{icons → dist/icons}/bird_hide.svg +0 -0
- /package/{icons → dist/icons}/boat_rental.svg +0 -0
- /package/{icons → dist/icons}/bookmaker.svg +0 -0
- /package/{icons → dist/icons}/books.svg +0 -0
- /package/{icons → dist/icons}/bowl.svg +0 -0
- /package/{icons → dist/icons}/bowling_alley.svg +0 -0
- /package/{icons → dist/icons}/bunker.svg +0 -0
- /package/{icons → dist/icons}/bureau_de_change.svg +0 -0
- /package/{icons → dist/icons}/bus_station.svg +0 -0
- /package/{icons → dist/icons}/bust.svg +0 -0
- /package/{icons → dist/icons}/camping.svg +0 -0
- /package/{icons → dist/icons}/car_parts.svg +0 -0
- /package/{icons → dist/icons}/car_wash.svg +0 -0
- /package/{icons → dist/icons}/caravan_park.svg +0 -0
- /package/{icons → dist/icons}/carpet.svg +0 -0
- /package/{icons → dist/icons}/cattle_grid.svg +0 -0
- /package/{icons → dist/icons}/cave_entrance.svg +0 -0
- /package/{icons → dist/icons}/chalet.svg +0 -0
- /package/{icons → dist/icons}/charity.svg +0 -0
- /package/{icons → dist/icons}/chemist.svg +0 -0
- /package/{icons → dist/icons}/chimney.svg +0 -0
- /package/{icons → dist/icons}/church.svg +0 -0
- /package/{icons → dist/icons}/city_gate.svg +0 -0
- /package/{icons → dist/icons}/clinic.svg +0 -0
- /package/{icons → dist/icons}/clothes.svg +0 -0
- /package/{icons → dist/icons}/coffee.svg +0 -0
- /package/{icons → dist/icons}/community_centre.svg +0 -0
- /package/{icons → dist/icons}/computer.svg +0 -0
- /package/{icons → dist/icons}/consulate.svg +0 -0
- /package/{icons → dist/icons}/copyshop.svg +0 -0
- /package/{icons → dist/icons}/cosmetics.svg +0 -0
- /package/{icons → dist/icons}/courthouse.svg +0 -0
- /package/{icons → dist/icons}/crane.svg +0 -0
- /package/{icons → dist/icons}/dairy.svg +0 -0
- /package/{icons → dist/icons}/deli.svg +0 -0
- /package/{icons → dist/icons}/department_store.svg +0 -0
- /package/{icons → dist/icons}/diy.svg +0 -0
- /package/{icons → dist/icons}/electronics.svg +0 -0
- /package/{icons → dist/icons}/embankment.svg +0 -0
- /package/{icons → dist/icons}/embassy.svg +0 -0
- /package/{icons → dist/icons}/excrement_bags.svg +0 -0
- /package/{icons → dist/icons}/fabric.svg +0 -0
- /package/{icons → dist/icons}/farmyard.svg +0 -0
- /package/{icons → dist/icons}/ferry.svg +0 -0
- /package/{icons → dist/icons}/firepit.svg +0 -0
- /package/{icons → dist/icons}/firestation.svg +0 -0
- /package/{icons → dist/icons}/fishing.svg +0 -0
- /package/{icons → dist/icons}/fitness.svg +0 -0
- /package/{icons → dist/icons}/ford.svg +0 -0
- /package/{icons → dist/icons}/fort.svg +0 -0
- /package/{icons → dist/icons}/fortress.svg +0 -0
- /package/{icons → dist/icons}/full-height_turnstile.svg +0 -0
- /package/{icons → dist/icons}/generator_wind.svg +0 -0
- /package/{icons → dist/icons}/golf_pin.svg +0 -0
- /package/{icons → dist/icons}/greengrocer.svg +0 -0
- /package/{icons → dist/icons}/guest_house.svg +0 -0
- /package/{icons → dist/icons}/helipad.svg +0 -0
- /package/{icons → dist/icons}/hifi.svg +0 -0
- /package/{icons → dist/icons}/hostel.svg +0 -0
- /package/{icons → dist/icons}/hotel.svg +0 -0
- /package/{icons → dist/icons}/housenumber.svg +0 -0
- /package/{icons → dist/icons}/houseware.svg +0 -0
- /package/{icons → dist/icons}/hunting_stand.svg +0 -0
- /package/{icons → dist/icons}/interior_decoration.svg +0 -0
- /package/{icons → dist/icons}/internet_cafe.svg +0 -0
- /package/{icons → dist/icons}/kindergarten.svg +0 -0
- /package/{icons → dist/icons}/kissing_gate.svg +0 -0
- /package/{icons → dist/icons}/manor.svg +0 -0
- /package/{icons → dist/icons}/map.svg +0 -0
- /package/{icons → dist/icons}/marker_reverse.svg +0 -0
- /package/{icons → dist/icons}/marker_selected.svg +0 -0
- /package/{icons → dist/icons}/marker_unselected.svg +0 -0
- /package/{icons → dist/icons}/marketplace.svg +0 -0
- /package/{icons → dist/icons}/massage.svg +0 -0
- /package/{icons → dist/icons}/mast.svg +0 -0
- /package/{icons → dist/icons}/mast_communications.svg +0 -0
- /package/{icons → dist/icons}/mast_lighting.svg +0 -0
- /package/{icons → dist/icons}/medical_supply.svg +0 -0
- /package/{icons → dist/icons}/memorial.svg +0 -0
- /package/{icons → dist/icons}/miniature_golf.svg +0 -0
- /package/{icons → dist/icons}/motel.svg +0 -0
- /package/{icons → dist/icons}/mountain_range.svg +0 -0
- /package/{icons → dist/icons}/multifaith.svg +0 -0
- /package/{icons → dist/icons}/musical_instrument.svg +0 -0
- /package/{icons → dist/icons}/newsagent.svg +0 -0
- /package/{icons → dist/icons}/nightclub.svg +0 -0
- /package/{icons → dist/icons}/ocean.svg +0 -0
- /package/{icons → dist/icons}/office.svg +0 -0
- /package/{icons → dist/icons}/outdoor_seating.svg +0 -0
- /package/{icons → dist/icons}/palace.svg +0 -0
- /package/{icons → dist/icons}/parcel_locker.svg +0 -0
- /package/{icons → dist/icons}/parking_space.svg +0 -0
- /package/{icons → dist/icons}/parking_tickets.svg +0 -0
- /package/{icons → dist/icons}/pet.svg +0 -0
- /package/{icons → dist/icons}/photo.svg +0 -0
- /package/{icons → dist/icons}/picnic.svg +0 -0
- /package/{icons → dist/icons}/plaque.svg +0 -0
- /package/{icons → dist/icons}/poi.svg +0 -0
- /package/{icons → dist/icons}/post_box.svg +0 -0
- /package/{icons → dist/icons}/post_office.svg +0 -0
- /package/{icons → dist/icons}/postal_code.svg +0 -0
- /package/{icons → dist/icons}/pub.svg +0 -0
- /package/{icons → dist/icons}/public_bath.svg +0 -0
- /package/{icons → dist/icons}/public_bookcase.svg +0 -0
- /package/{icons → dist/icons}/public_building.svg +0 -0
- /package/{icons → dist/icons}/public_transport_tickets.svg +0 -0
- /package/{icons → dist/icons}/reverse.svg +0 -0
- /package/{icons → dist/icons}/river.svg +0 -0
- /package/{icons → dist/icons}/road.svg +0 -0
- /package/{icons → dist/icons}/saddle.svg +0 -0
- /package/{icons → dist/icons}/sauna.svg +0 -0
- /package/{icons → dist/icons}/sea.svg +0 -0
- /package/{icons → dist/icons}/second_hand.svg +0 -0
- /package/{icons → dist/icons}/shintoist.svg +0 -0
- /package/{icons → dist/icons}/shoe.svg +0 -0
- /package/{icons → dist/icons}/shower.svg +0 -0
- /package/{icons → dist/icons}/shrine.svg +0 -0
- /package/{icons → dist/icons}/sikhist.svg +0 -0
- /package/{icons → dist/icons}/slipway.svg +0 -0
- /package/{icons → dist/icons}/snowmobile.svg +0 -0
- /package/{icons → dist/icons}/social_facility.svg +0 -0
- /package/{icons → dist/icons}/sports.svg +0 -0
- /package/{icons → dist/icons}/sprite.json +0 -0
- /package/{icons → dist/icons}/sprite.png +0 -0
- /package/{icons → dist/icons}/sprite@2x.json +0 -0
- /package/{icons → dist/icons}/sprite@2x.png +0 -0
- /package/{icons → dist/icons}/stationery.svg +0 -0
- /package/{icons → dist/icons}/stile.svg +0 -0
- /package/{icons → dist/icons}/stone.svg +0 -0
- /package/{icons → dist/icons}/storage_tank.svg +0 -0
- /package/{icons → dist/icons}/stream.svg +0 -0
- /package/{icons → dist/icons}/street.svg +0 -0
- /package/{icons → dist/icons}/supermarket.svg +0 -0
- /package/{icons → dist/icons}/tea.svg +0 -0
- /package/{icons → dist/icons}/telescope_dish.svg +0 -0
- /package/{icons → dist/icons}/telescope_dome.svg +0 -0
- /package/{icons → dist/icons}/ticket.svg +0 -0
- /package/{icons → dist/icons}/tobacco.svg +0 -0
- /package/{icons → dist/icons}/tower_cantilever_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_cooling.svg +0 -0
- /package/{icons → dist/icons}/tower_dish.svg +0 -0
- /package/{icons → dist/icons}/tower_dome.svg +0 -0
- /package/{icons → dist/icons}/tower_generic.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_lighting.svg +0 -0
- /package/{icons → dist/icons}/tower_lighting.svg +0 -0
- /package/{icons → dist/icons}/townhall.svg +0 -0
- /package/{icons → dist/icons}/toys.svg +0 -0
- /package/{icons → dist/icons}/trade.svg +0 -0
- /package/{icons → dist/icons}/traffic_light.svg +0 -0
- /package/{icons → dist/icons}/train_station.svg +0 -0
- /package/{icons → dist/icons}/travel_agency.svg +0 -0
- /package/{icons → dist/icons}/tyres.svg +0 -0
- /package/{icons → dist/icons}/university.svg +0 -0
- /package/{icons → dist/icons}/variety_store.svg +0 -0
- /package/{icons → dist/icons}/vehicle_inspection.svg +0 -0
- /package/{icons → dist/icons}/vending_machine.svg +0 -0
- /package/{icons → dist/icons}/video.svg +0 -0
- /package/{icons → dist/icons}/video_games.svg +0 -0
- /package/{icons → dist/icons}/waste_disposal.svg +0 -0
- /package/{icons → dist/icons}/water_well.svg +0 -0
- /package/{icons → dist/icons}/waterfall.svg +0 -0
- /package/{icons → dist/icons}/wilderness_hut.svg +0 -0
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import bbox from "@turf/bbox";
|
|
2
|
-
import clone from "@turf/clone";
|
|
3
|
-
import { feature, featureCollection } from "@turf/helpers";
|
|
4
|
-
import union from "@turf/union";
|
|
5
|
-
import * as L from "leaflet";
|
|
6
|
-
import { unwrapBbox } from "./geoUtils";
|
|
7
|
-
import MarkerIcon from "./MarkerIcon.svelte";
|
|
8
|
-
import { setMask } from "./mask";
|
|
9
|
-
const defaultFullGeometryStyle = (feature) => {
|
|
10
|
-
const type = feature?.geometry?.type;
|
|
11
|
-
const weight = feature?.properties?.isMask
|
|
12
|
-
? 0
|
|
13
|
-
: type === "LineString" || type === "MultiLineString"
|
|
14
|
-
? 3
|
|
15
|
-
: 2;
|
|
16
|
-
return {
|
|
17
|
-
color: "#3170fe",
|
|
18
|
-
fillColor: "#000",
|
|
19
|
-
fillOpacity: feature?.properties?.isMask ? 0.1 : 0,
|
|
20
|
-
weight,
|
|
21
|
-
dashArray: [weight, weight],
|
|
22
|
-
lineCap: "butt",
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export function createLeafletMapController(map, marker = true, showResultMarkers = true, flyToOptions = {}, flyToBounds = {}, fullGeometryStyle = defaultFullGeometryStyle) {
|
|
26
|
-
let eventHandler;
|
|
27
|
-
const markers = [];
|
|
28
|
-
let selectedMarker;
|
|
29
|
-
let reverseMarker;
|
|
30
|
-
const resultLayer = L.geoJSON(undefined, {
|
|
31
|
-
style: fullGeometryStyle === true
|
|
32
|
-
? defaultFullGeometryStyle
|
|
33
|
-
: fullGeometryStyle === false
|
|
34
|
-
? undefined
|
|
35
|
-
: (fullGeometryStyle ?? undefined),
|
|
36
|
-
interactive: false,
|
|
37
|
-
}).addTo(map);
|
|
38
|
-
const handleMapClick = (e) => {
|
|
39
|
-
eventHandler?.({
|
|
40
|
-
type: "mapClick",
|
|
41
|
-
coordinates: [e.latlng.lng, e.latlng.lat],
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
function createMarker(pos, interactive = false) {
|
|
45
|
-
const element = document.createElement("div");
|
|
46
|
-
new MarkerIcon({ props: { displayIn: "leaflet" }, target: element });
|
|
47
|
-
return new L.Marker(pos, {
|
|
48
|
-
interactive,
|
|
49
|
-
icon: new L.DivIcon({
|
|
50
|
-
html: element,
|
|
51
|
-
className: "",
|
|
52
|
-
iconAnchor: [12, 26],
|
|
53
|
-
iconSize: [25, 30],
|
|
54
|
-
tooltipAnchor: [1, -24],
|
|
55
|
-
}),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
setEventHandler(handler) {
|
|
60
|
-
if (handler) {
|
|
61
|
-
eventHandler = handler;
|
|
62
|
-
map.on("click", handleMapClick);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
eventHandler = undefined;
|
|
66
|
-
map.off("click", handleMapClick);
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
flyTo(center, zoom) {
|
|
70
|
-
map.flyTo([center[1], center[0]], zoom, { duration: 2, ...flyToOptions });
|
|
71
|
-
},
|
|
72
|
-
fitBounds(bbox, padding, maxZoom) {
|
|
73
|
-
map.flyToBounds([
|
|
74
|
-
[bbox[1], bbox[0]],
|
|
75
|
-
[bbox[3], bbox[2]],
|
|
76
|
-
], {
|
|
77
|
-
padding: [padding, padding],
|
|
78
|
-
duration: 2,
|
|
79
|
-
...(maxZoom ? { maxZoom } : {}),
|
|
80
|
-
...flyToBounds,
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
indicateReverse(reverse) {
|
|
84
|
-
map.getContainer().style.cursor = reverse ? "crosshair" : "";
|
|
85
|
-
},
|
|
86
|
-
setReverseMarker(coordinates) {
|
|
87
|
-
if (!marker) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const latLng = coordinates && [coordinates[1], coordinates[0]];
|
|
91
|
-
if (reverseMarker) {
|
|
92
|
-
if (!latLng) {
|
|
93
|
-
reverseMarker.remove();
|
|
94
|
-
reverseMarker = undefined;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
reverseMarker.setLatLng(latLng);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else if (latLng) {
|
|
101
|
-
if (marker instanceof Function) {
|
|
102
|
-
reverseMarker = marker(map) ?? undefined;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
reverseMarker = (typeof marker === "object"
|
|
106
|
-
? new L.Marker(latLng, marker)
|
|
107
|
-
: createMarker(latLng)).addTo(map);
|
|
108
|
-
reverseMarker.getElement()?.classList.add("marker-reverse");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
setFeatures(markedFeatures, picked, showPolygonMarker) {
|
|
113
|
-
function setData(data) {
|
|
114
|
-
resultLayer.clearLayers();
|
|
115
|
-
if (data) {
|
|
116
|
-
resultLayer.addData(data);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
for (const marker of markers) {
|
|
120
|
-
marker.remove();
|
|
121
|
-
}
|
|
122
|
-
markers.length = 0;
|
|
123
|
-
setData();
|
|
124
|
-
block: if (picked) {
|
|
125
|
-
let handled = false;
|
|
126
|
-
if (picked.geometry.type === "GeometryCollection") {
|
|
127
|
-
const geoms = picked.geometry.geometries.filter((geometry) => geometry.type === "Polygon" || geometry.type === "MultiPolygon");
|
|
128
|
-
ok: if (geoms.length > 0) {
|
|
129
|
-
const unioned = union(featureCollection(geoms.map((geom) => feature(geom))));
|
|
130
|
-
if (!unioned) {
|
|
131
|
-
break ok;
|
|
132
|
-
}
|
|
133
|
-
setMask({
|
|
134
|
-
...picked,
|
|
135
|
-
geometry: unioned.geometry,
|
|
136
|
-
}, setData);
|
|
137
|
-
handled = true;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
const geometries = picked.geometry.geometries.filter((geometry) => geometry.type === "LineString" ||
|
|
141
|
-
geometry.type === "MultiLineString");
|
|
142
|
-
if (geometries.length > 0) {
|
|
143
|
-
setData({
|
|
144
|
-
...picked,
|
|
145
|
-
geometry: { type: "GeometryCollection", geometries },
|
|
146
|
-
});
|
|
147
|
-
handled = true;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (handled) {
|
|
152
|
-
// nothing
|
|
153
|
-
}
|
|
154
|
-
else if (picked.geometry.type === "Polygon" ||
|
|
155
|
-
picked.geometry.type === "MultiPolygon") {
|
|
156
|
-
setMask(picked, (fc) => {
|
|
157
|
-
if (!fc) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
// leaflet doesn't repeat features every 360 degrees along longitude
|
|
161
|
-
// so we clone it manually to the direction(s)
|
|
162
|
-
// which could be displayed when auto-zoomed on the feature
|
|
163
|
-
const features = [...fc.features];
|
|
164
|
-
const bb = unwrapBbox(bbox(picked));
|
|
165
|
-
const span = bb[2] - bb[0];
|
|
166
|
-
if (bb[0] - span / 4 < -180) {
|
|
167
|
-
features.push(...shiftPolyCollection(fc, -360).features);
|
|
168
|
-
}
|
|
169
|
-
if (bb[2] + span / 4 > 180) {
|
|
170
|
-
features.push(...shiftPolyCollection(fc, 360).features);
|
|
171
|
-
}
|
|
172
|
-
setData(featureCollection(features));
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
else if (picked.geometry.type === "LineString" ||
|
|
176
|
-
picked.geometry.type === "MultiLineString") {
|
|
177
|
-
setData(picked);
|
|
178
|
-
break block; // no pin for (multi)linestrings
|
|
179
|
-
}
|
|
180
|
-
if (!showPolygonMarker && !picked.geometry.type.endsWith("Point")) {
|
|
181
|
-
break block;
|
|
182
|
-
}
|
|
183
|
-
if (marker instanceof Function) {
|
|
184
|
-
const m = marker(map, picked);
|
|
185
|
-
if (m) {
|
|
186
|
-
markers.push(m.addTo(map));
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
else if (marker) {
|
|
190
|
-
const pos = [picked.center[1], picked.center[0]];
|
|
191
|
-
markers.push(typeof marker === "object"
|
|
192
|
-
? new L.Marker(pos, marker)
|
|
193
|
-
: createMarker(pos).addTo(map));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (showResultMarkers) {
|
|
197
|
-
for (const feature of markedFeatures ?? []) {
|
|
198
|
-
if (feature === picked) {
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
const pos = [
|
|
202
|
-
feature.center[1],
|
|
203
|
-
feature.center[0],
|
|
204
|
-
];
|
|
205
|
-
let marker;
|
|
206
|
-
if (showResultMarkers instanceof Function) {
|
|
207
|
-
marker = showResultMarkers(map, feature);
|
|
208
|
-
if (!marker) {
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
marker = (typeof showResultMarkers === "object"
|
|
214
|
-
? new L.Marker(pos, showResultMarkers)
|
|
215
|
-
: createMarker(pos, true))
|
|
216
|
-
.addTo(map)
|
|
217
|
-
.bindTooltip(feature.place_type[0] === "reverse"
|
|
218
|
-
? feature.place_name
|
|
219
|
-
: feature.place_name.replace(/,.*/, ""), {
|
|
220
|
-
direction: "top",
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
const element = marker.getElement();
|
|
224
|
-
if (element) {
|
|
225
|
-
element.addEventListener("click", (e) => {
|
|
226
|
-
e.stopPropagation();
|
|
227
|
-
eventHandler?.({ type: "markerClick", id: feature.id });
|
|
228
|
-
});
|
|
229
|
-
element.addEventListener("mouseenter", () => {
|
|
230
|
-
eventHandler?.({ type: "markerMouseEnter", id: feature.id });
|
|
231
|
-
});
|
|
232
|
-
element.addEventListener("mouseleave", () => {
|
|
233
|
-
eventHandler?.({ type: "markerMouseLeave", id: feature.id });
|
|
234
|
-
});
|
|
235
|
-
element.classList.toggle("marker-fuzzy", !!feature.matching_text);
|
|
236
|
-
}
|
|
237
|
-
markers.push(marker);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
setSelectedMarker(index) {
|
|
242
|
-
if (selectedMarker) {
|
|
243
|
-
selectedMarker.getElement()?.classList.toggle("marker-selected", false);
|
|
244
|
-
}
|
|
245
|
-
selectedMarker = index > -1 ? markers[index] : undefined;
|
|
246
|
-
selectedMarker?.getElement()?.classList.toggle("marker-selected", true);
|
|
247
|
-
},
|
|
248
|
-
getCenterAndZoom() {
|
|
249
|
-
const c = map.getCenter();
|
|
250
|
-
return [map.getZoom(), c.lng, c.lat];
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function shiftPolyCollection(featureCollection, distance) {
|
|
255
|
-
const cloned = clone(featureCollection);
|
|
256
|
-
for (const feature of cloned.features) {
|
|
257
|
-
if (feature.geometry.type == "MultiPolygon") {
|
|
258
|
-
for (const poly of feature.geometry.coordinates) {
|
|
259
|
-
shiftPolyCoords(poly, distance);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
shiftPolyCoords(feature.geometry.coordinates, distance);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return cloned;
|
|
267
|
-
}
|
|
268
|
-
function shiftPolyCoords(coordinates, distance) {
|
|
269
|
-
for (const ring of coordinates) {
|
|
270
|
-
for (const position of ring) {
|
|
271
|
-
position[0] += distance;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
package/svelte/leaflet.d.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import * as L from "leaflet";
|
|
2
|
-
import type { ControlOptions, DispatcherType, Feature } from "./types";
|
|
3
|
-
export { createLeafletMapController } from "./leaflet-controller";
|
|
4
|
-
type LeafletControlOptions = ControlOptions & L.ControlOptions & {
|
|
5
|
-
/**
|
|
6
|
-
* Marker to be added to the map at the location of the user-selected result using a default set of Marker options.
|
|
7
|
-
*
|
|
8
|
-
* - If `true` or `undefined` then a default marker will be used.\
|
|
9
|
-
* - If the value is [MarkerOptions](https://leafletjs.com/reference.html#marker-option) then the marker will be constructed using these options.
|
|
10
|
-
* - If the value is a function then it can create and configure custom [Marker](https://leafletjs.com/reference.html#marker),
|
|
11
|
-
* add it to the [Map](https://leafletjs.com/reference.html#map) and return it.
|
|
12
|
-
* Function accepts [Map](https://leafletjs.com/reference.html#map) and `Feature` as parameters.
|
|
13
|
-
* Feature is `undefined` for the reverse location marker.
|
|
14
|
-
* - If `false` or `null` then no marker will be added to the map.
|
|
15
|
-
*
|
|
16
|
-
* Default value is `true`.
|
|
17
|
-
*/
|
|
18
|
-
marker?: null | boolean | L.MarkerOptions | ((map: L.Map, feature?: Feature) => L.Marker | undefined | null);
|
|
19
|
-
/**
|
|
20
|
-
* Marker be added to the map at the location the geocoding results.
|
|
21
|
-
*
|
|
22
|
-
* - If `true` or `undefined` then a default marker will be used.
|
|
23
|
-
* - If the value is [MarkerOptions](https://leafletjs.com/reference.html#marker-option) then the marker will be constructed using these options.
|
|
24
|
-
* - If the value is a function then it can create and configure custom [Marker](https://leafletjs.com/reference.html#marker),
|
|
25
|
-
* add it to the [Map](https://leafletjs.com/reference.html#map) and return it.
|
|
26
|
-
* In this case the default pop-up won't be added to the marker.
|
|
27
|
-
* Function accepts [Map](https://leafletjs.com/reference.html#map) and `Feature` as parameters.
|
|
28
|
-
* - If `false` or `null` then no marker will be added to the map.
|
|
29
|
-
*
|
|
30
|
-
* Default value is `true`.
|
|
31
|
-
*/
|
|
32
|
-
showResultMarkers?: null | boolean | L.MarkerOptions | ((map: L.Map, feature: Feature) => L.Marker | undefined | null);
|
|
33
|
-
/**
|
|
34
|
-
* Animation to selected feature on the map.
|
|
35
|
-
*
|
|
36
|
-
* - If `false` or `null` then animating the map to a selected result is disabled.
|
|
37
|
-
* - If `true` or `undefined` then animating the map will use the default animation parameters.
|
|
38
|
-
* - If an [ZoomPanOptions](https://leafletjs.com/reference.html#zoom/pan-options)
|
|
39
|
-
* ` & `[FitBoundsOptions](https://leafletjs.com/reference.html#fitbounds-options) then it will be passed as options
|
|
40
|
-
* to the map [flyTo](https://leafletjs.com/reference.html#map-flyto)
|
|
41
|
-
* or [fitBounds](https://leafletjs.com/reference.html#map-fitbounds) method providing control over the animation of the transition.
|
|
42
|
-
*
|
|
43
|
-
* Default value is `true`.
|
|
44
|
-
*/
|
|
45
|
-
flyTo?: null | boolean | (L.ZoomPanOptions & L.FitBoundsOptions);
|
|
46
|
-
/**
|
|
47
|
-
* Style for the full feature geometry.
|
|
48
|
-
*
|
|
49
|
-
* - If `false` or `null` then no full geometry is drawn.
|
|
50
|
-
* - If `true` or `undefined` then default-styled full geometry is drawn.
|
|
51
|
-
* - If an [PathOptions](https://leafletjs.com/reference.html#path-option) then it will be used to style the full geometry.
|
|
52
|
-
* - If a function accepting a `Feature` and returning [PathOptions](https://leafletjs.com/reference.html#path-option)
|
|
53
|
-
* then it must teturn the style and will be used to style the full geometry.
|
|
54
|
-
*/
|
|
55
|
-
fullGeometryStyle?: null | boolean | L.PathOptions | L.StyleFunction;
|
|
56
|
-
};
|
|
57
|
-
type LeafletEvent<T> = {
|
|
58
|
-
type: T;
|
|
59
|
-
target: GeocodingControl;
|
|
60
|
-
sourceTarget: GeocodingControl;
|
|
61
|
-
};
|
|
62
|
-
type CustomEventMap = {
|
|
63
|
-
[T in keyof DispatcherType]: DispatcherType[T] & LeafletEvent<T>;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Leaflet mixins https://leafletjs.com/reference.html#class
|
|
67
|
-
* for TypeScript https://www.typescriptlang.org/docs/handbook/mixins.html
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
declare class EventedControl extends L.Control {
|
|
71
|
-
}
|
|
72
|
-
interface EventedControl extends L.Control {
|
|
73
|
-
on<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
|
|
74
|
-
addEventListener<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
|
|
75
|
-
once<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
|
|
76
|
-
addOneTimeEventListener<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown): this;
|
|
77
|
-
off<T extends keyof CustomEventMap>(type?: T, fn?: (event: CustomEventMap[T]) => void, context?: unknown): this;
|
|
78
|
-
off(eventMap?: {
|
|
79
|
-
[T in keyof CustomEventMap]?: (event: CustomEventMap[T]) => void;
|
|
80
|
-
}): this;
|
|
81
|
-
removeEventListener<T extends keyof CustomEventMap>(type?: T, fn?: (event: CustomEventMap[T]) => void, context?: unknown): this;
|
|
82
|
-
listens<T extends keyof CustomEventMap>(type: T, fn: (event: CustomEventMap[T]) => void, context?: unknown, propagate?: boolean): boolean;
|
|
83
|
-
fire(type: string, data?: unknown, propagate?: boolean): this;
|
|
84
|
-
addEventParent(obj: L.Evented): this;
|
|
85
|
-
removeEventParent(obj: L.Evented): this;
|
|
86
|
-
fireEvent(type: string, data?: unknown, propagate?: boolean): this;
|
|
87
|
-
hasEventListeners<T extends keyof CustomEventMap>(type: T): boolean;
|
|
88
|
-
}
|
|
89
|
-
export declare class GeocodingControl extends EventedControl {
|
|
90
|
-
#private;
|
|
91
|
-
constructor(options: LeafletControlOptions);
|
|
92
|
-
onAdd(map: L.Map): HTMLDivElement;
|
|
93
|
-
/**
|
|
94
|
-
* Update the control options.
|
|
95
|
-
*
|
|
96
|
-
* @param options options to update
|
|
97
|
-
*/
|
|
98
|
-
setOptions(options: LeafletControlOptions): void;
|
|
99
|
-
/**
|
|
100
|
-
* Set the content of search input box.
|
|
101
|
-
*
|
|
102
|
-
* @param value text to set
|
|
103
|
-
* @param submit perform the search
|
|
104
|
-
*/
|
|
105
|
-
setQuery(value: string, submit?: boolean): void;
|
|
106
|
-
/**
|
|
107
|
-
* Clear geocoding search results from the map.
|
|
108
|
-
*/
|
|
109
|
-
clearMap(): void;
|
|
110
|
-
/**
|
|
111
|
-
* Clear search result list.
|
|
112
|
-
*/
|
|
113
|
-
clearList(): void;
|
|
114
|
-
/**
|
|
115
|
-
* Set reverse geocoding mode.
|
|
116
|
-
*
|
|
117
|
-
* @param reverseActive reverse geocoding active
|
|
118
|
-
*/
|
|
119
|
-
setReverseMode(reverseActive: boolean): void;
|
|
120
|
-
/**
|
|
121
|
-
* Focus the search input box.
|
|
122
|
-
*
|
|
123
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
124
|
-
*/
|
|
125
|
-
focus(options?: FocusOptions): void;
|
|
126
|
-
/**
|
|
127
|
-
* Blur the search input box.
|
|
128
|
-
*/
|
|
129
|
-
blur(): void;
|
|
130
|
-
onRemove(): void;
|
|
131
|
-
}
|
package/svelte/leaflet.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import * as L from "leaflet";
|
|
2
|
-
import GeocodingControlComponent from "./GeocodingControl.svelte";
|
|
3
|
-
import { createLeafletMapController } from "./leaflet-controller";
|
|
4
|
-
export { createLeafletMapController } from "./leaflet-controller";
|
|
5
|
-
/**
|
|
6
|
-
* Leaflet mixins https://leafletjs.com/reference.html#class
|
|
7
|
-
* for TypeScript https://www.typescriptlang.org/docs/handbook/mixins.html
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
11
|
-
class EventedControl extends L.Control {
|
|
12
|
-
}
|
|
13
|
-
L.Util.extend(EventedControl.prototype, L.Evented.prototype);
|
|
14
|
-
export class GeocodingControl extends EventedControl {
|
|
15
|
-
#gc;
|
|
16
|
-
#options;
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super(options);
|
|
19
|
-
this.#options = options;
|
|
20
|
-
}
|
|
21
|
-
onAdd(map) {
|
|
22
|
-
const div = document.createElement("div");
|
|
23
|
-
div.className = "leaflet-ctrl-geocoder";
|
|
24
|
-
L.DomEvent.disableClickPropagation(div);
|
|
25
|
-
L.DomEvent.disableScrollPropagation(div);
|
|
26
|
-
const { marker, showResultMarkers, flyTo, fullGeometryStyle, position, ...restOptions } = this.#options;
|
|
27
|
-
const flyToOptions = typeof flyTo === "boolean" ? {} : flyTo;
|
|
28
|
-
const mapController = createLeafletMapController(map, marker, showResultMarkers, flyToOptions, flyToOptions, fullGeometryStyle);
|
|
29
|
-
this.#gc = new GeocodingControlComponent({
|
|
30
|
-
target: div,
|
|
31
|
-
props: {
|
|
32
|
-
mapController,
|
|
33
|
-
flyTo: flyTo === undefined ? true : !!flyTo,
|
|
34
|
-
...restOptions,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
const eventNames = {
|
|
38
|
-
select: undefined,
|
|
39
|
-
pick: undefined,
|
|
40
|
-
featureslisted: undefined,
|
|
41
|
-
featuresmarked: undefined,
|
|
42
|
-
response: undefined,
|
|
43
|
-
optionsvisibilitychange: undefined,
|
|
44
|
-
reversetoggle: undefined,
|
|
45
|
-
querychange: undefined,
|
|
46
|
-
};
|
|
47
|
-
for (const eventName in eventNames) {
|
|
48
|
-
this.#gc.$on(eventName, (event) => this.fire(eventName, event.detail));
|
|
49
|
-
}
|
|
50
|
-
return div;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Update the control options.
|
|
54
|
-
*
|
|
55
|
-
* @param options options to update
|
|
56
|
-
*/
|
|
57
|
-
setOptions(options) {
|
|
58
|
-
Object.assign(this.#options, options);
|
|
59
|
-
const { marker, showResultMarkers, flyTo, fullGeometryStyle, ...restOptions } = this.#options;
|
|
60
|
-
this.#gc?.$set(restOptions);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Set the content of search input box.
|
|
64
|
-
*
|
|
65
|
-
* @param value text to set
|
|
66
|
-
* @param submit perform the search
|
|
67
|
-
*/
|
|
68
|
-
setQuery(value, submit = true) {
|
|
69
|
-
this.#gc?.setQuery(value, submit);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Clear geocoding search results from the map.
|
|
73
|
-
*/
|
|
74
|
-
clearMap() {
|
|
75
|
-
this.#gc?.clearMap();
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Clear search result list.
|
|
79
|
-
*/
|
|
80
|
-
clearList() {
|
|
81
|
-
this.#gc?.clearList();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Set reverse geocoding mode.
|
|
85
|
-
*
|
|
86
|
-
* @param reverseActive reverse geocoding active
|
|
87
|
-
*/
|
|
88
|
-
setReverseMode(reverseActive) {
|
|
89
|
-
this.#gc?.$set({ reverseActive });
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Focus the search input box.
|
|
93
|
-
*
|
|
94
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
95
|
-
*/
|
|
96
|
-
focus(options) {
|
|
97
|
-
this.#gc?.focus(options);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Blur the search input box.
|
|
101
|
-
*/
|
|
102
|
-
blur() {
|
|
103
|
-
this.#gc?.blur();
|
|
104
|
-
}
|
|
105
|
-
onRemove() {
|
|
106
|
-
this.#gc?.$destroy();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function createControl(...params) {
|
|
110
|
-
return new GeocodingControl(...params);
|
|
111
|
-
}
|
|
112
|
-
if (window.L &&
|
|
113
|
-
typeof window.L === "object" &&
|
|
114
|
-
typeof window.L.control === "function") {
|
|
115
|
-
window.L.control.maptilerGeocoding = createControl;
|
|
116
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type * as maplibregl from "maplibre-gl";
|
|
2
|
-
import type { FillLayerSpecification, FitBoundsOptions, FlyToOptions, LineLayerSpecification, Map, Marker, MarkerOptions } from "maplibre-gl";
|
|
3
|
-
import type { BBox, Position } from "./types";
|
|
4
|
-
import type { Feature, MapEvent } from "./types.js";
|
|
5
|
-
export type MapLibreGL = Pick<typeof maplibregl, "Marker" | "Popup">;
|
|
6
|
-
export type FullGeometryStyle = {
|
|
7
|
-
fill: Pick<FillLayerSpecification, "layout" | "paint" | "filter">;
|
|
8
|
-
line: Pick<LineLayerSpecification, "layout" | "paint" | "filter">;
|
|
9
|
-
};
|
|
10
|
-
export declare function createMapLibreGlMapController(map: Map, maplibregl?: MapLibreGL | undefined, marker?: boolean | null | MarkerOptions | ((map: Map, feature?: Feature) => Marker | undefined | null), showResultMarkers?: boolean | null | MarkerOptions | ((map: Map, feature: Feature) => Marker | undefined | null), flyToOptions?: FlyToOptions | null, fitBoundsOptions?: FitBoundsOptions | null, fullGeometryStyle?: boolean | null | FullGeometryStyle): {
|
|
11
|
-
setEventHandler(handler: undefined | ((e: MapEvent) => void)): void;
|
|
12
|
-
flyTo(center: Position, zoom?: number): void;
|
|
13
|
-
fitBounds(bbox: BBox, padding: number, maxZoom?: number): void;
|
|
14
|
-
indicateReverse(reverse: boolean): void;
|
|
15
|
-
setReverseMarker(coordinates?: Position): void;
|
|
16
|
-
setFeatures(markedFeatures: Feature[] | undefined, picked: Feature | undefined, showPolygonMarker: boolean): void;
|
|
17
|
-
setSelectedMarker(index: number): void;
|
|
18
|
-
getCenterAndZoom(): [number, number, number];
|
|
19
|
-
};
|