@syncfusion/ej2-maps 21.1.37 → 21.1.41

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.
@@ -54,6 +54,7 @@ function stringToNumber(value, containerSize) {
54
54
  function calculateSize(maps) {
55
55
  maps.element.style.height = !isNullOrUndefined(maps.height) ? maps.height : 'auto';
56
56
  maps.element.style.width = !isNullOrUndefined(maps.width) ? maps.width : 'auto';
57
+ maps.element.style.setProperty("display", "block");
57
58
  var containerWidth = maps.element.clientWidth;
58
59
  var containerHeight = maps.element.clientHeight;
59
60
  var containerElementWidth = stringToNumber(maps.element.style.width, containerWidth);
@@ -1834,8 +1835,9 @@ function findMidPointOfPolygon(points, type, geometryType) {
1834
1835
  ySum = ySum + Math.abs(((startY + startY1) * (((startX * startY1) - (startX1 * startY)))));
1835
1836
  }
1836
1837
  sum = 0.5 * sum;
1837
- xSum = (1 / (4 * sum)) * xSum;
1838
- ySum = (1 / (4 * sum)) * ySum;
1838
+ var pointValue = points.some(function (point) { return point.x < 5 && point.y < 5; }) && geometryType === 'Normal' ? 6 : 4;
1839
+ xSum = (1 / (pointValue * sum)) * xSum;
1840
+ ySum = (1 / (pointValue * sum)) * ySum;
1839
1841
  /* Code for finding nearest points in polygon related to midPoint*/
1840
1842
  var rightMinPoint = { x: 0, y: 0 };
1841
1843
  var rightMaxPoint = { x: 0, y: 0 };
@@ -8063,15 +8065,8 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
8063
8065
  if (!isNullOrUndefined(this.svgObject)) {
8064
8066
  this.element.appendChild(this.svgObject);
8065
8067
  }
8066
- var position = this.getExtraPosition();
8068
+ this.setSecondaryElementPosition();
8067
8069
  for (var i = 0; i < this.layers.length; i++) {
8068
- if (position.x !== 0 || position.y !== 0) {
8069
- var markerTemplate$$1 = document.getElementById(this.element.id + '_LayerIndex_' + i + '_Markers_Template_Group');
8070
- if (!isNullOrUndefined(markerTemplate$$1)) {
8071
- markerTemplate$$1.style.top = this.mapAreaRect.y + position.y + 'px';
8072
- markerTemplate$$1.style.left = this.mapAreaRect.x + position.x + 'px';
8073
- }
8074
- }
8075
8070
  if (this.layers[i].selectionSettings && this.layers[i].selectionSettings.enable &&
8076
8071
  this.layers[i].initialShapeSelection.length > 0 && this.checkInitialRender) {
8077
8072
  var checkSelection = this.layers[i].selectionSettings.enableMultiSelect;
@@ -8261,15 +8256,13 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
8261
8256
  this.element.setAttribute('role', '');
8262
8257
  this.element.tabIndex = this.tabIndex;
8263
8258
  };
8264
- // private setSecondaryElementPosition(): void {
8265
- // if (!this.isTileMap) {
8266
- // let element: HTMLDivElement = getElementByID(this.element.id + '_Secondary_Element') as HTMLDivElement;
8267
- // let rect: ClientRect = this.element.getBoundingClientRect();
8268
- // let svgRect: ClientRect = getElementByID(this.element.id + '_svg').getBoundingClientRect();
8269
- // element.style.marginLeft = Math.max(svgRect.left - rect.left, 0) + 'px';
8270
- // element.style.marginTop = Math.max(svgRect.top - rect.top, 0) + 'px';
8271
- // }
8272
- // }
8259
+ Maps.prototype.setSecondaryElementPosition = function () {
8260
+ var element = getElementByID(this.element.id + '_Secondary_Element');
8261
+ var rect = this.element.getBoundingClientRect();
8262
+ var svgRect = getElementByID(this.element.id + '_svg').getBoundingClientRect();
8263
+ element.style.marginLeft = Math.max(svgRect.left - rect.left, 0) + 'px';
8264
+ element.style.marginTop = Math.max(svgRect.top - rect.top, 0) + 'px';
8265
+ };
8273
8266
  Maps.prototype.zoomingChange = function () {
8274
8267
  var left;
8275
8268
  var top;
@@ -8842,7 +8835,7 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
8842
8835
  latLongValue.latitude = -latLongValue.latitude;
8843
8836
  }
8844
8837
  }
8845
- else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule) {
8838
+ else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule && !this.markerDragArgument) {
8846
8839
  var markerIndex = parseInt(targetId.split('_MarkerIndex_')[1].split('_')[0], 10);
8847
8840
  var dataIndex = parseInt(targetId.split('_dataIndex_')[1].split('_')[0], 10);
8848
8841
  if (!isNaN(markerIndex) && !isNaN(dataIndex)) {
@@ -8853,6 +8846,23 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
8853
8846
  latLongValue = { latitude: null, longitude: null };
8854
8847
  }
8855
8848
  }
8849
+ else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule && this.markerDragArgument) {
8850
+ var element = document.getElementById(this.element.id + '_LayerIndex_' + this.markerDragArgument.layerIndex);
8851
+ var elementRect = element.getBoundingClientRect();
8852
+ var location_3 = new MapLocation(pageX > elementRect.left ? Math.abs(elementRect.left - pageX) : 0, pageY > elementRect.top ? Math.abs(elementRect.top - pageY) : 0);
8853
+ var minLongitude = Math.abs((-this.baseMapBounds.longitude.min) * this.mapLayerPanel.currentFactor);
8854
+ var minLatitude = Math.abs(this.baseMapBounds.latitude.max * this.mapLayerPanel.currentFactor);
8855
+ latLongValue = {
8856
+ latitude: Math.abs(this.baseMapBounds.latitude.max - (location_3.y / (this.mapLayerPanel.currentFactor * this.scale))),
8857
+ longitude: Math.abs((location_3.x / (this.mapLayerPanel.currentFactor * this.scale)) + this.baseMapBounds.longitude.min)
8858
+ };
8859
+ if (this.baseMapBounds.longitude.min < 0 && minLongitude > location_3.x) {
8860
+ latLongValue.longitude = -latLongValue.longitude;
8861
+ }
8862
+ if (this.baseMapBounds.latitude.min < 0 && minLatitude > location_3.y) {
8863
+ latLongValue.latitude = -latLongValue.latitude;
8864
+ }
8865
+ }
8856
8866
  else {
8857
8867
  latLongValue = { latitude: null, longitude: null };
8858
8868
  }
