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.js CHANGED
@@ -751,6 +751,132 @@ function isNumber(num) {
751
751
  // src/IndoorMap/IndoorMap.ts
752
752
  var import_distance = __toESM(require("@turf/distance"));
753
753
  var import_center4 = __toESM(require("@turf/center"));
754
+
755
+ // ../../node_modules/@turf/meta/dist/esm/index.js
756
+ function coordEach(geojson, callback, excludeWrapCoord) {
757
+ if (geojson === null) return;
758
+ 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;
759
+ for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
760
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
761
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
762
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
763
+ for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
764
+ var multiFeatureIndex = 0;
765
+ var geometryIndex = 0;
766
+ geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
767
+ if (geometry === null) continue;
768
+ coords = geometry.coordinates;
769
+ var geomType = geometry.type;
770
+ wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
771
+ switch (geomType) {
772
+ case null:
773
+ break;
774
+ case "Point":
775
+ if (callback(
776
+ coords,
777
+ coordIndex,
778
+ featureIndex,
779
+ multiFeatureIndex,
780
+ geometryIndex
781
+ ) === false)
782
+ return false;
783
+ coordIndex++;
784
+ multiFeatureIndex++;
785
+ break;
786
+ case "LineString":
787
+ case "MultiPoint":
788
+ for (j = 0; j < coords.length; j++) {
789
+ if (callback(
790
+ coords[j],
791
+ coordIndex,
792
+ featureIndex,
793
+ multiFeatureIndex,
794
+ geometryIndex
795
+ ) === false)
796
+ return false;
797
+ coordIndex++;
798
+ if (geomType === "MultiPoint") multiFeatureIndex++;
799
+ }
800
+ if (geomType === "LineString") multiFeatureIndex++;
801
+ break;
802
+ case "Polygon":
803
+ case "MultiLineString":
804
+ for (j = 0; j < coords.length; j++) {
805
+ for (k = 0; k < coords[j].length - wrapShrink; k++) {
806
+ if (callback(
807
+ coords[j][k],
808
+ coordIndex,
809
+ featureIndex,
810
+ multiFeatureIndex,
811
+ geometryIndex
812
+ ) === false)
813
+ return false;
814
+ coordIndex++;
815
+ }
816
+ if (geomType === "MultiLineString") multiFeatureIndex++;
817
+ if (geomType === "Polygon") geometryIndex++;
818
+ }
819
+ if (geomType === "Polygon") multiFeatureIndex++;
820
+ break;
821
+ case "MultiPolygon":
822
+ for (j = 0; j < coords.length; j++) {
823
+ geometryIndex = 0;
824
+ for (k = 0; k < coords[j].length; k++) {
825
+ for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
826
+ if (callback(
827
+ coords[j][k][l],
828
+ coordIndex,
829
+ featureIndex,
830
+ multiFeatureIndex,
831
+ geometryIndex
832
+ ) === false)
833
+ return false;
834
+ coordIndex++;
835
+ }
836
+ geometryIndex++;
837
+ }
838
+ multiFeatureIndex++;
839
+ }
840
+ break;
841
+ case "GeometryCollection":
842
+ for (j = 0; j < geometry.geometries.length; j++)
843
+ if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
844
+ return false;
845
+ break;
846
+ default:
847
+ throw new Error("Unknown Geometry Type");
848
+ }
849
+ }
850
+ }
851
+ }
852
+
853
+ // ../../node_modules/@turf/bbox/dist/esm/index.js
854
+ function bbox(geojson, options = {}) {
855
+ if (geojson.bbox != null && true !== options.recompute) {
856
+ return geojson.bbox;
857
+ }
858
+ const result = [Infinity, Infinity, -Infinity, -Infinity];
859
+ coordEach(geojson, (coord) => {
860
+ if (result[0] > coord[0]) {
861
+ result[0] = coord[0];
862
+ }
863
+ if (result[1] > coord[1]) {
864
+ result[1] = coord[1];
865
+ }
866
+ if (result[2] < coord[0]) {
867
+ result[2] = coord[0];
868
+ }
869
+ if (result[3] < coord[1]) {
870
+ result[3] = coord[1];
871
+ }
872
+ });
873
+ return result;
874
+ }
875
+ var index_default = bbox;
876
+
877
+ // src/IndoorMap/IndoorMap.ts
878
+ var import_transform_scale = __toESM(require("@turf/transform-scale"));
879
+ var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
754
880
  var import_three8 = require("three");
