venue-js 1.2.0-next.2 → 1.2.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/dist/index.mjs CHANGED
@@ -593,6 +593,7 @@ import {
593
593
  ui as ui3,
594
594
  Map as Map2,
595
595
  TileLayer,
596
+ Extent,
596
597
  LineString as LineString3,
597
598
  Marker as Marker2,
598
599
  Coordinate as Coordinate4
@@ -678,6 +679,132 @@ function isNumber(num) {
678
679
  // src/IndoorMap/IndoorMap.ts
679
680
  import turfDistance from "@turf/distance";
680
681
  import turfCenter3 from "@turf/center";
682
+
683
+ // ../../node_modules/@turf/meta/dist/esm/index.js
684
+ function coordEach(geojson, callback, excludeWrapCoord) {
685
+ if (geojson === null) return;
686
+ var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
687
+ for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
688
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
689
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
690
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
691
+ for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
692
+ var multiFeatureIndex = 0;
693
+ var geometryIndex = 0;
694
+ geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
695
+ if (geometry === null) continue;
696
+ coords = geometry.coordinates;
697
+ var geomType = geometry.type;
698
+ wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
699
+ switch (geomType) {
700
+ case null:
701
+ break;
702
+ case "Point":
703
+ if (callback(
704
+ coords,
705
+ coordIndex,
706
+ featureIndex,
707
+ multiFeatureIndex,
708
+ geometryIndex
709
+ ) === false)
710
+ return false;
711
+ coordIndex++;
712
+ multiFeatureIndex++;
713
+ break;
714
+ case "LineString":
715
+ case "MultiPoint":
716
+ for (j = 0; j < coords.length; j++) {
717
+ if (callback(
718
+ coords[j],
719
+ coordIndex,
720
+ featureIndex,
721
+ multiFeatureIndex,
722
+ geometryIndex
723
+ ) === false)
724
+ return false;
725
+ coordIndex++;
726
+ if (geomType === "MultiPoint") multiFeatureIndex++;
727
+ }
728
+ if (geomType === "LineString") multiFeatureIndex++;
729
+ break;
730
+ case "Polygon":
731
+ case "MultiLineString":
732
+ for (j = 0; j < coords.length; j++) {
733
+ for (k = 0; k < coords[j].length - wrapShrink; k++) {
734
+ if (callback(
735
+ coords[j][k],
736
+ coordIndex,
737
+ featureIndex,
738
+ multiFeatureIndex,
739
+ geometryIndex
740
+ ) === false)
741
+ return false;
742
+ coordIndex++;
743
+ }
744
+ if (geomType === "MultiLineString") multiFeatureIndex++;
745
+ if (geomType === "Polygon") geometryIndex++;
746
+ }
747
+ if (geomType === "Polygon") multiFeatureIndex++;
748
+ break;
749
+ case "MultiPolygon":
750
+ for (j = 0; j < coords.length; j++) {
751
+ geometryIndex = 0;
752
+ for (k = 0; k < coords[j].length; k++) {
753
+ for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
754
+ if (callback(
755
+ coords[j][k][l],
756
+ coordIndex,
757
+ featureIndex,
758
+ multiFeatureIndex,
759
+ geometryIndex
760
+ ) === false)
761
+ return false;
762
+ coordIndex++;
763
+ }
764
+ geometryIndex++;
765
+ }
766
+ multiFeatureIndex++;
767
+ }
768
+ break;
769
+ case "GeometryCollection":
770
+ for (j = 0; j < geometry.geometries.length; j++)
771
+ if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
772
+ return false;
773
+ break;
774
+ default:
775
+ throw new Error("Unknown Geometry Type");
776
+ }
777
+ }
778
+ }
779
+ }
780
+
781
+ // ../../node_modules/@turf/bbox/dist/esm/index.js
782
+ function bbox(geojson, options = {}) {
783
+ if (geojson.bbox != null && true !== options.recompute) {
784
+ return geojson.bbox;
785
+ }
786
+ const result = [Infinity, Infinity, -Infinity, -Infinity];
787
+ coordEach(geojson, (coord) => {
788
+ if (result[0] > coord[0]) {
789
+ result[0] = coord[0];
790
+ }
791
+ if (result[1] > coord[1]) {
792
+ result[1] = coord[1];
793
+ }
794
+ if (result[2] < coord[0]) {
795
+ result[2] = coord[0];
796
+ }
797
+ if (result[3] < coord[1]) {
798
+ result[3] = coord[1];
799
+ }
800
+ });
801
+ return result;
802
+ }
803
+ var index_default = bbox;
804
+
805
+ // src/IndoorMap/IndoorMap.ts
806
+ import scale from "@turf/transform-scale";
807
+ import bboxPolygon from "@turf/bbox-polygon";
681
808
  import { PerspectiveCamera } from "three";
