venue-js 1.2.0-next.11 → 1.2.0-next.13

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
@@ -3086,7 +3086,8 @@ var element3DRendererOptions = {
3086
3086
  default: { color: "#ffffff", height: 0.5 },
3087
3087
  byCategory: {
3088
3088
  water: { color: "#ACD7EC", height: 0.1 },
3089
- vegetation: { color: "#91C499", height: 0.5 }
3089
+ vegetation: { color: "#91C499", height: 0.5 },
3090
+ wall: { color: "#787878", topColor: "#ffffff", height: 4.2, width: 1 }
3090
3091
  }
3091
3092
  }
3092
3093
  };
@@ -3193,6 +3194,20 @@ var Element3DRenderer = class extends EventTarget {
3193
3194
  return [];
3194
3195
  }
3195
3196
  };
3197
+ const createLineString = (geometry, feature3) => {
3198
+ try {
3199
+ const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#000000";
3200
+ const material = this.getOrCreateMaterialByColor(color);
3201
+ const extrudedLine = this.threeLayer.toExtrudeLine(
3202
+ new maptalks4.LineString(geometry.coordinates),
3203
+ { height: heightOptions, ...options },
3204
+ material
3205
+ );
3206
+ return [extrudedLine];
3207
+ } catch (err) {
3208
+ return [];
3209
+ }
3210
+ };
3196
3211
  try {
3197
3212
  switch (feature2.geometry.type) {
3198
3213
  case "MultiPolygon": {
@@ -3212,6 +3227,13 @@ var Element3DRenderer = class extends EventTarget {
3212
3227
  this.threeLayer.addMesh(meshes);
3213
3228
  return meshes;
3214
3229
  }
3230
+ case "LineString": {
3231
+ const { coordinates } = feature2.geometry;
3232
+ if (!coordinates) return [];
3233
+ const meshes = createLineString(feature2.geometry, feature2);
3234
+ this.threeLayer.addMesh(meshes);
3235
+ return meshes;
3236
+ }
3215
3237
  }
3216
3238
  } catch (err) {
3217
3239
  console.log(`error createGeometry`, err, { feature: feature2, options });
@@ -3274,7 +3296,8 @@ var Element3DRenderer = class extends EventTarget {
3274
3296
  return null;
3275
3297
  }
3276
3298
  switch (element.type) {
3277
- case "ExtrudePolygon": {
3299
+ case "ExtrudePolygon":
3300
+ case "ExtrudeLine": {
3278
3301
  const mesh = element.getObject3d();
3279
3302
  const originalMaterial = mesh.material;
3280
3303
  const highlightMaterial = this.getOrCreateMaterialByColor("#ff0000");
@@ -3964,8 +3987,10 @@ var RendererManager = class extends EventTarget {
3964
3987
  const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
3965
3988
  elements.forEach((element) => {
3966
3989
  const controller = this.elementRenderer.createHighlightController(element);
3967
- controller.start();
3968
- this.highlightControllers.push(controller);
3990
+ if (controller && _isFunction(controller.start)) {
3991
+ controller.start();
3992
+ this.highlightControllers.push(controller);
3993
+ }
3969
3994
  });
3970
3995
  };
3971
3996
  clearHighlightElements = () => {
@@ -4015,6 +4040,20 @@ var defaultOptions = {
4015
4040
  interactions: true,
4016
4041
  locale: DEFAULT_LOCALE
4017
4042
  };
4043
+ var parseMaptalksOptions = (options) => {
4044
+ return {
4045
+ centerCross: options.centerCross ?? false,
4046
+ ...options.interactions === false ? {
4047
+ draggable: false,
4048
+ dragPan: false,
4049
+ dragRotate: false,
4050
+ dragPitch: false,
4051
+ scrollWheelZoom: false,
4052
+ touchZoom: false,
4053
+ doubleClickZoom: false
4054
+ } : {}
4055
+ };
4056
+ };
4018
4057
  var IndoorMap = class extends EventTarget {
4019
4058
  options;
4020
4059
  //TODO: refac functions; let them do only 1 thing in a function
@@ -4069,13 +4108,14 @@ var IndoorMap = class extends EventTarget {
4069
4108
  constructor(elementId, options) {
4070
4109
  super();
4071
4110
  const combinedOptions = _5.merge({}, defaultOptions, options);
4072
- this.options = options;
4111
+ this.options = combinedOptions;
4073
4112
  const {
4074
4113
  onMapReady,
4075
4114
  onMapLoading,
4076
4115
  pixelRatio,
4077
4116
  locale
4078
4117
  } = combinedOptions;
4118
+ const maptalksOptions = parseMaptalksOptions(combinedOptions);
4079
4119
  this.map = new Map2(elementId, {
4080
4120
  attribution: false,
4081
4121
  // Temporart set, not really default view
@@ -4083,16 +4123,7 @@ var IndoorMap = class extends EventTarget {
4083
4123
  center: INITIAL_CENTER,
4084
4124
  zoom: INITIAL_ZOOM,
4085
4125
  clickTimeThreshold: 600,
4086
- centerCross: options.centerCross ?? false,
4087
- ...options.interactions === false ? {
4088
- draggable: false,
4089
- dragPan: false,
4090
- dragRotate: false,
4091
- dragPitch: false,
4092
- scrollWheelZoom: false,
4093
- touchZoom: false,
4094
- doubleClickZoom: false
4095
- } : {},
4126
+ ...maptalksOptions,
4096
4127
  baseLayer: new TileLayer("base", {
4097
4128
  urlTemplate: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
4098
4129
  subdomains: ["a", "b", "c", "d"],
@@ -4122,6 +4153,12 @@ var IndoorMap = class extends EventTarget {
4122
4153
  this.map.on("click", this.handleMapClick);
4123
4154
  this.dataClient = options.dataClient;
4124
4155
  }
4156
+ setOptions(options) {
4157
+ const combinedOptions = _5.merge({}, defaultOptions, options);
4158
+ this.options = combinedOptions;
4159
+ const maptalksOptions = parseMaptalksOptions(combinedOptions);
4160
+ this.map.setOptions(maptalksOptions);
4161
+ }
4125
4162
  set dataClient(value) {
4126
4163
  this.#dataClient = value;
4127
4164
  if (!this.options.camera?.defaultView?.center) {
@@ -4787,6 +4824,36 @@ var IndoorMap = class extends EventTarget {
4787
4824
  requestAnimationFrame(this.render.bind(this));
4788
4825
  }
4789
4826
  };
4827
+
4828
+ // src/IndoorMap/renderer/3d/objects/PulsingMarker.ts
4829
+ import * as maptalks8 from "maptalks-gl";
4830
+ import { BaseObject as BaseObject7 } from "maptalks.three";
4831
+ import * as THREE4 from "three";
4832
+ var OPTIONS5 = {
4833
+ radius: 100,
4834
+ altitude: 0
4835
+ };
4836
+ var PulsingMarker = class extends BaseObject7 {
4837
+ constructor(coordinate, options, material, layer) {
4838
+ options = maptalks8.Util.extend({}, OPTIONS5, options, { layer, coordinate });
4839
+ super();
4840
+ this._initOptions(options);
4841
+ const { altitude, radius } = options;
4842
+ const r = layer.distanceToVector3(radius, radius).x;
4843
+ const geometry = new THREE4.CircleGeometry(r, 50);
4844
+ this._createMesh(geometry, material);
4845
+ const z = layer.altitudeToVector3(altitude, altitude).x;
4846
+ const position = layer.coordinateToVector3(coordinate, z);
4847
+ this.getObject3d().position.copy(position);
4848
+ this._scale = 1;
4849
+ }
4850
+ // test animation
4851
+ _animation() {
4852
+ this._scale = this._scale > 1 ? 0 : this._scale;
4853
+ this._scale += 0.02;
4854
+ this.getObject3d().scale.set(this._scale, this._scale, this._scale);
4855
+ }
4856
+ };
4790
4857
  export {
4791
4858
  ALL_FEATURE_TYPES,
4792
4859
  BASE_LAYER_NAME,
@@ -4807,7 +4874,9 @@ export {
4807
4874
  ORIGIN_MARKER_ID,
4808
4875
  occupant_helper_exports as OccupantHelpers,
4809
4876
  POI_MARKER_LAYER_NAME,
4877
+ PulsingMarker,
4810
4878
  QueryObserver2 as QueryObserver,
4879
+ TextSpriteMarker,
4811
4880
  USER_LOCATION_ELEMENT_ID,
4812
4881
  USER_LOCATION_LAYER_NAME,
4813
4882
  VENUE_EVENTS,