proximiio-js-library 1.9.1 → 1.9.4

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.
@@ -29,7 +29,18 @@ var PolygonsLayer = /** @class */ (function (_super) {
29
29
  _this.source = 'main';
30
30
  _this.filter = ['all', ['==', ['get', 'type'], 'shop-custom'], ['==', ['to-number', ['get', 'level']], 0]];
31
31
  _this.paint = new fill_extrusion_layer_1.PaintProperties({
32
- 'fill-extrusion-height': 3,
32
+ 'fill-extrusion-height': [
33
+ 'case',
34
+ ['boolean', ['feature-state', 'selected'], false],
35
+ data.selectedPolygonHeight,
36
+ ['boolean', ['feature-state', 'hover'], false],
37
+ data.hoverPolygonHeight,
38
+ ['boolean', ['feature-state', 'active'], false],
39
+ data.hoverPolygonHeight,
40
+ data.defaultPolygonHeight,
41
+ ],
42
+ 'fill-extrusion-base': data.base,
43
+ 'fill-extrusion-opacity': data.opacity,
33
44
  'fill-extrusion-color': [
34
45
  'case',
35
46
  ['boolean', ['feature-state', 'selected'], false],
@@ -48,6 +48,11 @@ interface Options {
48
48
  defaultLabelColor?: string;
49
49
  hoverLabelColor?: string;
50
50
  selectedLabelColor?: string;
51
+ defaultPolygonHeight?: number;
52
+ hoverPolygonHeight?: number;
53
+ selectedPolygonHeight?: number;
54
+ base?: number;
55
+ opacity?: number;
51
56
  };
52
57
  zoomLevel?: number;
53
58
  considerVisibilityParam?: boolean;
@@ -134,6 +134,11 @@ var Map = /** @class */ (function () {
134
134
  defaultLabelColor: '#6945ed',
135
135
  hoverLabelColor: '#fff',
136
136
  selectedLabelColor: '#fff',
137
+ defaultPolygonHeight: 3,
138
+ hoverPolygonHeight: 3,
139
+ selectedPolygonHeight: 3,
140
+ base: 0,
141
+ opacity: 1,
137
142
  },
138
143
  considerVisibilityParam: true,
139
144
  fitBoundsPadding: 250,
@@ -556,6 +561,9 @@ var Map = /** @class */ (function () {
556
561
  // @ts-ignore
557
562
  var polygonPoi = this.state.allFeatures.features.find(function (i) { return i.properties.id === e.features[0].properties.poi_id; });
558
563
  var poi = this.state.allFeatures.features.find(function (i) { return i.properties.id === e.features[0].properties.id; });
564
+ if (polygonPoi) {
565
+ this.handlePolygonSelection(polygonPoi);
566
+ }
559
567
  this.onPolygonClickListener.next(polygonPoi ? polygonPoi : poi);
560
568
  }
561
569
  else {
@@ -584,7 +592,7 @@ var Map = /** @class */ (function () {
584
592
  }
585
593
  }
586
594
  if (connectedPolygonId) {
587
- this.selectedPolygon = this.state.allFeatures.features.find(function (i) { return i.properties.id === connectedPolygonId; });
595
+ this.selectedPolygon = this.state.allFeatures.features.find(function (i) { return i.properties.id === connectedPolygonId && i.properties.type === 'shop-custom'; });
588
596
  if (this.selectedPolygon) {
589
597
  this.map.setFeatureState({
590
598
  source: 'main',
@@ -1588,8 +1596,12 @@ var Map = /** @class */ (function () {
1588
1596
  var currentRouteIndex = this.routingSource.lines.findIndex(function (route) { return +route.properties.level === _this.state.floor.level; });
1589
1597
  var currentRoute_1 = this.routingSource.lines[currentRouteIndex];
1590
1598
  var nextRouteIndex = this.routingSource.lines.findIndex(function (route) {
1591
- return +route.properties.level ===
1592
- (way === 'up' ? currentRoute_1.properties.level + 1 : currentRoute_1.properties.level - 1);
1599
+ if (way === 'up') {
1600
+ return +route.properties.level > currentRoute_1.properties.level;
1601
+ }
1602
+ else {
1603
+ return +route.properties.level < currentRoute_1.properties.level;
1604
+ }
1593
1605
  });
1594
1606
  var nextRoute = this.routingSource.lines[nextRouteIndex];
1595
1607
  // return currentRouteIndex !== -1 && nextRoute ? +nextRoute.properties.level : way === 'up' ? this.state.floor.level + 1 : this.state.floor.level - 1;
@@ -120,6 +120,9 @@ var RoutingSource = /** @class */ (function (_super) {
120
120
  this.finish = undefined;
121
121
  this.lines = undefined;
122
122
  this.route = undefined;
123
+ this.points = undefined;
124
+ this.levelPaths = undefined;
125
+ this.levelPoints = undefined;
123
126
  this.data = new feature_1.FeatureCollection({
124
127
  features: [this.start, this.finish].concat(this.lines || []).filter(function (i) { return i; }),
125
128
  });
@@ -62,22 +62,24 @@ var getFeatures = function (initPolygons) { return __awaiter(void 0, void 0, voi
62
62
  feature.properties.type = 'poi-custom';
63
63
  var polygon = res.data.features.find(function (f) { return f.properties.id === feature.properties.metadata.polygon_id; });
64
64
  if (polygon) {
65
- polygon.properties.type = 'shop-custom';
66
- polygon.properties.poi_id = feature.properties.id;
67
- polygon.properties.amenity = feature.properties.amenity;
68
- polygon.id = JSON.stringify(key);
69
- if (polygon.properties['label-line'] &&
70
- polygon.properties['label-line'][0] instanceof Array &&
71
- polygon.properties['label-line'][1] instanceof Array) {
65
+ var polygonFeature = JSON.parse(JSON.stringify(polygon));
66
+ polygonFeature.properties.type = 'shop-custom';
67
+ polygonFeature.properties.poi_id = feature.properties.id;
68
+ polygonFeature.properties.amenity = feature.properties.amenity;
69
+ polygonFeature.id = JSON.stringify(key);
70
+ featuresToAdd_1.push(polygonFeature);
71
+ if (polygonFeature.properties['label-line'] &&
72
+ polygonFeature.properties['label-line'][0] instanceof Array &&
73
+ polygonFeature.properties['label-line'][1] instanceof Array) {
72
74
  var labelLineFeature = JSON.parse(JSON.stringify(feature));
73
75
  labelLineFeature.geometry = {
74
- coordinates: polygon.properties['label-line'],
76
+ coordinates: polygonFeature.properties['label-line'],
75
77
  type: 'LineString',
76
78
  };
77
79
  labelLineFeature.properties.id = JSON.stringify(key + 9999);
78
80
  labelLineFeature.id = JSON.stringify(key + 9999);
79
81
  labelLineFeature.properties.type = 'shop-label';
80
- polygon.properties.label_id = labelLineFeature.properties.id;
82
+ polygonFeature.properties.label_id = labelLineFeature.properties.id;
81
83
  featuresToAdd_1.push(labelLineFeature);
82
84
  }
83
85
  }