@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.
@@ -40,6 +40,7 @@ function stringToNumber(value, containerSize) {
40
40
  function calculateSize(maps) {
41
41
  maps.element.style.height = !isNullOrUndefined(maps.height) ? maps.height : 'auto';
42
42
  maps.element.style.width = !isNullOrUndefined(maps.width) ? maps.width : 'auto';
43
+ maps.element.style.setProperty("display", "block");
43
44
  const containerWidth = maps.element.clientWidth;
44
45
  const containerHeight = maps.element.clientHeight;
45
46
  const containerElementWidth = stringToNumber(maps.element.style.width, containerWidth);
@@ -1778,8 +1779,9 @@ function findMidPointOfPolygon(points, type, geometryType) {
1778
1779
  ySum = ySum + Math.abs(((startY + startY1) * (((startX * startY1) - (startX1 * startY)))));
1779
1780
  }
1780
1781
  sum = 0.5 * sum;
1781
- xSum = (1 / (4 * sum)) * xSum;
1782
- ySum = (1 / (4 * sum)) * ySum;
1782
+ const pointValue = points.some(point => point.x < 5 && point.y < 5) && geometryType === 'Normal' ? 6 : 4;
1783
+ xSum = (1 / (pointValue * sum)) * xSum;
1784
+ ySum = (1 / (pointValue * sum)) * ySum;
1783
1785
  /* Code for finding nearest points in polygon related to midPoint*/
1784
1786
  let rightMinPoint = { x: 0, y: 0 };
1785
1787
  let rightMaxPoint = { x: 0, y: 0 };
@@ -7773,15 +7775,8 @@ let Maps = class Maps extends Component {
7773
7775
  if (!isNullOrUndefined(this.svgObject)) {
7774
7776
  this.element.appendChild(this.svgObject);
7775
7777
  }
7776
- const position = this.getExtraPosition();
7778
+ this.setSecondaryElementPosition();
7777
7779
  for (let i = 0; i < this.layers.length; i++) {
7778
- if (position.x !== 0 || position.y !== 0) {
7779
- const markerTemplate$$1 = document.getElementById(this.element.id + '_LayerIndex_' + i + '_Markers_Template_Group');
7780
- if (!isNullOrUndefined(markerTemplate$$1)) {
7781
- markerTemplate$$1.style.top = this.mapAreaRect.y + position.y + 'px';
7782
- markerTemplate$$1.style.left = this.mapAreaRect.x + position.x + 'px';
7783
- }
7784
- }
7785
7780
  if (this.layers[i].selectionSettings && this.layers[i].selectionSettings.enable &&
7786
7781
  this.layers[i].initialShapeSelection.length > 0 && this.checkInitialRender) {
7787
7782
  const checkSelection = this.layers[i].selectionSettings.enableMultiSelect;
@@ -7971,15 +7966,13 @@ let Maps = class Maps extends Component {
7971
7966
  this.element.setAttribute('role', '');
7972
7967
  this.element.tabIndex = this.tabIndex;
7973
7968
  }
7974
- // private setSecondaryElementPosition(): void {
7975
- // if (!this.isTileMap) {
7976
- // let element: HTMLDivElement = getElementByID(this.element.id + '_Secondary_Element') as HTMLDivElement;
7977
- // let rect: ClientRect = this.element.getBoundingClientRect();
7978
- // let svgRect: ClientRect = getElementByID(this.element.id + '_svg').getBoundingClientRect();
7979
- // element.style.marginLeft = Math.max(svgRect.left - rect.left, 0) + 'px';
7980
- // element.style.marginTop = Math.max(svgRect.top - rect.top, 0) + 'px';
7981
- // }
7982
- // }
7969
+ setSecondaryElementPosition() {
7970
+ let element = getElementByID(this.element.id + '_Secondary_Element');
7971
+ let rect = this.element.getBoundingClientRect();
7972
+ let svgRect = getElementByID(this.element.id + '_svg').getBoundingClientRect();
7973
+ element.style.marginLeft = Math.max(svgRect.left - rect.left, 0) + 'px';
7974
+ element.style.marginTop = Math.max(svgRect.top - rect.top, 0) + 'px';
7975
+ }
7983
7976
  zoomingChange() {
7984
7977
  let left;
7985
7978
  let top;
@@ -8550,7 +8543,7 @@ let Maps = class Maps extends Component {
8550
8543
  latLongValue.latitude = -latLongValue.latitude;
8551
8544
  }
8552
8545
  }
8553
- else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule) {
8546
+ else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule && !this.markerDragArgument) {
8554
8547
  const markerIndex = parseInt(targetId.split('_MarkerIndex_')[1].split('_')[0], 10);
8555
8548
  const dataIndex = parseInt(targetId.split('_dataIndex_')[1].split('_')[0], 10);
8556
8549
  if (!isNaN(markerIndex) && !isNaN(dataIndex)) {
@@ -8561,6 +8554,23 @@ let Maps = class Maps extends Component {
8561
8554
  latLongValue = { latitude: null, longitude: null };
8562
8555
  }
8563
8556
  }
8557
+ else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule && this.markerDragArgument) {
8558
+ const element = document.getElementById(this.element.id + '_LayerIndex_' + this.markerDragArgument.layerIndex);
8559
+ const elementRect = element.getBoundingClientRect();
8560
+ const location = new MapLocation(pageX > elementRect.left ? Math.abs(elementRect.left - pageX) : 0, pageY > elementRect.top ? Math.abs(elementRect.top - pageY) : 0);
8561
+ const minLongitude = Math.abs((-this.baseMapBounds.longitude.min) * this.mapLayerPanel.currentFactor);
8562
+ const minLatitude = Math.abs(this.baseMapBounds.latitude.max * this.mapLayerPanel.currentFactor);
8563
+ latLongValue = {
8564
+ latitude: Math.abs(this.baseMapBounds.latitude.max - (location.y / (this.mapLayerPanel.currentFactor * this.scale))),
8565
+ longitude: Math.abs((location.x / (this.mapLayerPanel.currentFactor * this.scale)) + this.baseMapBounds.longitude.min)
8566
+ };
8567
+ if (this.baseMapBounds.longitude.min < 0 && minLongitude > location.x) {
8568
+ latLongValue.longitude = -latLongValue.longitude;
8569
+ }
8570
+ if (this.baseMapBounds.latitude.min < 0 && minLatitude > location.y) {
8571
+ latLongValue.latitude = -latLongValue.latitude;
8572
+ }
8573
+ }
8564
8574
  else {
8565
8575
  latLongValue = { latitude: null, longitude: null };
8566
8576
  }
@@ -9566,28 +9576,6 @@ let Maps = class Maps extends Component {
9566
9576
  });
9567
9577
  return isVisible;
9568
9578
  }
9569
- /**
9570
- * To find space between the secondary element and svg element.
9571
- *
9572
- * @returns {Point} - Returns the left and top value of the secondary element of Maps.
9573
- * @private
9574
- */
9575
- getExtraPosition() {
9576
- let top = 0;
9577
- let left = 0;
9578
- const svgElement = getElement(this.element.id + '_svg');
9579
- if (!isNullOrUndefined(svgElement)) {
9580
- const svgClientRects = svgElement.getClientRects();
9581
- const mapsClientRects = (getElement(this.element.id + '_Secondary_Element')).getClientRects();
9582
- if (svgClientRects.length !== 0 && mapsClientRects.length !== 0) {
9583
- const svgClientRect = svgClientRects[0];
9584
- const mapsClientRect = mapsClientRects[0];
9585
- top = svgClientRect.top - mapsClientRect.top;
9586
- left = svgClientRect.left - mapsClientRect.left;
9587
- }
9588
- }
9589
- return new Point(left, top);
9590
- }
9591
9579
  /**
9592
9580
  * To find marker visibility
9593
9581
  */
@@ -13344,7 +13332,7 @@ class Selection {
13344
13332
  this.selectionsettings = this.maps.layers[layerIndex].markerSettings[markerIndex].selectionSettings;
13345
13333
  this.selectionType = 'Marker';
13346
13334
  }
13347
- else {
13335
+ else if (targetElement.id.indexOf('NavigationIndex') > -1) {
13348
13336
  const index = parseInt(targetElement.id.split('_NavigationIndex_')[1].split('_')[0], 10);
13349
13337
  shapeData = null;
13350
13338
  data = {
@@ -13354,7 +13342,7 @@ class Selection {
13354
13342
  this.selectionsettings = this.maps.layers[layerIndex].navigationLineSettings[index].selectionSettings;
13355
13343
  this.selectionType = 'navigationline';
13356
13344
  }
13357
- if (this.selectionsettings.enable) {
13345
+ if (!isNullOrUndefined(this.selectionsettings) && this.selectionsettings.enable) {
13358
13346
  this.selectElement(targetElement, layerIndex, data, shapeData);
13359
13347
  }
13360
13348
  }
@@ -15509,9 +15497,8 @@ class Zoom {
15509
15497
  }
15510
15498
  break;
15511
15499
  }
15512
- const extraPosition = map.getExtraPosition();
15513
- element.style.left = x + extraPosition.x + 'px';
15514
- element.style.top = y + extraPosition.y + 'px';
15500
+ element.style.left = x + 'px';
15501
+ element.style.top = y + 'px';
15515
15502
  const color = this.maps.toolbarProperties.highlightColor || this.maps.themeStyle.zoomSelectionColor;
15516
15503
  const css = ' .e-maps-toolbar:hover > circle { stroke:' + color + '; } .e-maps-toolbar:hover > path { fill: ' + color + ' ; stroke: ' + color + '; }' +
15517
15504
  '.e-maps-toolbar:hover { cursor: pointer; } .e-maps-cursor-disable:hover { cursor: not-allowed; } .e-maps-panning:hover { cursor: pointer; } ' +