@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.
@@ -1935,8 +1935,8 @@ function findMidPointOfPolygon(points, type, geometryType) {
1935
1935
  sum = 0.5 * sum;
1936
1936
  // eslint-disable-next-line @typescript-eslint/tslint/config
1937
1937
  var pointValue = points.some(function (point) { return point.x < 5 && point.y < 5; }) && geometryType === 'Normal' ? 6 : 4;
1938
- xSum = (1 / (pointValue * sum)) * xSum;
1939
- ySum = (1 / (pointValue * sum)) * ySum;
1938
+ xSum = sum !== 0 ? (1 / (pointValue * sum)) * xSum : 0;
1939
+ ySum = sum !== 0 ? (1 / (pointValue * sum)) * ySum : 0;
1940
1940
  /* Code for finding nearest points in polygon related to midPoint*/
1941
1941
  var rightMinPoint = { x: 0, y: 0 };
1942
1942
  var rightMaxPoint = { x: 0, y: 0 };
@@ -7180,126 +7180,121 @@ var LayerPanel = /** @__PURE__ @class */ (function () {
7180
7180
  };
7181
7181
  LayerPanel.prototype.arrangeTiles = function (type, x, y) {
7182
7182
  var _this = this;
7183
+ var element = document.getElementById(this.mapObject.element.id + '_tile_parent');
7184
+ var element1 = document.getElementById(this.mapObject.element.id + '_tiles');
7183
7185
  var timeOut;
7184
7186
  if (!isNullOrUndefined(type) && type !== 'Pan') {
7185
7187
  this.tileAnimation(type, x, y);
7186
7188
  timeOut = animationMode === 'Disable' ? 0 : (this.mapObject.layersCollection[0].animationDuration === 0 &&
7187
7189
  animationMode === 'Enable') ? 1000 : this.mapObject.layersCollection[0].animationDuration;
7188
7190
  }
7189
- if (this.mapObject.layers[this.mapObject.baseLayerIndex].layerType === 'GoogleStaticMap') {
7190
- this.renderGoogleMap(this.mapObject.layers[0].key, this.mapObject.staticMapZoom);
7191
- }
7192
7191
  else {
7193
- if (type === 'Pan') {
7194
- this.arrangeTilesLayer(type);
7195
- }
7196
- else {
7197
- setTimeout(function () {
7198
- _this.arrangeTilesLayer(type);
7199
- }, timeOut);
7200
- }
7201
- }
7202
- };
7203
- LayerPanel.prototype.arrangeTilesLayer = function (type) {
7204
- var element = document.getElementById(this.mapObject.element.id + '_tile_parent');
7205
- var element1 = document.getElementById(this.mapObject.element.id + '_tiles');
7206
- if (element) {
7207
- element.style.zIndex = '1';
7192
+ timeOut = 0;
7208
7193
  }
7209
- if (element1) {
7210
- element1.style.zIndex = '0';
7211
- }
7212
- var animateElement;
7213
- if (!document.getElementById(this.mapObject.element.id + '_animated_tiles') && element) {
7214
- animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
7215
- element.appendChild(animateElement);
7194
+ if (this.mapObject.layers[this.mapObject.baseLayerIndex].layerType === 'GoogleStaticMap') {
7195
+ this.renderGoogleMap(this.mapObject.layers[0].key, this.mapObject.staticMapZoom);
7216
7196
  }
7217
7197
  else {
7218
- if (type !== 'Pan' && element1 && element) {
7219
- element1.appendChild(element.children[0]);
7220
- if (!this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(this.mapObject.element.id + '_animated_tiles'))) {
7221
- document.getElementById(this.mapObject.element.id + '_animated_tiles').id =
7222
- this.mapObject.element.id + '_animated_tiles_old';
7198
+ setTimeout(function () {
7199
+ if (element) {
7200
+ element.style.zIndex = '1';
7223
7201
  }
7224
- animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
7225
- element.appendChild(animateElement);
7226
- }
7227
- else {
7228
- animateElement = element ? element.children[0] : null;
7229
- }
7230
- }
7231
- for (var id = 0; id < this.tiles.length; id++) {
7232
- var tile = this.tiles[id];
7233
- var imgElement = null;
7234
- var mapId = this.mapObject.element.id;
7235
- if (type === 'Pan') {
7236
- var child = document.getElementById(mapId + '_tile_' + id);
7237
- var isNewTile = false;
7238
- if (isNullOrUndefined(child)) {
7239
- isNewTile = true;
7240
- child = createElement('div', { id: mapId + '_tile_' + id });
7241
- imgElement = createElement('img');
7202
+ if (element1) {
7203
+ element1.style.zIndex = '0';
7242
7204
  }
7243
- else {
7244
- child.style.removeProperty('display');
7245
- imgElement = child.children[0];
7246
- }
7247
- if (!isNewTile && imgElement && imgElement.src !== tile.src) {
7248
- imgElement.src = tile.src;
7249
- }
7250
- child.style.position = 'absolute';
7251
- child.style.left = tile.left + 'px';
7252
- child.style.top = tile.top + 'px';
7253
- child.style.height = tile.height + 'px';
7254
- child.style.width = tile.width + 'px';
7255
- if (isNewTile) {
7256
- imgElement.setAttribute('height', '256px');
7257
- imgElement.setAttribute('width', '256px');
7258
- imgElement.setAttribute('src', tile.src);
7259
- imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7260
- imgElement.style.setProperty('user-select', 'none');
7261
- child.appendChild(imgElement);
7262
- animateElement.appendChild(child);
7205
+ var animateElement;
7206
+ if (!document.getElementById(_this.mapObject.element.id + '_animated_tiles') && element) {
7207
+ animateElement = createElement('div', { id: _this.mapObject.element.id + '_animated_tiles' });
7208
+ element.appendChild(animateElement);
7263
7209
  }
7264
- }
7265
- else {
7266
- imgElement = createElement('img');
7267
- imgElement.setAttribute('height', '256px');
7268
- imgElement.setAttribute('width', '256px');
7269
- imgElement.setAttribute('src', tile.src);
7270
- imgElement.style.setProperty('user-select', 'none');
7271
- imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7272
- var child = createElement('div', { id: mapId + '_tile_' + id });
7273
- child.style.position = 'absolute';
7274
- child.style.left = tile.left + 'px';
7275
- child.style.top = tile.top + 'px';
7276
- child.style.height = tile.height + 'px';
7277
- child.style.width = tile.width + 'px';
7278
- child.appendChild(imgElement);
7279
- if (animateElement) {
7280
- animateElement.appendChild(child);
7281
- }
7282
- }
7283
- if (id === (this.tiles.length - 1) && document.getElementById(this.mapObject.element.id + '_animated_tiles_old')) {
7284
- removeElement(this.mapObject.element.id + '_animated_tiles_old');
7285
- }
7286
- }
7287
- if (!isNullOrUndefined(this.mapObject.currentTiles)) {
7288
- for (var l = this.tiles.length; l < animateElement.childElementCount; l++) {
7289
- var isExistingElement = false;
7290
- for (var a = 0; a < this.mapObject.currentTiles.childElementCount; a++) {
7291
- if (!isExistingElement &&
7292
- this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7293
- isExistingElement = true;
7210
+ else {
7211
+ if (type !== 'Pan' && element1 && element) {
7212
+ element1.appendChild(element.children[0]);
7213
+ if (!_this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(_this.mapObject.element.id + '_animated_tiles'))) {
7214
+ document.getElementById(_this.mapObject.element.id + '_animated_tiles').id =
7215
+ _this.mapObject.element.id + '_animated_tiles_old';
7216
+ }
7217
+ animateElement = createElement('div', { id: _this.mapObject.element.id + '_animated_tiles' });
7218
+ element.appendChild(animateElement);
7219
+ }
7220
+ else {
7221
+ animateElement = element ? element.children[0] : null;
7294
7222
  }
7295
7223
  }
7296
- if (isExistingElement) {
7297
- animateElement.children[l].style.display = 'none';
7224
+ for (var id = 0; id < _this.tiles.length; id++) {
7225
+ var tile = _this.tiles[id];
7226
+ var imgElement = null;
7227
+ var mapId = _this.mapObject.element.id;
7228
+ if (type === 'Pan') {
7229
+ var child = document.getElementById(mapId + '_tile_' + id);
7230
+ var isNewTile = false;
7231
+ if (isNullOrUndefined(child)) {
7232
+ isNewTile = true;
7233
+ child = createElement('div', { id: mapId + '_tile_' + id });
7234
+ imgElement = createElement('img');
7235
+ }
7236
+ else {
7237
+ child.style.removeProperty('display');
7238
+ imgElement = child.children[0];
7239
+ }
7240
+ if (!isNewTile && imgElement && imgElement.src !== tile.src) {
7241
+ imgElement.src = tile.src;
7242
+ }
7243
+ child.style.position = 'absolute';
7244
+ child.style.left = tile.left + 'px';
7245
+ child.style.top = tile.top + 'px';
7246
+ child.style.height = tile.height + 'px';
7247
+ child.style.width = tile.width + 'px';
7248
+ if (isNewTile) {
7249
+ imgElement.setAttribute('height', '256px');
7250
+ imgElement.setAttribute('width', '256px');
7251
+ imgElement.setAttribute('src', tile.src);
7252
+ imgElement.setAttribute('alt', _this.mapObject.getLocalizedLabel('ImageNotFound'));
7253
+ imgElement.style.setProperty('user-select', 'none');
7254
+ child.appendChild(imgElement);
7255
+ animateElement.appendChild(child);
7256
+ }
7257
+ }
7258
+ else {
7259
+ imgElement = createElement('img');
7260
+ imgElement.setAttribute('height', '256px');
7261
+ imgElement.setAttribute('width', '256px');
7262
+ imgElement.setAttribute('src', tile.src);
7263
+ imgElement.style.setProperty('user-select', 'none');
7264
+ imgElement.setAttribute('alt', _this.mapObject.getLocalizedLabel('ImageNotFound'));
7265
+ var child = createElement('div', { id: mapId + '_tile_' + id });
7266
+ child.style.position = 'absolute';
7267
+ child.style.left = tile.left + 'px';
7268
+ child.style.top = tile.top + 'px';
7269
+ child.style.height = tile.height + 'px';
7270
+ child.style.width = tile.width + 'px';
7271
+ child.appendChild(imgElement);
7272
+ if (animateElement) {
7273
+ animateElement.appendChild(child);
7274
+ }
7275
+ }
7276
+ if (id === (_this.tiles.length - 1) && document.getElementById(_this.mapObject.element.id + '_animated_tiles_old')) {
7277
+ removeElement(_this.mapObject.element.id + '_animated_tiles_old');
7278
+ }
7298
7279
  }
7299
- else {
7300
- animateElement.removeChild(animateElement.children[l]);
7280
+ if (!isNullOrUndefined(_this.mapObject.currentTiles)) {
7281
+ for (var l = _this.tiles.length; l < animateElement.childElementCount; l++) {
7282
+ var isExistingElement = false;
7283
+ for (var a = 0; a < _this.mapObject.currentTiles.childElementCount; a++) {
7284
+ if (!isExistingElement &&
7285
+ _this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7286
+ isExistingElement = true;
7287
+ }
7288
+ }
7289
+ if (isExistingElement) {
7290
+ animateElement.children[l].style.display = 'none';
7291
+ }
7292
+ else {
7293
+ animateElement.removeChild(animateElement.children[l]);
7294
+ }
7295
+ }
7301
7296
  }
7302
- }
7297
+ }, timeOut);
7303
7298
  }
7304
7299
  };
7305
7300
  /**
@@ -7813,7 +7808,7 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
7813
7808
  this.trigger(load, { maps: this });
7814
7809
  this.createSVG();
7815
7810
  this.findBaseAndSubLayers();
7816
- if (!isNullOrUndefined(this.markerModule)) {
7811
+ if (!isNullOrUndefined(this.markerModule) && this.markerModule.getMapsInstance()) {
7817
7812
  this.markerModule.initializeMarkerClusterList();
7818
7813
  }
7819
7814
  this.createSecondaryElement();
@@ -10693,6 +10688,13 @@ var Marker = /** @__PURE__ @class */ (function () {
10693
10688
  this.initialMarkerCluster = [];
10694
10689
  this.zoomedMarkerCluster = [];
10695
10690
  }
10691
+ /**
10692
+ * @private
10693
+ * @returns {Maps} - Returns the instance of the map.
10694
+ */
10695
+ Marker.prototype.getMapsInstance = function () {
10696
+ return this.maps;
10697
+ };
10696
10698
  Marker.prototype.markerRender = function (maps, layerElement, layerIndex, factor, type) {
10697
10699
  var _this = this;
10698
10700
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -11446,7 +11448,7 @@ var DataLabel = /** @__PURE__ @class */ (function () {
11446
11448
  location['y'] = ((location['y'] + zoomTransPoint['y']) * scale);
11447
11449
  }
11448
11450
  location['y'] = (this.maps.projectionType === 'Mercator') || layer.geometryType === 'Normal' ? location['y'] : (-location['y']);
11449
- if (!isNullOrUndefined(this.maps.format) && !isNaN(parseFloat(text))) {
11451
+ if (!isNullOrUndefined(this.maps.format) && !isNaN(Number(text)) && !isNaN(parseFloat(text))) {
11450
11452
  if (this.maps.useGroupingSeparator) {
11451
11453
  text = Internalize(this.maps, parseFloat(text));
11452
11454
  if (!isNullOrUndefined(datasrcObj)) {