@@ -9863,28 +9873,6 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
9863
9873
  });
9864
9874
  return isVisible;
9865
9875
  };
9866
- /**
9867
- * To find space between the secondary element and svg element.
9868
- *
9869
- * @returns {Point} - Returns the left and top value of the secondary element of Maps.
9870
- * @private
9871
- */
9872
- Maps.prototype.getExtraPosition = function () {
9873
- var top = 0;
9874
- var left = 0;
9875
- var svgElement = getElement(this.element.id + '_svg');
9876
- if (!isNullOrUndefined(svgElement)) {
9877
- var svgClientRects = svgElement.getClientRects();
9878
- var mapsClientRects = (getElement(this.element.id + '_Secondary_Element')).getClientRects();
9879
- if (svgClientRects.length !== 0 && mapsClientRects.length !== 0) {
9880
- var svgClientRect = svgClientRects[0];
9881
- var mapsClientRect = mapsClientRects[0];
9882
- top = svgClientRect.top - mapsClientRect.top;
9883
- left = svgClientRect.left - mapsClientRect.left;
9884
- }
9885
- }
9886
- return new Point(left, top);
9887
- };
9888
9876
  /**
9889
9877
  * To find marker visibility
9890
9878
  */
@@ -13679,7 +13667,7 @@ var Selection = /** @__PURE__ @class */ (function () {
13679
13667
  this.selectionsettings = this.maps.layers[layerIndex].markerSettings[markerIndex].selectionSettings;
13680
13668
  this.selectionType = 'Marker';
13681
13669
  }
13682
- else {
13670
+ else if (targetElement.id.indexOf('NavigationIndex') > -1) {
13683
13671
  var index = parseInt(targetElement.id.split('_NavigationIndex_')[1].split('_')[0], 10);
13684
13672
  shapeData = null;
13685
13673
  data = {
@@ -13689,7 +13677,7 @@ var Selection = /** @__PURE__ @class */ (function () {
13689
13677
  this.selectionsettings = this.maps.layers[layerIndex].navigationLineSettings[index].selectionSettings;
13690
13678
  this.selectionType = 'navigationline';
13691
13679
  }
13692
- if (this.selectionsettings.enable) {
13680
+ if (!isNullOrUndefined(this.selectionsettings) && this.selectionsettings.enable) {
13693
13681
  this.selectElement(targetElement, layerIndex, data, shapeData);
13694
13682
  }
13695
13683
  }
@@ -15856,9 +15844,8 @@ var Zoom = /** @__PURE__ @class */ (function () {
15856
15844
  }
15857
15845
  break;
15858
15846
  }
15859
- var extraPosition = map.getExtraPosition();
15860
- element.style.left = x + extraPosition.x + 'px';
15861
- element.style.top = y + extraPosition.y + 'px';
15847
+ element.style.left = x + 'px';
15848
+ element.style.top = y + 'px';
15862
15849
  var color = this.maps.toolbarProperties.highlightColor || this.maps.themeStyle.zoomSelectionColor;
15863
15850
  var css = ' .e-maps-toolbar:hover > circle { stroke:' + color + '; } .e-maps-toolbar:hover > path { fill: ' + color + ' ; stroke: ' + color + '; }' +
15864
15851
  '.e-maps-toolbar:hover { cursor: pointer; } .e-maps-cursor-disable:hover { cursor: not-allowed; } .e-maps-panning:hover { cursor: pointer; } ' +