mahal_map 2.2.3 → 2.3.0
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/README.md +49 -13
- package/dist/index.d.mts +92 -28
- package/dist/index.d.ts +92 -28
- package/dist/index.js +1 -1
- package/dist/index.mjs +5 -5
- package/dist/mahal_map.sdk.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ interface IAdditionalParamType {
|
|
|
23
23
|
/**
|
|
24
24
|
* Поверхность @grammaps/maps3d-web, описанная локально. Пакет в зависимости не ставится —
|
|
25
25
|
* он приходит снаружи, как и maplibre-gl, поэтому импортировать его типы нельзя. Здесь
|
|
26
|
-
* повторена публичная часть .d.ts версии 0.
|
|
26
|
+
* повторена публичная часть .d.ts версии 0.11.0; всё необязательное помечено `?`, чтобы
|
|
27
27
|
* более старая сборка на странице не ломала типы у потребителя.
|
|
28
28
|
*/
|
|
29
29
|
type Maps3DThemeName = "light" | "dark" | "navigator-light" | "navigator-dark" | "mobile-light" | "mobile-dark";
|
|
@@ -97,8 +97,26 @@ interface IMaps3DLayerState {
|
|
|
97
97
|
* У слоя, который не умеет ответить фактом, повторяет `active`; у сборок до 0.8.0 — undefined.
|
|
98
98
|
*/
|
|
99
99
|
rendered?: boolean;
|
|
100
|
-
/** Параметры слоя: у зданий — detail, у этажей — level, у рельефа — mode. */
|
|
101
|
-
params:
|
|
100
|
+
/** Параметры слоя: у зданий — detail, у этажей — level и levels, у рельефа — mode. */
|
|
101
|
+
params: IMaps3DLayerStateParams;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Параметры в снимке слоя. Каждое поле есть только у своего слоя; неизвестные ключи
|
|
105
|
+
* сборки Maps3D проходят через индексную сигнатуру.
|
|
106
|
+
*/
|
|
107
|
+
interface IMaps3DLayerStateParams {
|
|
108
|
+
/** `buildings`: уровень детализации. */
|
|
109
|
+
detail?: Maps3DBuildingDetail;
|
|
110
|
+
/** `indoor`: открытый этаж. */
|
|
111
|
+
level?: number;
|
|
112
|
+
/**
|
|
113
|
+
* `indoor`: этажи, найденные в текущем виде карты; `[]` — данных по зданию нет.
|
|
114
|
+
* Меняется при движении карты и приходит через onLayers(). С 0.11.0, раньше — undefined.
|
|
115
|
+
*/
|
|
116
|
+
levels?: number[];
|
|
117
|
+
/** `terrain`: режим рельефа. */
|
|
118
|
+
mode?: Maps3DTerrainMode;
|
|
119
|
+
[key: string]: unknown;
|
|
102
120
|
}
|
|
103
121
|
interface IMaps3DSelectionStyle {
|
|
104
122
|
color?: string | number;
|
|
@@ -232,12 +250,16 @@ interface IMaps3DBuildingClickInfo {
|
|
|
232
250
|
id: string | number;
|
|
233
251
|
/**
|
|
234
252
|
* Атрибуты объекта; `props.osm_id` — идентификатор, который не меняется.
|
|
235
|
-
* Необязательно:
|
|
253
|
+
* Необязательно: запасные пути держат сборки Maps3D от 0.5.0, где поля может не быть.
|
|
236
254
|
*/
|
|
237
255
|
props?: Record<string, unknown>;
|
|
238
256
|
/** Высота здания в метрах. Необязательно по той же причине, что и `props`. */
|
|
239
257
|
height?: number;
|
|
240
|
-
/**
|
|
258
|
+
/**
|
|
259
|
+
* Порядковый номер внутри сцены. Живёт до ближайшей пересборки геометрии.
|
|
260
|
+
* `>= 0` — объёмный дом сцены, `-1` — дом из слоя стиля (объёма под ним нет).
|
|
261
|
+
* Тот же признак, что selectedBuildingKind(): `'scene'` / `'flat'`.
|
|
262
|
+
*/
|
|
241
263
|
index?: number;
|
|
242
264
|
[key: string]: unknown;
|
|
243
265
|
}
|
|
@@ -247,6 +269,10 @@ interface IMaps3DObjectsLightOptions {
|
|
|
247
269
|
sky?: number;
|
|
248
270
|
exposure?: number;
|
|
249
271
|
}
|
|
272
|
+
/** Чем нарисовано выделение: объёмный дом сцены или слой стиля. С 0.11.0. */
|
|
273
|
+
type Maps3DSelectionKind = "scene" | "flat";
|
|
274
|
+
/** Колбэк подписки Maps3D: `null` вместо функции — отписаться. */
|
|
275
|
+
type Maps3DListener<T> = ((info: T | null) => void) | null;
|
|
250
276
|
interface IMaps3DDiagnostics {
|
|
251
277
|
terrainActive: boolean;
|
|
252
278
|
drapeRefreshes: number;
|
|
@@ -266,18 +292,20 @@ interface IMaps3DLayer {
|
|
|
266
292
|
refreshLayers?(): void;
|
|
267
293
|
buildings?: IMaps3DBuildingsController | null;
|
|
268
294
|
setBuildingsEnabled?(enabled: boolean): void;
|
|
269
|
-
onBuildingClick?(callback:
|
|
295
|
+
onBuildingClick?(callback: Maps3DListener<IMaps3DBuildingClickInfo>): (() => void) | void;
|
|
270
296
|
selectBuilding?(id: number | string | null, style?: IMaps3DSelectionStyle): boolean;
|
|
271
297
|
clearSelection?(): void;
|
|
272
298
|
selectedBuilding?(): number | string | null;
|
|
299
|
+
/** С 0.11.0. */
|
|
300
|
+
selectedBuildingKind?(): Maps3DSelectionKind | null;
|
|
273
301
|
setSelectionStyle?(style: IMaps3DSelectionStyle): void;
|
|
274
|
-
onBuildingHover?(callback: ((
|
|
302
|
+
onBuildingHover?(callback: Maps3DListener<IMaps3DBuildingClickInfo>): (() => void) | void;
|
|
275
303
|
setHoverEnabled?(enabled: boolean): void;
|
|
276
304
|
readonly hoverEnabled?: boolean;
|
|
277
305
|
setHoverStyle?(style: IMaps3DHoverStyle): void;
|
|
278
306
|
hoverBuilding?(id: number | string | null): boolean;
|
|
279
307
|
hoveredBuilding?(): number | string | null;
|
|
280
|
-
onRoadClick?(callback:
|
|
308
|
+
onRoadClick?(callback: Maps3DListener<IMaps3DRoadHit>): (() => void) | void;
|
|
281
309
|
roadAt?(point: {
|
|
282
310
|
x: number;
|
|
283
311
|
y: number;
|
|
@@ -287,13 +315,13 @@ interface IMaps3DLayer {
|
|
|
287
315
|
x: number;
|
|
288
316
|
y: number;
|
|
289
317
|
}, tolerancePx?: number): IMaps3DParkingInfo | null;
|
|
290
|
-
onParkingHover?(callback: ((
|
|
318
|
+
onParkingHover?(callback: Maps3DListener<IMaps3DParkingInfo>): (() => void) | void;
|
|
291
319
|
setParkingHoverStyle?(style: IMaps3DParkingHoverStyle): void;
|
|
292
320
|
setParkingHoverEnabled?(enabled: boolean): void;
|
|
293
321
|
readonly parkingHoverEnabled?: boolean;
|
|
294
322
|
hoverParking?(id: number | string | null): boolean;
|
|
295
323
|
hoveredParking?(): number | string | null;
|
|
296
|
-
onParkingClick?(callback: ((
|
|
324
|
+
onParkingClick?(callback: Maps3DListener<IMaps3DParkingInfo>): (() => void) | void;
|
|
297
325
|
traffic?: boolean;
|
|
298
326
|
trafficRaster?: boolean;
|
|
299
327
|
setTraffic?(enabled: boolean): void;
|
|
@@ -304,6 +332,7 @@ interface IMaps3DLayer {
|
|
|
304
332
|
refreshTraffic?(): void;
|
|
305
333
|
setIndoor?(enabled: boolean): void;
|
|
306
334
|
setIndoorLevel?(level: number): void;
|
|
335
|
+
/** Запасной путь для сборок до 0.11.0 — там этажей нет в `layer("indoor").params.levels`. */
|
|
307
336
|
readonly indoorLevels?: number[];
|
|
308
337
|
refreshIndoor?(): void;
|
|
309
338
|
showPlace?(lon: number, lat: number, level?: number | null, zoom?: number): void;
|
|
@@ -560,11 +589,9 @@ declare class MahalMap {
|
|
|
560
589
|
private buildingsEnabled;
|
|
561
590
|
private workerCheckTimer?;
|
|
562
591
|
private styleChangeHandler?;
|
|
563
|
-
private
|
|
564
|
-
private pendingRoadClick?;
|
|
592
|
+
private subscriptions;
|
|
565
593
|
private pendingSelectionStyle?;
|
|
566
594
|
private pendingLayerSubscribers;
|
|
567
|
-
private pendingBuildingHover?;
|
|
568
595
|
private pendingHoverStyle?;
|
|
569
596
|
private pendingHoverEnabled?;
|
|
570
597
|
private constructor();
|
|
@@ -629,27 +656,29 @@ declare class MahalMap {
|
|
|
629
656
|
static setIndoorLevel(instance: MahalMap, level: number): void;
|
|
630
657
|
static refreshIndoor(instance: MahalMap): void;
|
|
631
658
|
static showPlace(instance: MahalMap, lon: number, lat: number, level?: number | null, zoom?: number): void;
|
|
632
|
-
static onBuildingClick(instance: MahalMap, callback:
|
|
659
|
+
static onBuildingClick(instance: MahalMap, callback: Maps3DListener<IMaps3DBuildingClickInfo>): () => void;
|
|
633
660
|
static selectBuilding(instance: MahalMap, id: number | string | null, style?: IMaps3DSelectionStyle): boolean;
|
|
634
661
|
static clearSelection(instance: MahalMap): void;
|
|
635
662
|
static selectedBuilding(instance: MahalMap): string | number | null;
|
|
663
|
+
static selectedBuildingKind(instance: MahalMap): Maps3DSelectionKind | null;
|
|
664
|
+
static getBuildingsMinZoom(instance: MahalMap): number;
|
|
636
665
|
static setSelectionStyle(instance: MahalMap, style: IMaps3DSelectionStyle): void;
|
|
637
|
-
static onRoadClick(instance: MahalMap, callback:
|
|
666
|
+
static onRoadClick(instance: MahalMap, callback: Maps3DListener<IMaps3DRoadHit>): () => void;
|
|
638
667
|
static roadAt(instance: MahalMap, point: {
|
|
639
668
|
x: number;
|
|
640
669
|
y: number;
|
|
641
670
|
}, tolerancePx?: number): IMaps3DRoadHit | null;
|
|
642
|
-
static onParkingHover(instance: MahalMap, callback:
|
|
671
|
+
static onParkingHover(instance: MahalMap, callback: Maps3DListener<IMaps3DParkingInfo>): () => void;
|
|
643
672
|
static setParkingHoverStyle(instance: MahalMap, style: IMaps3DParkingHoverStyle): void;
|
|
644
673
|
static setParkingHoverEnabled(instance: MahalMap, enabled: boolean): void;
|
|
645
674
|
static hoverParking(instance: MahalMap, id: number | string | null): boolean;
|
|
646
675
|
static hoveredParking(instance: MahalMap): string | number | null;
|
|
647
|
-
static onParkingClick(instance: MahalMap, callback:
|
|
676
|
+
static onParkingClick(instance: MahalMap, callback: Maps3DListener<IMaps3DParkingInfo>): () => void;
|
|
648
677
|
static parkingAt(instance: MahalMap, point: {
|
|
649
678
|
x: number;
|
|
650
679
|
y: number;
|
|
651
680
|
}, tolerancePx?: number): IMaps3DParkingInfo | null;
|
|
652
|
-
static onBuildingHover(instance: MahalMap, callback:
|
|
681
|
+
static onBuildingHover(instance: MahalMap, callback: Maps3DListener<IMaps3DBuildingClickInfo>): () => void;
|
|
653
682
|
static setHoverEnabled(instance: MahalMap, enabled: boolean): void;
|
|
654
683
|
static setHoverStyle(instance: MahalMap, style: IMaps3DHoverStyle): void;
|
|
655
684
|
static hoverBuilding(instance: MahalMap, id: number | string | null): boolean;
|
|
@@ -720,7 +749,11 @@ declare class MahalMap {
|
|
|
720
749
|
onLayers(callback: (state: IMaps3DLayerState) => void): () => void;
|
|
721
750
|
/** Пере-применить волю клиента ко всем слоям — после полной смены стиля. */
|
|
722
751
|
refreshLayers(): void;
|
|
723
|
-
/**
|
|
752
|
+
/**
|
|
753
|
+
* Этажи, найденные в текущем виде карты. Пусто — данных по зданию нет.
|
|
754
|
+
* С 0.11.0 они же приходят в onLayers() у слоя `indoor` (`params.levels`) — опрашивать
|
|
755
|
+
* этот метод на движении карты больше не нужно.
|
|
756
|
+
*/
|
|
724
757
|
getIndoorLevels(): number[];
|
|
725
758
|
/** Переключить этаж. Нумерация OSM: 0 — первый наземный. */
|
|
726
759
|
setIndoorLevel(level: number): void;
|
|
@@ -733,21 +766,32 @@ declare class MahalMap {
|
|
|
733
766
|
*/
|
|
734
767
|
showPlace(lon: number, lat: number, level?: number | null, zoom?: number): void;
|
|
735
768
|
/**
|
|
736
|
-
* Клик по зданию: { id, height, props } либо null.
|
|
769
|
+
* Клик по зданию: { id, height, props, index } либо null. `index >= 0` — объёмный дом
|
|
770
|
+
* сцены, `-1` — дом из слоя стиля. Повторный вызов заменяет обработчик, `null` — отписка.
|
|
771
|
+
*
|
|
737
772
|
* Подписываться можно сразу после create(), даже когда слой ещё не поднят
|
|
738
773
|
* (`enable3D: false`) — подписка переиграется, как только слой появится.
|
|
774
|
+
*
|
|
775
|
+
* @returns Отписка. Снимает только эту подписку: если обработчик уже заменён
|
|
776
|
+
* следующим вызовом, ничего не делает.
|
|
739
777
|
*/
|
|
740
|
-
onBuildingClick(callback:
|
|
778
|
+
onBuildingClick(callback: Maps3DListener<IMaps3DBuildingClickInfo>): () => void;
|
|
741
779
|
/** Выделить здание по osm_id. `false` — здания сейчас нет в загруженных данных. */
|
|
742
780
|
selectBuilding(id: number | string | null, style?: IMaps3DSelectionStyle): boolean;
|
|
743
781
|
clearSelection(): void;
|
|
744
782
|
selectedBuilding(): number | string | null;
|
|
783
|
+
/**
|
|
784
|
+
* Чем нарисовано выделение: `'scene'` — объёмный дом сцены, `'flat'` — слой стиля,
|
|
785
|
+
* `null` — выделения нет. На сборке Maps3D до 0.11.0 всегда `null`.
|
|
786
|
+
*/
|
|
787
|
+
selectedBuildingKind(): Maps3DSelectionKind | null;
|
|
745
788
|
setSelectionStyle(style: IMaps3DSelectionStyle): void;
|
|
746
789
|
/**
|
|
747
790
|
* Клик по дороге. Приходит независимо от клика по зданию — приоритет решает приложение.
|
|
748
|
-
* Как и onBuildingClick, переживает отсутствие слоя на момент
|
|
791
|
+
* Как и onBuildingClick, переживает отсутствие слоя на момент подписки, принимает `null`
|
|
792
|
+
* и возвращает отписку.
|
|
749
793
|
*/
|
|
750
|
-
onRoadClick(callback:
|
|
794
|
+
onRoadClick(callback: Maps3DListener<IMaps3DRoadHit>): () => void;
|
|
751
795
|
/** Дорога под точкой холста. Допуск по умолчанию — 12 px. */
|
|
752
796
|
roadAt(point: {
|
|
753
797
|
x: number;
|
|
@@ -758,8 +802,9 @@ declare class MahalMap {
|
|
|
758
802
|
/**
|
|
759
803
|
* Участок под курсором либо null. Зовётся ТОЛЬКО при смене участка, не на каждое
|
|
760
804
|
* движение мыши. `null` вместо колбэка — отписаться и погасить подсветку.
|
|
805
|
+
* Переживает отсутствие слоя на момент подписки; возвращает отписку.
|
|
761
806
|
*/
|
|
762
|
-
onParkingHover(callback:
|
|
807
|
+
onParkingHover(callback: Maps3DListener<IMaps3DParkingInfo>): () => void;
|
|
763
808
|
/** Облик подсветки: color, opacity, outlineColor, outlineWidth, cursor. */
|
|
764
809
|
setParkingHoverStyle(style: IMaps3DParkingHoverStyle): void;
|
|
765
810
|
/** Вкл/выкл наведение, не теряя подписку. */
|
|
@@ -770,8 +815,11 @@ declare class MahalMap {
|
|
|
770
815
|
hoverParking(id: number | string | null): boolean;
|
|
771
816
|
/** `osm_id` подсвеченного участка или null. */
|
|
772
817
|
hoveredParking(): number | string | null;
|
|
773
|
-
/**
|
|
774
|
-
|
|
818
|
+
/**
|
|
819
|
+
* Клик по участку: справка либо null. `null` вместо колбэка — отписаться.
|
|
820
|
+
* Переживает отсутствие слоя на момент подписки; возвращает отписку.
|
|
821
|
+
*/
|
|
822
|
+
onParkingClick(callback: Maps3DListener<IMaps3DParkingInfo>): () => void;
|
|
775
823
|
/**
|
|
776
824
|
* Парковка под точкой холста (`e.point` события карты). Попадание — по границе полигона;
|
|
777
825
|
* допуск по умолчанию 0 — строго внутрь участка.
|
|
@@ -786,8 +834,10 @@ declare class MahalMap {
|
|
|
786
834
|
*
|
|
787
835
|
* Слежение за мышью включается самой подпиской: без неё SDK курсор не трогает и
|
|
788
836
|
* разбор сцены не делает.
|
|
837
|
+
*
|
|
838
|
+
* @returns Отписка; снимает только эту подписку.
|
|
789
839
|
*/
|
|
790
|
-
onBuildingHover(callback:
|
|
840
|
+
onBuildingHover(callback: Maps3DListener<IMaps3DBuildingClickInfo>): () => void;
|
|
791
841
|
/**
|
|
792
842
|
* Включить/выключить наведение, не трогая подписку. Нужно там, где подсветка мешает:
|
|
793
843
|
* режим рисования, открытая карточка объекта, тач-устройство без курсора.
|
|
@@ -808,6 +858,20 @@ declare class MahalMap {
|
|
|
808
858
|
hoverBuilding(id: number | string | null): boolean;
|
|
809
859
|
/** Идентификатор дома под наведением или `null`. */
|
|
810
860
|
hoveredBuilding(): number | string | null;
|
|
861
|
+
/**
|
|
862
|
+
* Зум, с которого поднимается объём: `maps3d.minZoom` из опций create() — ровно то, что
|
|
863
|
+
* уходит в Maps3D, — либо умолчание самой Maps3D (16). Ответ не зависит от текущего
|
|
864
|
+
* зума, в отличие от `rendered` в состоянии слоя.
|
|
865
|
+
*/
|
|
866
|
+
getBuildingsMinZoom(): number;
|
|
867
|
+
/**
|
|
868
|
+
* Занимает слот подписки. Запись живёт до подъёма слоя и переигрывается на нём;
|
|
869
|
+
* отписка снимает слот, только если он всё ещё её.
|
|
870
|
+
*/
|
|
871
|
+
private subscribe;
|
|
872
|
+
private bindSubscription;
|
|
873
|
+
/** Снимает подписку со слоя: её же отпиской, а у сборок до 0.11.0 — через null. */
|
|
874
|
+
private unbindSubscription;
|
|
811
875
|
/**
|
|
812
876
|
* Создаёт слой Maps3D. `buildings` не форсируем в `true`: с 0.7.x видимостью объёма
|
|
813
877
|
* заведует реестр слоёв, а опции облика зданий приходят из options.maps3d как есть.
|
|
@@ -1130,4 +1194,4 @@ declare namespace index {
|
|
|
1130
1194
|
export { index_checkCoordinates as checkCoordinates, index_debounce as debounce, index_geojsonPolyline as geojsonPolyline, index_geometryPolyline as geometryPolyline, index_trimValue as trimValue };
|
|
1131
1195
|
}
|
|
1132
1196
|
|
|
1133
|
-
export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DBuildingsOptions, type IMaps3DClosuresOptions, type IMaps3DDiagnostics, type IMaps3DHoverStyle, type IMaps3DIndoorOptions, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DLayerParams, type IMaps3DLayerState, type IMaps3DMapOptionsInput, type IMaps3DMapOptionsResult, type IMaps3DObjectsLightOptions, type IMaps3DParkingHoverStyle, type IMaps3DParkingInfo, type IMaps3DPlacesOptions, type IMaps3DRoadHit, type IMaps3DSelectionStyle, type IMaps3DTrafficOptions, type IMaps3DTransformRequestOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchDetailAddress, type ISearchDetailInfo, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type MapStyleFamily, type Maps3DBuildingDetail, type Maps3DCtor, type Maps3DLayerId, type Maps3DParkingSubtype, type Maps3DTerrainMode, type Maps3DThemeName, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type SearchResultType, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|
|
1197
|
+
export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DBuildingsOptions, type IMaps3DClosuresOptions, type IMaps3DDiagnostics, type IMaps3DHoverStyle, type IMaps3DIndoorOptions, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DLayerParams, type IMaps3DLayerState, type IMaps3DLayerStateParams, type IMaps3DMapOptionsInput, type IMaps3DMapOptionsResult, type IMaps3DObjectsLightOptions, type IMaps3DParkingHoverStyle, type IMaps3DParkingInfo, type IMaps3DPlacesOptions, type IMaps3DRoadHit, type IMaps3DSelectionStyle, type IMaps3DTrafficOptions, type IMaps3DTransformRequestOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchDetailAddress, type ISearchDetailInfo, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type MapStyleFamily, type Maps3DBuildingDetail, type Maps3DCtor, type Maps3DLayerId, type Maps3DListener, type Maps3DParkingSubtype, type Maps3DSelectionKind, type Maps3DTerrainMode, type Maps3DThemeName, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type SearchResultType, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|