682
809
 
683
810
  // src/IndoorMap/constants.ts
@@ -2883,133 +3010,8 @@ var createHighlighExtrudeObjectController = (obj, { color }) => {
2883
3010
  };
2884
3011
 
2885
3012
  // src/IndoorMap/camera/CameraManager.ts
2886
- import { Extent } from "maptalks";
2887
-
2888
- // ../../node_modules/@turf/meta/dist/esm/index.js
2889
- function coordEach(geojson, callback, excludeWrapCoord) {
2890
- if (geojson === null) return;
2891
- var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
2892
- for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
2893
- geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
2894
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
2895
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
2896
- for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
2897
- var multiFeatureIndex = 0;
2898
- var geometryIndex = 0;
2899
- geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
2900
- if (geometry === null) continue;
2901
- coords = geometry.coordinates;
2902
- var geomType = geometry.type;
2903
- wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
2904
- switch (geomType) {
2905
- case null:
2906
- break;
2907
- case "Point":
2908
- if (callback(
2909
- coords,
2910
- coordIndex,
2911
- featureIndex,
2912
- multiFeatureIndex,
2913
- geometryIndex
2914
- ) === false)
2915
- return false;
2916
- coordIndex++;
2917
- multiFeatureIndex++;
2918
- break;
2919
- case "LineString":
2920
- case "MultiPoint":
2921
- for (j = 0; j < coords.length; j++) {
2922
- if (callback(
2923
- coords[j],
2924
- coordIndex,
2925
- featureIndex,
2926
- multiFeatureIndex,
2927
- geometryIndex
2928
- ) === false)
2929
- return false;
2930
- coordIndex++;
2931
- if (geomType === "MultiPoint") multiFeatureIndex++;
2932
- }
2933
- if (geomType === "LineString") multiFeatureIndex++;
2934
- break;
2935
- case "Polygon":
2936
- case "MultiLineString":
2937
- for (j = 0; j < coords.length; j++) {
2938
- for (k = 0; k < coords[j].length - wrapShrink; k++) {
2939
- if (callback(
2940
- coords[j][k],
2941
- coordIndex,
2942
- featureIndex,
2943
- multiFeatureIndex,
2944
- geometryIndex
2945
- ) === false)
2946
- return false;
2947
- coordIndex++;
2948
- }
2949
- if (geomType === "MultiLineString") multiFeatureIndex++;
2950
- if (geomType === "Polygon") geometryIndex++;
2951
- }
2952
- if (geomType === "Polygon") multiFeatureIndex++;
2953
- break;
2954
- case "MultiPolygon":
2955
- for (j = 0; j < coords.length; j++) {
2956
- geometryIndex = 0;
2957
- for (k = 0; k < coords[j].length; k++) {
2958
- for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
2959
- if (callback(
2960
- coords[j][k][l],
2961
- coordIndex,
2962
- featureIndex,
2963
- multiFeatureIndex,
2964
- geometryIndex
2965
- ) === false)
2966
- return false;
2967
- coordIndex++;
2968
- }
2969
- geometryIndex++;
2970
- }
2971
- multiFeatureIndex++;
2972
- }
2973
- break;
2974
- case "GeometryCollection":
2975
- for (j = 0; j < geometry.geometries.length; j++)
2976
- if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
2977
- return false;
2978
- break;
2979
- default:
2980
- throw new Error("Unknown Geometry Type");
2981
- }
2982
- }
2983
- }
2984
- }
2985
-
2986
- // ../../node_modules/@turf/bbox/dist/esm/index.js
2987
- function bbox(geojson, options = {}) {
2988
- if (geojson.bbox != null && true !== options.recompute) {
2989
- return geojson.bbox;
2990
- }
2991
- const result = [Infinity, Infinity, -Infinity, -Infinity];
2992
- coordEach(geojson, (coord) => {
2993
- if (result[0] > coord[0]) {
2994
- result[0] = coord[0];
2995
- }
2996
- if (result[1] > coord[1]) {
2997
- result[1] = coord[1];
2998
- }
2999
- if (result[2] < coord[0]) {
3000
- result[2] = coord[0];
3001
- }
3002
- if (result[3] < coord[1]) {
3003
- result[3] = coord[1];
3004
- }
3005
- });
3006
- return result;
3007
- }
3008
- var index_default = bbox;
3009
-
3010
- // src/IndoorMap/camera/CameraManager.ts
3011
- import scale from "@turf/transform-scale";
3012
- import bboxPolygon from "@turf/bbox-polygon";
3013
+ var ZOOM_OUT_LEVEL = 21;
3014
+ var ZOOM_IN_LEVEL = 24;
3013
3015
  var CameraManager = class {
3014
3016
  map;
3015
3017
  constructor(map, options) {
@@ -3018,55 +3020,67 @@ var CameraManager = class {
3018
3020
  this.setView(options?.defaultView);
3019
3021
  }
3020
3022
  }
3023
+ /** Private method */
3024
+ #animateflyTo(viewOptions = {}, options = {}, callbackOption = () => {
3025
+ }) {
3026
+ const { start, end } = {
3027
+ start: (frame) => {
3028
+ },
3029
+ end: (frame) => {
3030
+ },
3031
+ ...callbackOption
3032
+ };
3033
+ this.map.flyTo(viewOptions, options, (frame) => {
3034
+ if (frame.state.playState === "running" && frame.state.progress === 0)
3035
+ start(frame);
3036
+ if (frame.state.playState === "finished") end(frame);
3037
+ });
3038
+ }
3021
3039
  /** Public methods */