755
881
 
756
882
  // src/IndoorMap/constants.ts
@@ -2930,133 +3056,8 @@ var createHighlighExtrudeObjectController = (obj, { color }) => {
2930
3056
  };
2931
3057
 
2932
3058
  // src/IndoorMap/camera/CameraManager.ts
2933
- var import_maptalks6 = require("maptalks");
2934
-
2935
- // ../../node_modules/@turf/meta/dist/esm/index.js
2936
- function coordEach(geojson, callback, excludeWrapCoord) {
2937
- if (geojson === null) return;
2938
- 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;
2939
- for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
2940
- geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
2941
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
2942
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
2943
- for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
2944
- var multiFeatureIndex = 0;
2945
- var geometryIndex = 0;
2946
- geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
2947
- if (geometry === null) continue;
2948
- coords = geometry.coordinates;
2949
- var geomType = geometry.type;
2950
- wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
2951
- switch (geomType) {
2952
- case null:
2953
- break;
2954
- case "Point":
2955
- if (callback(
2956
- coords,
2957
- coordIndex,
2958
- featureIndex,
2959
- multiFeatureIndex,
2960
- geometryIndex
2961
- ) === false)
2962
- return false;
2963
- coordIndex++;
2964
- multiFeatureIndex++;
2965
- break;
2966
- case "LineString":
2967
- case "MultiPoint":
2968
- for (j = 0; j < coords.length; j++) {
2969
- if (callback(
2970
- coords[j],
2971
- coordIndex,
2972
- featureIndex,
2973
- multiFeatureIndex,
2974
- geometryIndex
2975
- ) === false)
2976
- return false;
2977
- coordIndex++;
2978
- if (geomType === "MultiPoint") multiFeatureIndex++;
2979
- }
2980
- if (geomType === "LineString") multiFeatureIndex++;
2981
- break;
2982
- case "Polygon":
2983
- case "MultiLineString":
2984
- for (j = 0; j < coords.length; j++) {
2985
- for (k = 0; k < coords[j].length - wrapShrink; k++) {
2986
- if (callback(
2987
- coords[j][k],
2988
- coordIndex,
2989
- featureIndex,
2990
- multiFeatureIndex,
2991
- geometryIndex
2992
- ) === false)
2993
- return false;
2994
- coordIndex++;
2995
- }
2996
- if (geomType === "MultiLineString") multiFeatureIndex++;
2997
- if (geomType === "Polygon") geometryIndex++;
2998
- }
2999
- if (geomType === "Polygon") multiFeatureIndex++;
3000
- break;
3001
- case "MultiPolygon":
3002
- for (j = 0; j < coords.length; j++) {
3003
- geometryIndex = 0;
3004
- for (k = 0; k < coords[j].length; k++) {
3005
- for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
3006
- if (callback(
3007
- coords[j][k][l],
3008
- coordIndex,
3009
- featureIndex,
3010
- multiFeatureIndex,
3011
- geometryIndex
3012
- ) === false)
3013
- return false;
3014
- coordIndex++;
3015
- }
3016
- geometryIndex++;
3017
- }
3018
- multiFeatureIndex++;
3019
- }
3020
- break;
3021
- case "GeometryCollection":
3022
- for (j = 0; j < geometry.geometries.length; j++)
3023
- if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
3024
- return false;
3025
- break;
3026
- default:
3027
- throw new Error("Unknown Geometry Type");
3028
- }
3029
- }
3030
- }
3031
- }
3032
-
3033
- // ../../node_modules/@turf/bbox/dist/esm/index.js
3034
- function bbox(geojson, options = {}) {
3035
- if (geojson.bbox != null && true !== options.recompute) {
3036
- return geojson.bbox;
3037
- }
3038
- const result = [Infinity, Infinity, -Infinity, -Infinity];
3039
- coordEach(geojson, (coord) => {
3040
- if (result[0] > coord[0]) {
3041
- result[0] = coord[0];
3042
- }
3043
- if (result[1] > coord[1]) {
3044
- result[1] = coord[1];
3045
- }
3046
- if (result[2] < coord[0]) {
3047
- result[2] = coord[0];
3048
- }
3049
- if (result[3] < coord[1]) {
3050
- result[3] = coord[1];
3051
- }
3052
- });
3053
- return result;
3054
- }
3055
- var index_default = bbox;
3056
-
3057
- // src/IndoorMap/camera/CameraManager.ts
3058
- var import_transform_scale = __toESM(require("@turf/transform-scale"));
3059
- var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
3059
+ var ZOOM_OUT_LEVEL = 21;
3060
+ var ZOOM_IN_LEVEL = 24;
3060
3061
  var CameraManager = class {
3061
3062
  map;
3062
3063
  constructor(map, options) {
@@ -3065,61 +3066,73 @@ var CameraManager = class {
3065
3066
  this.setView(options?.defaultView);
3066
3067
  }
3067
3068
  }
3069
+ /** Private method */
3070
+ #animateflyTo(viewOptions = {}, options = {}, callbackOption = () => {
3071
+ }) {
3072
+ const { start, end } = {
3073
+ start: (frame) => {
3074
+ },
3075
+ end: (frame) => {
3076
+ },
3077
+ ...callbackOption
3078
+ };
3079
+ this.map.flyTo(viewOptions, options, (frame) => {
3080
+ if (frame.state.playState === "running" && frame.state.progress === 0)
3081
+ start(frame);
3082
+ if (frame.state.playState === "finished") end(frame);
3083
+ });
3084
+ }
3068
3085
  /** Public methods */
