@syncfusion/ej2-maps 25.1.40 → 25.2.3

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.
@@ -1878,8 +1878,8 @@ function findMidPointOfPolygon(points, type, geometryType) {
1878
1878
  sum = 0.5 * sum;
1879
1879
  // eslint-disable-next-line @typescript-eslint/tslint/config
1880
1880
  const pointValue = points.some(point => point.x < 5 && point.y < 5) && geometryType === 'Normal' ? 6 : 4;
1881
- xSum = (1 / (pointValue * sum)) * xSum;
1882
- ySum = (1 / (pointValue * sum)) * ySum;
1881
+ xSum = sum !== 0 ? (1 / (pointValue * sum)) * xSum : 0;
1882
+ ySum = sum !== 0 ? (1 / (pointValue * sum)) * ySum : 0;
1883
1883
  /* Code for finding nearest points in polygon related to midPoint*/
1884
1884
  let rightMinPoint = { x: 0, y: 0 };
1885
1885
  let rightMaxPoint = { x: 0, y: 0 };
@@ -6909,126 +6909,121 @@ class LayerPanel {
6909
6909
  }
6910
6910
  }
6911
6911
  arrangeTiles(type, x, y) {
6912
+ const element = document.getElementById(this.mapObject.element.id + '_tile_parent');
6913
+ const element1 = document.getElementById(this.mapObject.element.id + '_tiles');
6912
6914
  let timeOut;
6913
6915
  if (!isNullOrUndefined(type) && type !== 'Pan') {
6914
6916
  this.tileAnimation(type, x, y);
6915
6917
  timeOut = animationMode === 'Disable' ? 0 : (this.mapObject.layersCollection[0].animationDuration === 0 &&
6916
6918
  animationMode === 'Enable') ? 1000 : this.mapObject.layersCollection[0].animationDuration;
6917
6919
  }
6918
- if (this.mapObject.layers[this.mapObject.baseLayerIndex].layerType === 'GoogleStaticMap') {
6919
- this.renderGoogleMap(this.mapObject.layers[0].key, this.mapObject.staticMapZoom);
6920
- }
6921
6920
  else {
6922
- if (type === 'Pan') {
6923
- this.arrangeTilesLayer(type);
6924
- }
6925
- else {
6926
- setTimeout(() => {
6927
- this.arrangeTilesLayer(type);
6928
- }, timeOut);
6929
- }
6930
- }
6931
- }
6932
- arrangeTilesLayer(type) {
6933
- const element = document.getElementById(this.mapObject.element.id + '_tile_parent');
6934
- const element1 = document.getElementById(this.mapObject.element.id + '_tiles');
6935
- if (element) {
6936
- element.style.zIndex = '1';
6921
+ timeOut = 0;
6937
6922
  }
6938
- if (element1) {
6939
- element1.style.zIndex = '0';
6940
- }
6941
- let animateElement;
6942
- if (!document.getElementById(this.mapObject.element.id + '_animated_tiles') && element) {
6943
- animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
6944
- element.appendChild(animateElement);
6923
+ if (this.mapObject.layers[this.mapObject.baseLayerIndex].layerType === 'GoogleStaticMap') {
6924
+ this.renderGoogleMap(this.mapObject.layers[0].key, this.mapObject.staticMapZoom);
6945
6925
  }
6946
6926
  else {
6947
- if (type !== 'Pan' && element1 && element) {
6948
- element1.appendChild(element.children[0]);
6949
- if (!this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(this.mapObject.element.id + '_animated_tiles'))) {
6950
- document.getElementById(this.mapObject.element.id + '_animated_tiles').id =
6951
- this.mapObject.element.id + '_animated_tiles_old';
6927
+ setTimeout(() => {
6928
+ if (element) {
6929
+ element.style.zIndex = '1';
6952
6930
  }
6953
- animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
6954
- element.appendChild(animateElement);
6955
- }
6956
- else {
6957
- animateElement = element ? element.children[0] : null;
6958
- }
6959
- }
6960
- for (let id = 0; id < this.tiles.length; id++) {
6961
- const tile = this.tiles[id];
6962
- let imgElement = null;
6963
- const mapId = this.mapObject.element.id;
6964
- if (type === 'Pan') {
6965
- let child = document.getElementById(mapId + '_tile_' + id);
6966
- let isNewTile = false;
6967
- if (isNullOrUndefined(child)) {
6968
- isNewTile = true;
6969
- child = createElement('div', { id: mapId + '_tile_' + id });
6970
- imgElement = createElement('img');
6931
+ if (element1) {
6932
+ element1.style.zIndex = '0';
6971
6933
  }
6972
- else {
6973
- child.style.removeProperty('display');
6974
- imgElement = child.children[0];
6975
- }
6976
- if (!isNewTile && imgElement && imgElement.src !== tile.src) {
6977
- imgElement.src = tile.src;
6978
- }
6979
- child.style.position = 'absolute';
6980
- child.style.left = tile.left + 'px';
6981
- child.style.top = tile.top + 'px';
6982
- child.style.height = tile.height + 'px';
6983
- child.style.width = tile.width + 'px';
6984
- if (isNewTile) {
6985
- imgElement.setAttribute('height', '256px');
6986
- imgElement.setAttribute('width', '256px');
6987
- imgElement.setAttribute('src', tile.src);
6988
- imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
6989
- imgElement.style.setProperty('user-select', 'none');
6990
- child.appendChild(imgElement);
6991
- animateElement.appendChild(child);
6934
+ let animateElement;
6935
+ if (!document.getElementById(this.mapObject.element.id + '_animated_tiles') && element) {
6936
+ animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
6937
+ element.appendChild(animateElement);
6992
6938
  }
6993
- }
6994
- else {
6995
- imgElement = createElement('img');
6996
- imgElement.setAttribute('height', '256px');
6997
- imgElement.setAttribute('width', '256px');
6998
- imgElement.setAttribute('src', tile.src);
6999
- imgElement.style.setProperty('user-select', 'none');
7000
- imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7001
- const child = createElement('div', { id: mapId + '_tile_' + id });
7002
- child.style.position = 'absolute';
7003
- child.style.left = tile.left + 'px';
7004
- child.style.top = tile.top + 'px';
7005
- child.style.height = tile.height + 'px';
7006
- child.style.width = tile.width + 'px';
7007
- child.appendChild(imgElement);
7008
- if (animateElement) {
7009
- animateElement.appendChild(child);
7010
- }
7011
- }
7012
- if (id === (this.tiles.length - 1) && document.getElementById(this.mapObject.element.id + '_animated_tiles_old')) {
7013
- removeElement(this.mapObject.element.id + '_animated_tiles_old');
7014
- }
7015
- }
7016
- if (!isNullOrUndefined(this.mapObject.currentTiles)) {
7017
- for (let l = this.tiles.length; l < animateElement.childElementCount; l++) {
7018
- let isExistingElement = false;
7019
- for (let a = 0; a < this.mapObject.currentTiles.childElementCount; a++) {
7020
- if (!isExistingElement &&
7021
- this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7022
- isExistingElement = true;
6939
+ else {
6940
+ if (type !== 'Pan' && element1 && element) {
6941
+ element1.appendChild(element.children[0]);
6942
+ if (!this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(this.mapObject.element.id + '_animated_tiles'))) {
6943
+ document.getElementById(this.mapObject.element.id + '_animated_tiles').id =
6944
+ this.mapObject.element.id + '_animated_tiles_old';
6945
+ }
6946
+ animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
6947
+ element.appendChild(animateElement);
6948
+ }
6949
+ else {
6950
+ animateElement = element ? element.children[0] : null;
7023
6951
  }
7024
6952
  }
7025
- if (isExistingElement) {
7026
- animateElement.children[l].style.display = 'none';
6953
+ for (let id = 0; id < this.tiles.length; id++) {
6954
+ const tile = this.tiles[id];
6955
+ let imgElement = null;
6956
+ const mapId = this.mapObject.element.id;
6957
+ if (type === 'Pan') {
6958
+ let child = document.getElementById(mapId + '_tile_' + id);
6959
+ let isNewTile = false;
6960
+ if (isNullOrUndefined(child)) {
6961
+ isNewTile = true;
6962
+ child = createElement('div', { id: mapId + '_tile_' + id });
6963
+ imgElement = createElement('img');
6964
+ }
6965
+ else {
6966
+ child.style.removeProperty('display');
6967
+ imgElement = child.children[0];
6968
+ }
6969
+ if (!isNewTile && imgElement && imgElement.src !== tile.src) {
6970
+ imgElement.src = tile.src;
6971
+ }
6972
+ child.style.position = 'absolute';
6973
+ child.style.left = tile.left + 'px';
6974
+ child.style.top = tile.top + 'px';
6975
+ child.style.height = tile.height + 'px';
6976
+ child.style.width = tile.width + 'px';
6977
+ if (isNewTile) {
6978
+ imgElement.setAttribute('height', '256px');
6979
+ imgElement.setAttribute('width', '256px');
6980
+ imgElement.setAttribute('src', tile.src);
6981
+ imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
6982
+ imgElement.style.setProperty('user-select', 'none');
6983
+ child.appendChild(imgElement);
6984
+ animateElement.appendChild(child);
6985
+ }
6986
+ }
6987
+ else {
6988
+ imgElement = createElement('img');
6989
+ imgElement.setAttribute('height', '256px');
6990
+ imgElement.setAttribute('width', '256px');
6991
+ imgElement.setAttribute('src', tile.src);
6992
+ imgElement.style.setProperty('user-select', 'none');
6993
+ imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
6994
+ const child = createElement('div', { id: mapId + '_tile_' + id });
6995
+ child.style.position = 'absolute';
6996
+ child.style.left = tile.left + 'px';
6997
+ child.style.top = tile.top + 'px';
6998
+ child.style.height = tile.height + 'px';
6999
+ child.style.width = tile.width + 'px';
7000
+ child.appendChild(imgElement);
7001
+ if (animateElement) {
7002
+ animateElement.appendChild(child);
7003
+ }
7004
+ }
7005
+ if (id === (this.tiles.length - 1) && document.getElementById(this.mapObject.element.id + '_animated_tiles_old')) {
7006
+ removeElement(this.mapObject.element.id + '_animated_tiles_old');
7007
+ }
7027
7008
  }
7028
- else {
7029
- animateElement.removeChild(animateElement.children[l]);
7009
+ if (!isNullOrUndefined(this.mapObject.currentTiles)) {
7010
+ for (let l = this.tiles.length; l < animateElement.childElementCount; l++) {
7011
+ let isExistingElement = false;
7012
+ for (let a = 0; a < this.mapObject.currentTiles.childElementCount; a++) {
7013
+ if (!isExistingElement &&
7014
+ this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7015
+ isExistingElement = true;
7016
+ }
7017
+ }
7018
+ if (isExistingElement) {
7019
+ animateElement.children[l].style.display = 'none';
7020
+ }
7021
+ else {
7022
+ animateElement.removeChild(animateElement.children[l]);
7023
+ }
7024
+ }
7030
7025
  }
7031
- }
7026
+ }, timeOut);
7032
7027
  }
7033
7028
  }
7034
7029
  /**
@@ -7518,7 +7513,7 @@ let Maps = class Maps extends Component {
7518
7513
  this.trigger(load, { maps: this });
7519
7514
  this.createSVG();
7520
7515
  this.findBaseAndSubLayers();
7521
- if (!isNullOrUndefined(this.markerModule)) {
7516
+ if (!isNullOrUndefined(this.markerModule) && this.markerModule.getMapsInstance()) {
7522
7517
  this.markerModule.initializeMarkerClusterList();
7523
7518
  }
7524
7519
  this.createSecondaryElement();
@@ -10366,6 +10361,13 @@ class Marker {
10366
10361
  this.initialMarkerCluster = [];
10367
10362
  this.zoomedMarkerCluster = [];
10368
10363
  }
10364
+ /**
10365
+ * @private
10366
+ * @returns {Maps} - Returns the instance of the map.
10367
+ */
10368
+ getMapsInstance() {
10369
+ return this.maps;
10370
+ }
10369
10371
  markerRender(maps, layerElement, layerIndex, factor, type) {
10370
10372
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10371
10373
  let templateFn;
@@ -11114,7 +11116,7 @@ class DataLabel {
11114
11116
  location['y'] = ((location['y'] + zoomTransPoint['y']) * scale);
11115
11117
  }
11116
11118
  location['y'] = (this.maps.projectionType === 'Mercator') || layer.geometryType === 'Normal' ? location['y'] : (-location['y']);
11117
- if (!isNullOrUndefined(this.maps.format) && !isNaN(parseFloat(text))) {
11119
+ if (!isNullOrUndefined(this.maps.format) && !isNaN(Number(text)) && !isNaN(parseFloat(text))) {
11118
11120
  if (this.maps.useGroupingSeparator) {
11119
11121
  text = Internalize(this.maps, parseFloat(text));
11120
11122
  if (!isNullOrUndefined(datasrcObj)) {