3022
3040
  getView = () => {
3023
3041
  return this.map.getView();
3024
3042
  };
3043
+ getZoom = () => {
3044
+ return this.map.getView().zoom;
3045
+ };
3025
3046
  setView = (value) => {
3026
3047
  this.map.setView(value);
3027
3048
  };
3028
- animateTo = (view, options = {}, step) => {
3029
- this.map.animateTo(view, options, step);
3030
- };
3031
- setMaxExtent(extent) {
3032
- return this.map.setMaxExtent(extent);
3033
- }
3034
- getFeatureExtent = (feature2, scaleFactor = 1) => {
3035
- const [minX, minY, maxX, maxY] = index_default(
3036
- scale(bboxPolygon(index_default(feature2)), scaleFactor)
3049
+ flyTo = (center2, options = {}) => {
3050
+ const currentView = this.getView();
3051
+ const {
3052
+ zoom = ZOOM_OUT_LEVEL,
3053
+ pitch = 60,
3054
+ duration = 600,
3055
+ easing = "out",
3056
+ bearing = currentView.bearing
3057
+ } = options;
3058
+ this.#animateflyTo(
3059
+ {
3060
+ center: center2,
3061
+ zoom,
3062
+ pitch,
3063
+ bearing
3064
+ },
3065
+ { duration, easing }
3037
3066
  );
3038
- return new Extent(minX, minY, maxX, maxY);
3039
3067
  };
3040
- getExtentZoom = (extent, options = {
3041
- isFraction: false,
3042
- padding: {
3043
- paddingLeft: 0,
3044
- paddingRight: 0,
3045
- paddingTop: 0,
3046
- paddingBottom: 0
3047
- }
3048
- }) => {
3049
- const { isFraction = false, padding } = options;
3050
- return this.map.getFitZoom(extent, isFraction, padding);
3068
+ flyToAndZoomIn = (centerPoint, options = {}) => {
3069
+ const {
3070
+ zoom = ZOOM_IN_LEVEL,
3071
+ pitch = 60,
3072
+ duration = 600,
3073
+ easing = "out"
3074
+ } = options;
3075
+ this.#animateflyTo(
3076
+ {
3077
+ center: centerPoint,
3078
+ zoom,
3079
+ pitch
3080
+ },
3081
+ { duration, easing }
3082
+ );
3051
3083
  };
3052
- set maxZoom(value) {
3053
- this.map.setMaxZoom(value);
3054
- const spatialReference = {
3055
- projection: "EPSG:3857",
3056
- resolutions: (function() {
3057
- const resolutions = [];
3058
- const d = 2 * 6378137 * Math.PI;
3059
- for (let i = 0; i < value; i++) {
3060
- resolutions[i] = d / (256 * Math.pow(2, i));
3061
- }
3062
- return resolutions;
3063
- })()
3064
- };
3065
- this.map.setSpatialReference(spatialReference);
3066
- }
3067
- set minZoom(value) {
3068
- this.map.setMinZoom(value);
3069
- }
3070
3084
  };