3069
3086
  getView = () => {
3070
3087
  return this.map.getView();
3071
3088
  };
3089
+ getZoom = () => {
3090
+ return this.map.getView().zoom;
3091
+ };
3072
3092
  setView = (value) => {
3073
3093
  this.map.setView(value);
3074
3094
  };
3075
- animateTo = (view, options = {}, step) => {
3076
- this.map.animateTo(view, options, step);
3077
- };
3078
- setMaxExtent(extent) {
3079
- return this.map.setMaxExtent(extent);
3080
- }
3081
- getFeatureExtent = (feature2, scaleFactor = 1) => {
3082
- const [minX, minY, maxX, maxY] = index_default(
3083
- (0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
3095
+ flyTo = (center2, options = {}) => {
3096
+ const currentView = this.getView();
3097
+ const {
3098
+ zoom = ZOOM_OUT_LEVEL,
3099
+ pitch = 60,
3100
+ duration = 600,
3101
+ easing = "out",
3102
+ bearing = currentView.bearing
3103
+ } = options;
3104
+ this.#animateflyTo(
3105
+ {
3106
+ center: center2,
3107
+ zoom,
3108
+ pitch,
3109
+ bearing
3110
+ },
3111
+ { duration, easing }
3084
3112
  );
3085
- return new import_maptalks6.Extent(minX, minY, maxX, maxY);
3086
3113
  };
3087
- getExtentZoom = (extent, options = {
3088
- isFraction: false,
3089
- padding: {
3090
- paddingLeft: 0,
3091
- paddingRight: 0,
3092
- paddingTop: 0,
3093
- paddingBottom: 0
3094
- }
3095
- }) => {
3096
- const { isFraction = false, padding } = options;
3097
- return this.map.getFitZoom(extent, isFraction, padding);
3114
+ flyToAndZoomIn = (centerPoint, options = {}) => {
3115
+ const {
3116
+ zoom = ZOOM_IN_LEVEL,
3117
+ pitch = 60,
3118
+ duration = 600,
3119
+ easing = "out"
3120
+ } = options;
3121
+ this.#animateflyTo(
3122
+ {
3123
+ center: centerPoint,
3124
+ zoom,
3125
+ pitch
3126
+ },
3127
+ { duration, easing }
3128
+ );
3098
3129
  };
3099
- set maxZoom(value) {
3100
- this.map.setMaxZoom(value);
3101
- const spatialReference = {
3102
- projection: "EPSG:3857",
3103
- resolutions: (function() {
3104
- const resolutions = [];
3105
- const d = 2 * 6378137 * Math.PI;
3106
- for (let i = 0; i < value; i++) {
3107
- resolutions[i] = d / (256 * Math.pow(2, i));
3108
- }
3109
- return resolutions;
3110
- })()
3111
- };
3112
- this.map.setSpatialReference(spatialReference);
3113
- }
3114
- set minZoom(value) {
3115
- this.map.setMinZoom(value);
3116
- }
3117
3130
  };
3118
3131
 
3119
3132
  // src/IndoorMap/renderer/RendererManager.ts
3120
3133
  var import_min = __toESM(require("lodash/min"));
3121
3134
  var import_center3 = require("@turf/center");
3122
- var import_maptalks9 = require("maptalks.three");
3135
+ var import_maptalks8 = require("maptalks.three");
3123
3136
  var THREE3 = __toESM(require("three"));
3124
3137
 
3125
3138
  // src/IndoorMap/renderer/3d/Element3DRenderer.ts
@@ -3155,9 +3168,9 @@ var element3DRendererOptions = {
3155
3168
  };
3156
3169
 
3157
3170
  // src/IndoorMap/renderer/3d/objects/TextSpriteMarker.ts
3158
- var import_maptalks7 = require("maptalks");
3171
+ var import_maptalks6 = require("maptalks");
3159
3172
  var THREE = __toESM(require("three"));
3160
- var import_maptalks8 = require("maptalks.three");
3173
+ var import_maptalks7 = require("maptalks.three");
3161
3174
  var import_lodash6 = require("lodash");
3162
3175
 
3163
3176
  // src/IndoorMap/renderer/utils/interpolateStops.ts
@@ -3195,12 +3208,12 @@ var OPTIONS4 = {
3195
3208
  altitude: 0,
3196
3209
  opacity: 1
3197
3210
  };
3198
- var TextSpriteMarker = class extends import_maptalks8.BaseObject {
3211
+ var TextSpriteMarker = class extends import_maptalks7.BaseObject {
3199
3212
  #altitudeOffset = 0;
3200
3213
  constructor(coordinate, options, layer, properties = {}) {
3201
- options = import_maptalks7.Util.extend({}, OPTIONS4, options, { layer });
3214
+ options = import_maptalks6.Util.extend({}, OPTIONS4, options, { layer });
3202
3215
  super();
3203
- this._coordinate = new import_maptalks7.Coordinate(coordinate);
3216
+ this._coordinate = new import_maptalks6.Coordinate(coordinate);
3204
3217
  this._initOptions(options);
3205
3218
  this._createGroup();
3206
3219
  this.properties = { ...properties };
@@ -3415,45 +3428,41 @@ var Element3DRenderer = class extends EventTarget {
3415
3428
  } = getGeometryOption(feature2, this.options);
3416
3429
  const _this = this;
3417
3430
  const createPolygon = (geometry, feature3) => {
3418
- try {
3419
- const [outerRing, ...innerRings] = geometry.coordinates;
3420
- const offsetFeature = offset !== 0 ? (0, import_buffer2.default)(geometry, offset, { units: "meters" }) : feature3;
3421
- const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#ffffff";
3422
- if (color === "transparent") return;
3423
- const material = this.getOrCreateMaterialByColor(color);
3424
- const altitude = feature3.properties.ordinal * HEIGHT_METER;
3425
- const height = feature3.properties.height ?? heightOptions ?? HEIGHT_METER;
3426
- const bottomHeight = feature3.properties.bottomHeight ?? bottomHeightOptions ?? 0;
3427
- const extrudedPolygon = this.threeLayer.toExtrudePolygon(
3428
- offsetFeature,
3429
- { asynchronous: true, ...options, height, bottomHeight, altitude },
3430
- material
3431
- );
3432
- extrudedPolygon.on("click", (e) => {
3433
- console.log(e.target.options.polygon.id);
3434
- });
3435
- const topLineStrings = [
3436
- new maptalks4.LineString(outerRing),
3437
- ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3438
- ];
3439
- const topLines = this.threeLayer.toLines(
3440
- topLineStrings,
3441
- { altitude, bottomHeight: bottomHeight + height + 1e-3, interactive: false },
3442
- this.lineMaterial
3443
- );
3444
- const bottomLineStrings = [
3445
- new maptalks4.LineString(outerRing),
3446
- ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3447
- ];
3448
- const bottomLines = this.threeLayer.toLines(
3449
- bottomLineStrings,
3450
- { altitude, bottomHeight, interactive: false },
3451
- this.lineMaterial
3452
- );
3453
- return [extrudedPolygon, topLines, bottomLines];
3454
- } catch (err) {
3455
- throw new Error(`Cannot create polygon, ${err.message}`);
3456
- }
3431
+ const [outerRing, ...innerRings] = geometry.coordinates;
3432
+ const offsetFeature = offset !== 0 ? (0, import_buffer2.default)(geometry, offset, { units: "meters" }) : feature3;
3433
+ const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#ffffff";
3434
+ if (color === "transparent") return;
3435
+ const material = this.getOrCreateMaterialByColor(color);
3436
+ const altitude = feature3.properties.ordinal * HEIGHT_METER;
3437
+ const height = feature3.properties.height ?? heightOptions ?? HEIGHT_METER;
3438
+ const bottomHeight = feature3.properties.bottomHeight ?? bottomHeightOptions ?? 0;
3439
+ const extrudedPolygon = this.threeLayer.toExtrudePolygon(
3440
+ offsetFeature,
3441
+ { asynchronous: true, ...options, height, bottomHeight, altitude },
3442
+ material
3443
+ );
3444
+ extrudedPolygon.on("click", (e) => {
3445
+ console.log(e.target.options.polygon.id);
3446
+ });
3447
+ const topLineStrings = [
3448
+ new maptalks4.LineString(outerRing),
3449
+ ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3450
+ ];
3451
+ const topLines = this.threeLayer.toLines(
3452
+ topLineStrings,
3453
+ { altitude, bottomHeight: bottomHeight + height + 1e-3, interactive: false },
3454
+ this.lineMaterial
3455
+ );
3456
+ const bottomLineStrings = [
3457
+ new maptalks4.LineString(outerRing),
3458
+ ...innerRings.map((innerRing) => new maptalks4.LineString(innerRing))
3459
+ ];
3460
+ const bottomLines = this.threeLayer.toLines(
3461
+ bottomLineStrings,
3462
+ { altitude, bottomHeight, interactive: false },
3463
+ this.lineMaterial
3464
+ );
3465
+ return [extrudedPolygon, topLines, bottomLines];
3457
3466
  };
3458
3467
  try {
3459
3468
  switch (feature2.geometry.type) {
@@ -3473,7 +3482,7 @@ var Element3DRenderer = class extends EventTarget {
3473
3482
  }
3474
3483
  }
3475
3484
  } catch (err) {
3476
- console.log(`error createGeometry`, err, { feature: feature2, options });
3485
+ console.log(`error createGeometry`, { feature: feature2, options });
3477
3486
  }
3478
3487
  };
3479
3488
  async createEscalator(f, coordinate, options) {
@@ -3934,7 +3943,7 @@ var RendererManager = class extends EventTarget {
3934
3943
  this.markersByOrdinal = /* @__PURE__ */ new Map();
3935
3944
  this.#dataClient = dataClient;
3936
3945
  if (options.type === "3D") {
3937
- const threeLayer = new import_maptalks9.ThreeLayer("elements", {
3946
+ const threeLayer = new import_maptalks8.ThreeLayer("elements", {
3938
3947
  forceRenderOnMoving: true,
3939
3948
  forceRenderOnRotating: true
3940
3949
  });
@@ -4043,8 +4052,6 @@ var RendererManager = class extends EventTarget {
4043
4052
  }
4044
4053
  const thisOrdinal = escalator.properties.ordinal;
4045
4054
  const relationship = escalatorRelationships[0];
4046
- if (!relationship.properties.origin?.id) throw new Error(`relationship (id=${relationship.id}) - origin not exists`);
4047
- if (!relationship.properties.destination?.id) throw new Error(`relationship (id=${relationship.id}) - destination not exists`);
4048
4055
  const bothOpeningIds = [relationship.properties.origin.id, relationship.properties.destination.id];
4049
4056
  const bothOpenings = await Promise.all(
4050
4057
  bothOpeningIds.map((id) => this.#dataClient.findById("opening", id, { populate: true }))
@@ -4060,7 +4067,7 @@ var RendererManager = class extends EventTarget {
4060
4067
  this.addElementsToManager(escalator.id, _elements, escalator.properties.ordinal);
4061
4068
  }
4062
4069
  } catch (err) {
4063
- console.log(`cannot create escalator`, err.message);
4070
+ console.log(`cannot create escalator`, err);
4064
4071
  }
4065
4072
  }
4066
4073
  this.changeLevelByOrdinal(this.currentOrdinals);
@@ -4196,7 +4203,7 @@ var IndoorMap = class extends EventTarget {
4196
4203
  layers: []
4197
4204
  });
4198
4205
  this.rendererManager = new RendererManager(this.map, options.dataClient, options.renderer);
4199
- this.camera = new CameraManager(this.map, options.camera);
4206
+ this.camera = new CameraManager(this.map);
4200
4207
  this.locale = locale;
4201
4208
  this.pixelRatio = pixelRatio;
4202
4209
  this.onMapReady = onMapReady;
@@ -4214,12 +4221,12 @@ var IndoorMap = class extends EventTarget {
4214
4221
  this.camera.setView({ center: center2, pitch: 60, zoom: 19 });
4215
4222
  });
4216
4223
  }
4217
- /**
4218
- * Events
4219
- */
4220
4224
  on(eventName, handler) {
4221
4225
  this.map.on(eventName, handler);
4222
4226
  }
4227
+ /**
4228
+ * Events
4229
+ */
4223
4230
  handleMapClick = ({ coordinate }) => {
4224
4231
  const { x, y } = coordinate;
4225
4232
  console.log(
@@ -4275,12 +4282,40 @@ var IndoorMap = class extends EventTarget {
4275
4282
  this.map.off("moveend", this.#findAndSetVenueInView);
4276
4283
  }
4277
4284
  }
4285
+ get ordinals() {
4286
+ return this.#ordinals || [];
4287
+ }
4288
+ set ordinals(value) {
4289
+ if (!Array.isArray(value)) throw new Error("ordinals must be Array");
4290
+ this.#ordinals = value;
4291
+ }
4278
4292
  set billboards(value) {
4279
4293
  this.#billboards = value;
4280
4294
  }
4295
+ set mapConfig(value) {
4296
+ this.#mapConfig = value;
4297
+ }
4281
4298
  set mapDecorations(value) {
4282
4299
  this.#mapDecorations = value;
4283
4300
  }
4301
+ set maxZoom(value) {
4302
+ this.map.setMaxZoom(value);
4303
+ const spatialReference = {
4304
+ projection: "EPSG:3857",
4305
+ resolutions: (function() {
4306
+ const resolutions = [];
4307
+ const d = 2 * 6378137 * Math.PI;
4308
+ for (let i = 0; i < value; i++) {
4309
+ resolutions[i] = d / (256 * Math.pow(2, i));
4310
+ }
4311
+ return resolutions;
4312
+ })()
4313
+ };
4314
+ this.map.setSpatialReference(spatialReference);
4315
+ }
4316
+ set minZoom(value) {
4317
+ this.map.setMinZoom(value);
4318
+ }
4284
4319
  set groundLabels(value) {
4285
4320
  this.#groundLabels = value;
4286
4321
  }
@@ -4316,6 +4351,9 @@ var IndoorMap = class extends EventTarget {
4316
4351
  this.#onClickElement(e);
4317
4352
  this.#isClicked = false;
4318
4353
  };
4354
+ setCenter(center2, padding) {
4355
+ this.map.setCenter(center2, padding);
4356
+ }
4319
4357
  async #legacy_createElements() {
4320
4358
  const {
4321
4359
  // 2D
@@ -4537,7 +4575,7 @@ var IndoorMap = class extends EventTarget {
4537
4575
  const {
4538
4576
  geometry: { coordinates }
4539
4577
  } = (0, import_center4.default)(feature2);
4540
- this.camera.animateTo({ center: coordinates, pitch: 45 });
4578
+ this.camera.flyToAndZoomIn(coordinates, { pitch: 45 });
4541
4579
  });
4542
4580
  object3ds.push(object);
4543
4581
  this.#objects.push(object);
@@ -4620,6 +4658,27 @@ var IndoorMap = class extends EventTarget {
4620
4658
  changeLevelByOrdinal(ordinal) {
4621
4659
  this.rendererManager.changeLevelByOrdinal(ordinal);
4622
4660
  }
4661
+ getFeatureExtent = (feature2, scaleFactor = 1) => {
4662
+ const [minX, minY, maxX, maxY] = index_default(
4663
+ (0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
4664
+ );
4665
+ return new import_maptalks_gl.Extent(minX, minY, maxX, maxY);
4666
+ };
4667
+ getExtentCenter = (extent) => {
4668
+ return extent.getCenter();
4669
+ };
4670
+ getExtentZoom = (extent, options = {
4671
+ isFraction: false,
4672
+ padding: {
4673
+ paddingLeft: 0,
4674
+ paddingRight: 0,
4675
+ paddingTop: 0,
4676
+ paddingBottom: 0
4677
+ }
4678
+ }) => {
4679
+ const { isFraction = false, padding } = options;
4680
+ return this.map.getFitZoom(extent, isFraction, padding);
4681
+ };
4623
4682
  findVenueInView = () => {
4624
4683
  const mapCenter = this.map.getCenter();
4625
4684
  const result = this.#venues.reduce((closest, venue) => {
@@ -4632,6 +4691,9 @@ var IndoorMap = class extends EventTarget {
4632
4691
  }, null);
4633
4692
  return result;
4634
4693
  };
4694
+ flyTo = (center2, options) => {
4695
+ this.camera.flyTo(center2, options);
4696
+ };
4635
4697
  getLineStringBearing = (feature2) => {
4636
4698
  const { geometry } = feature2;
4637
4699
  const path = new import_maptalks_gl.LineString(geometry.coordinates);
@@ -5147,6 +5209,33 @@ var IndoorMap = class extends EventTarget {
5147
5209
  /**
5148
5210
  * render (frame)
5149
5211
  */
5212
+ getTargetViewCenter = (targetView, options = { offset: { top: 0, left: 0, right: 0, bottom: 0 } }) => {
5213
+ const map = this.map;
5214
+ const { offset } = options;
5215
+ const { top = 0, left = 0, right = 0, bottom = 0 } = offset;
5216
+ const originalState = {
5217
+ bearing: map.getBearing(),
5218
+ center: map.getCenter(),
5219
+ pitch: map.getPitch(),
5220
+ zoom: map.getZoom()
5221
+ };
5222
+ const finalView = {
5223
+ bearing: import_lodash7.default.isNil(targetView.bearing) ? map.getBearing() : targetView.bearing,
5224
+ center: import_lodash7.default.isNil(targetView.center) ? map.getCenter() : targetView.center,
5225
+ pitch: import_lodash7.default.isNil(targetView.pitch) ? map.getPitch() : targetView.pitch,
5226
+ zoom: import_lodash7.default.isNil(targetView.zoom) ? map.getZoom() : targetView.zoom
5227
+ };
5228
+ map.setView(finalView);
5229
+ const projectedTargetCenter = map.coordinateToContainerPoint(finalView.center).add(right / 2 - left / 2, bottom / 2 - top / 2);
5230
+ const adjustedTargetCenter = map.containerPointToCoordinate(
5231
+ projectedTargetCenter
5232
+ );
5233
+ map.setView(originalState);
5234
+ return adjustedTargetCenter;
5235
+ };
5236
+ setMaxExtent(extent) {
5237
+ return this.map.setMaxExtent(extent);
5238
+ }
5150
5239
  render() {
5151
5240
  const view = this.map.getView();
5152
5241
  const currBearing = view.bearing;
@@ -5155,8 +5244,7 @@ var IndoorMap = class extends EventTarget {
5155
5244
  this.threeLayer.redraw();
5156
5245
  }
5157
5246
  if (this.threeLayer) {
5158
- const currentView = this.camera.getView();
5159
- const objectOpacity = import_lodash7.default.clamp(38 - 2 * currentView.zoom, 0, 1);
5247
+ const objectOpacity = import_lodash7.default.clamp(38 - 2 * this.camera.getZoom(), 0, 1);
5160
5248
  this.#objects.forEach((object) => {
5161
5249
  object.getObject3d().traverse((child) => {
5162
5250
  if (child.isMesh) child.material.opacity = objectOpacity;
@@ -5167,7 +5255,7 @@ var IndoorMap = class extends EventTarget {
5167
5255
  if (this.#billboardObjects) {
5168
5256
  this.#billboardObjects.forEach((object) => {
5169
5257
  const objectScale = import_lodash7.default.clamp(
5170
- 20 - 1 * currentView.zoom,
5258
+ 20 - 1 * this.camera.getZoom(),
5171
5259
  1,
5172
5260
  1.05
5173
5261
  );