@inlog/inlog-maps 6.5.3 → 6.5.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.
package/DOCUMENTATION.md CHANGED
@@ -1,4 +1,4 @@
1
- # [@inlog/inlog-maps](https://github.com/weareinlog/inlog-maps#readme) *6.5.3*
1
+ # [@inlog/inlog-maps](https://github.com/weareinlog/inlog-maps#readme) *6.5.4*
2
2
 
3
3
  > A library for using generic layer maps
4
4
 
@@ -12506,16 +12506,8 @@ var GooglePolygons = /** @class */ (function () {
12506
12506
  return !!polygon.map;
12507
12507
  };
12508
12508
  GooglePolygons.prototype.getPolygonPath = function (polygon) {
12509
- return polygon
12510
- .getPaths()
12511
- .getArray()
12512
- .map(function (x) {
12513
- return x
12514
- .getArray()
12515
- .map(function (y) {
12516
- return new _features_events_event_return__WEBPACK_IMPORTED_MODULE_1__["default"]([y.lat(), y.lng()]);
12517
- });
12518
- });
12509
+ return polygon.getPaths().getArray().map(function (x) { return x.getArray()
12510
+ .map(function (y) { return new _features_events_event_return__WEBPACK_IMPORTED_MODULE_1__["default"]([y.lat(), y.lng()]); }); });
12519
12511
  };
12520
12512
  GooglePolygons.prototype.addPolygonEvent = function (polygons, eventType, eventFunction) {
12521
12513
  var _this = this;
@@ -15078,7 +15070,18 @@ var LeafletPolygons = /** @class */ (function () {
15078
15070
  return this.map.hasLayer(polygon);
15079
15071
  };
15080
15072
  LeafletPolygons.prototype.getPolygonPath = function (polygon) {
15081
- return polygon.getLatLngs()[0].map(function (x) { return [x.lat, x.lng]; });
15073
+ var array = polygon.getLatLngs()[0];
15074
+ if (!array.map(function (x) { return Array.isArray(x); })[0]) {
15075
+ array = polygon.getLatLngs();
15076
+ }
15077
+ var coords = array.map(function (x) { return x.map(function (y) { return new _features_events_event_return__WEBPACK_IMPORTED_MODULE_1__["default"]([y.lat, y.lng]); }); });
15078
+ for (var item in coords) {
15079
+ // Ensure the polygon is closed
15080
+ if (coords[item][0].latlng[0] != coords[item][coords[item].length - 1].latlng[0] &&
15081
+ coords[item][0].latlng[1] != coords[item][coords[item].length - 1].latlng[1])
15082
+ coords[item].push(coords[item][0]);
15083
+ }
15084
+ return coords;
15082
15085
  };
15083
15086
  LeafletPolygons.prototype.addPolygonEvent = function (polygons, eventType, eventFunction) {
15084
15087
  var _this = this;