3071
3085
 
3072
3086
  // src/IndoorMap/renderer/RendererManager.ts
@@ -3368,45 +3382,41 @@ var Element3DRenderer = class extends EventTarget {
3368
3382
  } = getGeometryOption(feature2, this.options);
3369
3383
  const _this = this;
3370
3384
  const createPolygon = (geometry, feature3) => {
3371
- try {
3372
- const [outerRing, ...innerRings] = geometry.coordinates;
3373
- const offsetFeature = offset !== 0 ? turfBuffer2(geometry, offset, { units: "meters" }) : feature3;
3374
- const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#ffffff";
3375
- if (color === "transparent") return;
3376
- const material = this.getOrCreateMaterialByColor(color);
3377
- const altitude = feature3.properties.ordinal * HEIGHT_METER;
3378
- const height = feature3.properties.height ?? heightOptions ?? HEIGHT_METER;
3379
- const bottomHeight = feature3.properties.bottomHeight ?? bottomHeightOptions ?? 0;
3380
- const extrudedPolygon = this.threeLayer.toExtrudePolygon(
3381
- offsetFeature,
3382
- { asynchronous: true, ...options, height, bottomHeight, altitude },
3383
- material
3384
- );
3385
- extrudedPolygon.on("click", (e) => {
3386
- console.log(e.target.options.polygon.id);
3387
- });
3388
- const topLineStrings = [
3389
- new maptalks4.LineString(outerRing),
3390
- ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3391
- ];
3392
- const topLines = this.threeLayer.toLines(
3393
- topLineStrings,
3394
- { altitude, bottomHeight: bottomHeight + height + 1e-3, interactive: false },
3395
- this.lineMaterial
3396
- );
3397
- const bottomLineStrings = [
3398
- new maptalks4.LineString(outerRing),
3399
- ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3400
- ];
3401
- const bottomLines = this.threeLayer.toLines(
3402
- bottomLineStrings,
3403
- { altitude, bottomHeight, interactive: false },
3404
- this.lineMaterial
3405
- );
3406
- return [extrudedPolygon, topLines, bottomLines];
3407
- } catch (err) {
3408
- throw new Error(`Cannot create polygon, ${err.message}`);
3409
- }
3385
+ const [outerRing, ...innerRings] = geometry.coordinates;
3386
+ const offsetFeature = offset !== 0 ? turfBuffer2(geometry, offset, { units: "meters" }) : feature3;
3387
+ const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#ffffff";
3388
+ if (color === "transparent") return;
3389
+ const material = this.getOrCreateMaterialByColor(color);
3390
+ const altitude = feature3.properties.ordinal * HEIGHT_METER;
3391
+ const height = feature3.properties.height ?? heightOptions ?? HEIGHT_METER;
3392
+ const bottomHeight = feature3.properties.bottomHeight ?? bottomHeightOptions ?? 0;
3393
+ const extrudedPolygon = this.threeLayer.toExtrudePolygon(
3394
+ offsetFeature,
3395
+ { asynchronous: true, ...options, height, bottomHeight, altitude },
3396
+ material
3397
+ );
3398
+ extrudedPolygon.on("click", (e) => {
3399
+ console.log(e.target.options.polygon.id);
3400
+ });
3401
+ const topLineStrings = [
3402
+ new maptalks4.LineString(outerRing),
3403
+ ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3404
+ ];
3405
+ const topLines = this.threeLayer.toLines(
3406
+ topLineStrings,
3407
+ { altitude, bottomHeight: bottomHeight + height + 1e-3, interactive: false },
3408
+ this.lineMaterial
3409
+ );
3410
+ const bottomLineStrings = [
3411
+ new maptalks4.LineString(outerRing),
3412
+ ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3413
+ ];
3414
+ const bottomLines = this.threeLayer.toLines(
3415
+ bottomLineStrings,
3416
+ { altitude, bottomHeight, interactive: false },
3417
+ this.lineMaterial
3418
+ );
3419
+ return [extrudedPolygon, topLines, bottomLines];
3410
3420
  };
3411
3421
  try {
3412
3422
  switch (feature2.geometry.type) {
@@ -3426,7 +3436,7 @@ var Element3DRenderer = class extends EventTarget {
3426
3436
  }
3427
3437
  }
3428
3438
  } catch (err) {
3429
- console.log(`error createGeometry`, err, { feature: feature2, options });
3439
+ console.log(`error createGeometry`, { feature: feature2, options });
3430
3440
  }
3431
3441
  };
3432
3442
  async createEscalator(f, coordinate, options) {
@@ -3996,8 +4006,6 @@ var RendererManager = class extends EventTarget {
3996
4006
  }
3997
4007
  const thisOrdinal = escalator.properties.ordinal;
3998
4008
  const relationship = escalatorRelationships[0];
3999
- if (!relationship.properties.origin?.id) throw new Error(`relationship (id=${relationship.id}) - origin not exists`);
4000
- if (!relationship.properties.destination?.id) throw new Error(`relationship (id=${relationship.id}) - destination not exists`);
4001
4009
  const bothOpeningIds = [relationship.properties.origin.id, relationship.properties.destination.id];
4002
4010
  const bothOpenings = await Promise.all(
4003
4011
  bothOpeningIds.map((id) => this.#dataClient.findById("opening", id, { populate: true }))
@@ -4013,7 +4021,7 @@ var RendererManager = class extends EventTarget {
4013
4021
  this.addElementsToManager(escalator.id, _elements, escalator.properties.ordinal);
4014
4022
  }
4015
4023
  } catch (err) {
4016
- console.log(`cannot create escalator`, err.message);
4024
+ console.log(`cannot create escalator`, err);
4017
4025
  }
4018
4026
  }
4019
4027
  this.changeLevelByOrdinal(this.currentOrdinals);
@@ -4149,7 +4157,7 @@ var IndoorMap = class extends EventTarget {
4149
4157
  layers: []
4150
4158
  });
4151
4159
  this.rendererManager = new RendererManager(this.map, options.dataClient, options.renderer);
4152
- this.camera = new CameraManager(this.map, options.camera);
4160
+ this.camera = new CameraManager(this.map);
4153
4161
  this.locale = locale;
4154
4162
  this.pixelRatio = pixelRatio;
4155
4163
  this.onMapReady = onMapReady;
@@ -4167,12 +4175,12 @@ var IndoorMap = class extends EventTarget {
4167
4175
  this.camera.setView({ center: center2, pitch: 60, zoom: 19 });
4168
4176
  });
4169
4177
  }
4170
- /**
4171
- * Events
4172
- */
4173
4178
  on(eventName, handler) {
4174
4179
  this.map.on(eventName, handler);
4175
4180
  }
4181
+ /**
4182
+ * Events
4183
+ */
4176
4184
  handleMapClick = ({ coordinate }) => {
4177
4185
  const { x, y } = coordinate;
4178
4186
  console.log(
@@ -4228,12 +4236,40 @@ var IndoorMap = class extends EventTarget {
4228
4236
  this.map.off("moveend", this.#findAndSetVenueInView);
4229
4237
  }
4230
4238
  }
4239
+ get ordinals() {
4240
+ return this.#ordinals || [];
4241
+ }
4242
+ set ordinals(value) {
4243
+ if (!Array.isArray(value)) throw new Error("ordinals must be Array");
4244
+ this.#ordinals = value;
4245
+ }
4231
4246
  set billboards(value) {
4232
4247
  this.#billboards = value;
4233
4248
  }
4249
+ set mapConfig(value) {
4250
+ this.#mapConfig = value;
4251
+ }
4234
4252
  set mapDecorations(value) {
4235
4253
  this.#mapDecorations = value;
4236
4254
  }
4255
+ set maxZoom(value) {
4256
+ this.map.setMaxZoom(value);
4257
+ const spatialReference = {
4258
+ projection: "EPSG:3857",
4259
+ resolutions: (function() {
4260
+ const resolutions = [];
4261
+ const d = 2 * 6378137 * Math.PI;
4262
+ for (let i = 0; i < value; i++) {
4263
+ resolutions[i] = d / (256 * Math.pow(2, i));
4264
+ }
4265
+ return resolutions;
4266
+ })()
4267
+ };
4268
+ this.map.setSpatialReference(spatialReference);
4269
+ }
4270
+ set minZoom(value) {
4271
+ this.map.setMinZoom(value);
4272
+ }
4237
4273
  set groundLabels(value) {
4238
4274
  this.#groundLabels = value;
4239
4275
  }
@@ -4269,6 +4305,9 @@ var IndoorMap = class extends EventTarget {
4269
4305
  this.#onClickElement(e);
4270
4306
  this.#isClicked = false;
4271
4307
  };
4308
+ setCenter(center2, padding) {
4309
+ this.map.setCenter(center2, padding);
4310
+ }
4272
4311
  async #legacy_createElements() {
4273
4312
  const {
4274
4313
  // 2D
@@ -4490,7 +4529,7 @@ var IndoorMap = class extends EventTarget {
4490
4529
  const {
4491
4530
  geometry: { coordinates }
4492
4531
  } = turfCenter3(feature2);
4493
- this.camera.animateTo({ center: coordinates, pitch: 45 });
4532
+ this.camera.flyToAndZoomIn(coordinates, { pitch: 45 });
4494
4533
  });
4495
4534
  object3ds.push(object);
4496
4535
  this.#objects.push(object);
@@ -4573,6 +4612,27 @@ var IndoorMap = class extends EventTarget {
4573
4612
  changeLevelByOrdinal(ordinal) {
4574
4613
  this.rendererManager.changeLevelByOrdinal(ordinal);
4575
4614
  }
4615
+ getFeatureExtent = (feature2, scaleFactor = 1) => {
4616
+ const [minX, minY, maxX, maxY] = index_default(
4617
+ scale(bboxPolygon(index_default(feature2)), scaleFactor)
4618
+ );
4619
+ return new Extent(minX, minY, maxX, maxY);
4620
+ };
4621
+ getExtentCenter = (extent) => {
4622
+ return extent.getCenter();
4623
+ };
4624
+ getExtentZoom = (extent, options = {
4625
+ isFraction: false,
4626
+ padding: {
4627
+ paddingLeft: 0,
4628
+ paddingRight: 0,
4629
+ paddingTop: 0,
4630
+ paddingBottom: 0
4631
+ }
4632
+ }) => {
4633
+ const { isFraction = false, padding } = options;
4634
+ return this.map.getFitZoom(extent, isFraction, padding);
4635
+ };
4576
4636
  findVenueInView = () => {
4577
4637
  const mapCenter = this.map.getCenter();
4578
4638
  const result = this.#venues.reduce((closest, venue) => {
@@ -4585,6 +4645,9 @@ var IndoorMap = class extends EventTarget {
4585
4645
  }, null);
4586
4646
  return result;
4587
4647
  };
4648
+ flyTo = (center2, options) => {
4649
+ this.camera.flyTo(center2, options);
4650
+ };
4588
4651
  getLineStringBearing = (feature2) => {
4589
4652
  const { geometry } = feature2;
4590
4653
  const path = new LineString3(geometry.coordinates);
@@ -5100,6 +5163,33 @@ var IndoorMap = class extends EventTarget {
5100
5163
  /**
5101
5164
  * render (frame)
5102
5165
  */
5166
+ getTargetViewCenter = (targetView, options = { offset: { top: 0, left: 0, right: 0, bottom: 0 } }) => {
5167
+ const map = this.map;
5168
+ const { offset } = options;
5169
+ const { top = 0, left = 0, right = 0, bottom = 0 } = offset;
5170
+ const originalState = {
5171
+ bearing: map.getBearing(),
5172
+ center: map.getCenter(),
5173
+ pitch: map.getPitch(),
5174
+ zoom: map.getZoom()
5175
+ };
5176
+ const finalView = {
5177
+ bearing: _6.isNil(targetView.bearing) ? map.getBearing() : targetView.bearing,
5178
+ center: _6.isNil(targetView.center) ? map.getCenter() : targetView.center,
5179
+ pitch: _6.isNil(targetView.pitch) ? map.getPitch() : targetView.pitch,
5180
+ zoom: _6.isNil(targetView.zoom) ? map.getZoom() : targetView.zoom
5181
+ };
5182
+ map.setView(finalView);
5183
+ const projectedTargetCenter = map.coordinateToContainerPoint(finalView.center).add(right / 2 - left / 2, bottom / 2 - top / 2);
5184
+ const adjustedTargetCenter = map.containerPointToCoordinate(
5185
+ projectedTargetCenter
5186
+ );
5187
+ map.setView(originalState);
5188
+ return adjustedTargetCenter;
5189
+ };
5190
+ setMaxExtent(extent) {
5191
+ return this.map.setMaxExtent(extent);
5192
+ }
5103
5193
  render() {
5104
5194
  const view = this.map.getView();
5105
5195
  const currBearing = view.bearing;
@@ -5108,8 +5198,7 @@ var IndoorMap = class extends EventTarget {
5108
5198
  this.threeLayer.redraw();
5109
5199
  }
5110
5200
  if (this.threeLayer) {
5111
- const currentView = this.camera.getView();
5112
- const objectOpacity = _6.clamp(38 - 2 * currentView.zoom, 0, 1);
5201
+ const objectOpacity = _6.clamp(38 - 2 * this.camera.getZoom(), 0, 1);
5113
5202
  this.#objects.forEach((object) => {
5114
5203
  object.getObject3d().traverse((child) => {
5115
5204
  if (child.isMesh) child.material.opacity = objectOpacity;
@@ -5120,7 +5209,7 @@ var IndoorMap = class extends EventTarget {
5120
5209
  if (this.#billboardObjects) {
5121
5210
  this.#billboardObjects.forEach((object) => {
5122
5211
  const objectScale = _6.clamp(
5123
- 20 - 1 * currentView.zoom,
5212
+ 20 - 1 * this.camera.getZoom(),
5124
5213
  1,
5125
5214
  1.05
5126
5215
  );