@syncfusion/ej2-maps 20.3.49 → 20.4.38

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.
Files changed (48) hide show
  1. package/.eslintrc.json +16 -1
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +65 -51
  4. package/dist/ej2-maps.min.js +2 -2
  5. package/dist/ej2-maps.umd.min.js +2 -2
  6. package/dist/ej2-maps.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-maps.es2015.js +1030 -781
  8. package/dist/es6/ej2-maps.es2015.js.map +1 -1
  9. package/dist/es6/ej2-maps.es5.js +1017 -772
  10. package/dist/es6/ej2-maps.es5.js.map +1 -1
  11. package/dist/global/ej2-maps.min.js +2 -2
  12. package/dist/global/ej2-maps.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/package.json +34 -21
  15. package/src/maps/layers/bing-map.d.ts +1 -0
  16. package/src/maps/layers/bing-map.js +1 -0
  17. package/src/maps/layers/bubble.d.ts +4 -0
  18. package/src/maps/layers/bubble.js +7 -3
  19. package/src/maps/layers/color-mapping.d.ts +5 -0
  20. package/src/maps/layers/color-mapping.js +5 -3
  21. package/src/maps/layers/data-label.d.ts +0 -1
  22. package/src/maps/layers/data-label.js +13 -14
  23. package/src/maps/layers/layer-panel.d.ts +7 -7
  24. package/src/maps/layers/layer-panel.js +119 -72
  25. package/src/maps/layers/legend.js +30 -25
  26. package/src/maps/layers/marker.d.ts +13 -0
  27. package/src/maps/layers/marker.js +133 -115
  28. package/src/maps/layers/navigation-selected-line.d.ts +5 -0
  29. package/src/maps/layers/navigation-selected-line.js +70 -65
  30. package/src/maps/maps-model.d.ts +1 -1
  31. package/src/maps/maps.d.ts +19 -0
  32. package/src/maps/maps.js +469 -382
  33. package/src/maps/model/base.js +2 -2
  34. package/src/maps/model/export-image.d.ts +4 -3
  35. package/src/maps/model/export-image.js +7 -6
  36. package/src/maps/model/export-pdf.d.ts +6 -6
  37. package/src/maps/model/export-pdf.js +8 -7
  38. package/src/maps/model/interface.d.ts +2 -2
  39. package/src/maps/model/print.d.ts +4 -2
  40. package/src/maps/model/print.js +6 -3
  41. package/src/maps/user-interaction/annotation.js +2 -3
  42. package/src/maps/user-interaction/highlight.js +37 -13
  43. package/src/maps/user-interaction/selection.js +4 -2
  44. package/src/maps/user-interaction/tooltip.js +8 -8
  45. package/src/maps/user-interaction/zoom.d.ts +5 -0
  46. package/src/maps/user-interaction/zoom.js +39 -29
  47. package/src/maps/utils/helper.d.ts +2 -0
  48. package/src/maps/utils/helper.js +58 -45
package/src/maps/maps.js CHANGED
@@ -17,11 +17,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
17
17
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
19
19
  };
20
- /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
21
- /* eslint-disable @typescript-eslint/no-unused-vars */
22
- /* eslint-disable radix */
23
- /* eslint-disable max-len */
24
- /* eslint-disable valid-jsdoc */
25
20
  /**
26
21
  * Maps Component file
27
22
  */
@@ -37,10 +32,9 @@ import { LayerSettings, TitleSettings, Border, Margin, MapsAreaSettings, Annotat
37
32
  import { Marker } from './layers/marker';
38
33
  import { load, click, onclick, loaded, doubleClick, resize, shapeSelected, zoomIn } from './model/constants';
39
34
  import { getThemeStyle, Theme } from './model/theme';
40
- import { BingMap } from './layers/bing-map';
41
35
  import { LayerPanel } from './layers/layer-panel';
42
36
  import { Rect, RectOption, measureText, getElementByID, MapAjax, processResult, getElementsByClassName } from '../maps/utils/helper';
43
- import { findPosition, textTrim, TextOption, renderTextElement, convertGeoToPoint, calculateZoomLevel } from '../maps/utils/helper';
37
+ import { findPosition, textTrim, TextOption, renderTextElement, calculateZoomLevel } from '../maps/utils/helper';
44
38
  import { Annotations } from '../maps/user-interaction/annotation';
45
39
  import { MarkerSettings } from './index';
46
40
  import { changeBorderWidth } from './index';
@@ -225,18 +219,20 @@ var Maps = /** @class */ (function (_super) {
225
219
  this.setCulture();
226
220
  };
227
221
  Maps.prototype.renderElements = function () {
228
- this.trigger(load, { maps: this });
229
- this.createSVG();
230
- this.findBaseAndSubLayers();
231
- this.createSecondaryElement();
232
- this.addTabIndex();
233
- this.themeStyle = getThemeStyle(this.theme);
234
- this.renderBorder();
235
- this.renderTitle(this.titleSettings, 'title', null, null);
236
- this.renderArea();
237
- this.processRequestJsonData();
238
- this.renderComplete();
239
- this.isAddLayer = !this.isTileMap ? false : this.isAddLayer;
222
+ if (!this.isDestroyed) {
223
+ this.trigger(load, { maps: this });
224
+ this.createSVG();
225
+ this.findBaseAndSubLayers();
226
+ this.createSecondaryElement();
227
+ this.addTabIndex();
228
+ this.themeStyle = getThemeStyle(this.theme);
229
+ this.renderBorder();
230
+ this.renderTitle(this.titleSettings, 'title', null, null);
231
+ this.renderArea();
232
+ this.processRequestJsonData();
233
+ this.renderComplete();
234
+ this.isAddLayer = !this.isTileMap ? false : this.isAddLayer;
235
+ }
240
236
  };
241
237
  /**
242
238
  * To Initialize the control rendering.
@@ -251,8 +247,6 @@ var Maps = /** @class */ (function (_super) {
251
247
  var length = this.layersCollection.length - 1;
252
248
  this.serverProcess = { request: 0, response: 0 };
253
249
  var queryModule;
254
- var localAjax;
255
- var ajaxModule;
256
250
  var dataModule;
257
251
  Array.prototype.forEach.call(this.layersCollection, function (layer, layerIndex) {
258
252
  if (layer.shapeData instanceof DataManager) {
@@ -288,7 +282,8 @@ var Maps = /** @class */ (function (_super) {
288
282
  if (layer.markerSettings[i].dataSource instanceof DataManager) {
289
283
  _this.serverProcess['request']++;
290
284
  dataModule = layer.markerSettings[i].dataSource;
291
- queryModule = layer.markerSettings[i].query instanceof Query ? layer.markerSettings[i].query : new Query();
285
+ queryModule = layer.markerSettings[i].query instanceof Query ?
286
+ layer.markerSettings[i].query : new Query();
292
287
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
293
288
  var dataManager = dataModule.executeQuery(queryModule);
294
289
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -307,7 +302,8 @@ var Maps = /** @class */ (function (_super) {
307
302
  if (layer.bubbleSettings[i].dataSource instanceof DataManager) {
308
303
  _this.serverProcess['request']++;
309
304
  dataModule = layer.bubbleSettings[i].dataSource;
310
- queryModule = layer.bubbleSettings[i].query instanceof Query ? layer.bubbleSettings[i].query : new Query();
305
+ queryModule = layer.bubbleSettings[i].query instanceof Query ?
306
+ layer.bubbleSettings[i].query : new Query();
311
307
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
312
308
  var dataManager = dataModule.executeQuery(queryModule);
313
309
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -417,6 +413,7 @@ var Maps = /** @class */ (function (_super) {
417
413
  }
418
414
  if (!this.isResize) {
419
415
  for (var k = 0; k < this.layers[i].markerSettings.length; k++) {
416
+ // eslint-disable-next-line max-len
420
417
  if (this.layers[i].markerSettings[k].selectionSettings && this.layers[i].markerSettings[k].selectionSettings.enable
421
418
  && this.layers[i].markerSettings[k].initialMarkerSelection.length > 0) {
422
419
  var markerSelectionValues = this.layers[i].markerSettings[k].initialMarkerSelection;
@@ -488,7 +485,9 @@ var Maps = /** @class */ (function (_super) {
488
485
  }
489
486
  }
490
487
  this.zoomingChange();
491
- this.trigger(loaded, { maps: this, isResized: this.isResize });
488
+ if (!this.isZoomByPosition && !this.zoomNotApplied) {
489
+ this.trigger(loaded, { maps: this, isResized: this.isResize });
490
+ }
492
491
  this.isResize = false;
493
492
  };
494
493
  /**
@@ -582,7 +581,7 @@ var Maps = /** @class */ (function (_super) {
582
581
  Maps.prototype.addTabIndex = function () {
583
582
  this.element.setAttribute('aria-label', this.description || 'Maps Element');
584
583
  this.element.setAttribute('role', '');
585
- this.element.setAttribute('tabindex', this.tabIndex.toString());
584
+ this.element.tabIndex = this.tabIndex;
586
585
  };
587
586
  // private setSecondaryElementPosition(): void {
588
587
  // if (!this.isTileMap) {
@@ -610,8 +609,10 @@ var Maps = /** @class */ (function (_super) {
610
609
  tileSvgParentElement.style.left = left + 'px';
611
610
  tileSvgParentElement.style.top = top + 'px';
612
611
  if (!isNullOrUndefined(this.legendModule) && this.legendModule.totalPages.length > 0) {
613
- tileElement.style.width = tileSvgElement.style.width = this.legendModule.legendTotalRect.width.toString();
614
- tileElement.style.height = tileSvgElement.style.height = this.legendModule.legendTotalRect.height.toString();
612
+ tileElement.style.width = tileSvgElement.style.width =
613
+ this.legendModule.legendTotalRect.width.toString();
614
+ tileElement.style.height = tileSvgElement.style.height =
615
+ this.legendModule.legendTotalRect.height.toString();
615
616
  tileSvgParentElement.style.width = this.legendModule.legendTotalRect.width + 'px';
616
617
  tileSvgParentElement.style.height = this.legendModule.legendTotalRect.height + 'px';
617
618
  }
@@ -632,7 +633,7 @@ var Maps = /** @class */ (function (_super) {
632
633
  if (!isNullOrUndefined(elements) && elements.childElementCount > 0) {
633
634
  for (var i = 0; i < elements.childNodes.length; i++) {
634
635
  var childElement = elements.childNodes[i];
635
- if (childElement.tagName === 'g' && childElement.id.indexOf('_Legend_Group') == -1) {
636
+ if (childElement.tagName === 'g' && childElement.id.indexOf('_Legend_Group') === -1) {
636
637
  var layerIndex = parseFloat(childElement.id.split('_LayerIndex_')[1].split('_')[0]);
637
638
  for (var j = 0; j < childElement.childNodes.length; j++) {
638
639
  var childNode = childElement.childNodes[j];
@@ -645,7 +646,7 @@ var Maps = /** @class */ (function (_super) {
645
646
  }
646
647
  }
647
648
  }
648
- if (this.zoomModule && (this.previousScale !== this.scale)) {
649
+ if (this.zoomModule && ((this.previousScale !== this.scale) || this.zoomNotApplied || this.isZoomByPosition)) {
649
650
  this.zoomModule.applyTransform(this, true);
650
651
  }
651
652
  }
@@ -653,9 +654,9 @@ var Maps = /** @class */ (function (_super) {
653
654
  Maps.prototype.createSecondaryElement = function () {
654
655
  if (isNullOrUndefined(document.getElementById(this.element.id + '_Secondary_Element'))) {
655
656
  var secondaryElement = createElement('div', {
656
- id: this.element.id + '_Secondary_Element',
657
- styles: 'position: absolute;z-index:2;'
657
+ id: this.element.id + '_Secondary_Element'
658
658
  });
659
+ secondaryElement.style.cssText = 'position: absolute;z-index:2;';
659
660
  this.element.appendChild(secondaryElement);
660
661
  }
661
662
  };
@@ -709,18 +710,20 @@ var Maps = /** @class */ (function (_super) {
709
710
  removeElement(this.element.id + '_tiles');
710
711
  removeElement('animated_tiles');
711
712
  var ele = createElement('div', {
712
- id: this.element.id + '_tile_parent', styles: 'position: absolute; left: ' +
713
- (this.mapAreaRect.x) + 'px; right: ' + (this.margin.right) + 'px; top: '
714
- + (this.mapAreaRect.y + padding) + 'px; height: ' +
715
- (this.mapAreaRect.height) + 'px; width: '
716
- + (this.mapAreaRect.width) + 'px; overflow: hidden;'
713
+ id: this.element.id + '_tile_parent'
717
714
  });
715
+ ele.style.cssText = 'position: absolute; left: ' +
716
+ (this.mapAreaRect.x) + 'px; right: ' + (this.margin.right) + 'px; top: '
717
+ + (this.mapAreaRect.y + padding) + 'px; height: ' +
718
+ (this.mapAreaRect.height) + 'px; width: '
719
+ + (this.mapAreaRect.width) + 'px; overflow: hidden;';
718
720
  var ele1 = createElement('div', {
719
- id: this.element.id + '_tiles', styles: 'position: absolute; left: ' +
720
- (this.mapAreaRect.x) + 'px; right: ' + (this.margin.right) + 'px; top: '
721
- + (this.mapAreaRect.y + padding) + 'px; height: ' + (this.mapAreaRect.height) + 'px; width: '
722
- + (this.mapAreaRect.width) + 'px; overflow: hidden;'
721
+ id: this.element.id + '_tiles'
723
722
  });
723
+ ele1.style.cssText = 'position: absolute; left: ' +
724
+ (this.mapAreaRect.x) + 'px; right: ' + (this.margin.right) + 'px; top: '
725
+ + (this.mapAreaRect.y + padding) + 'px; height: ' + (this.mapAreaRect.height) + 'px; width: '
726
+ + (this.mapAreaRect.width) + 'px; overflow: hidden;';
724
727
  this.element.appendChild(ele);
725
728
  this.element.appendChild(ele1);
726
729
  }
@@ -761,7 +764,7 @@ var Maps = /** @class */ (function (_super) {
761
764
  break;
762
765
  }
763
766
  }
764
- subLayers.map(function (subLayer, subLayerIndex) {
767
+ subLayers.map(function (subLayer) {
765
768
  if (subLayer.visible) {
766
769
  _this.layersCollection.push(subLayer);
767
770
  }
@@ -921,6 +924,9 @@ var Maps = /** @class */ (function (_super) {
921
924
  };
922
925
  Maps.prototype.keyUpHandler = function (event) {
923
926
  var id = event.target['id'];
927
+ if (this.isTileMap) {
928
+ this.removeTileMap();
929
+ }
924
930
  if (event.code === 'Tab' && id.indexOf('_LayerIndex_') > -1 && id.indexOf('shapeIndex') > -1) {
925
931
  this.keyboardHighlightSelection(id, event.type);
926
932
  }
@@ -954,6 +960,13 @@ var Maps = /** @class */ (function (_super) {
954
960
  };
955
961
  Maps.prototype.keyDownHandler = function (event) {
956
962
  var zoom = this.zoomModule;
963
+ if ((event.code === 'ArrowUp' || event.code === 'ArrowDown' || event.code === 'ArrowLeft'
964
+ || event.code === 'ArrowRight') && zoom) {
965
+ var animatedTiles = document.getElementById(this.element.id + '_animated_tiles');
966
+ if (this.isTileMap && !isNullOrUndefined(animatedTiles)) {
967
+ this.currentTiles = animatedTiles.cloneNode(true);
968
+ }
969
+ }
957
970
  if ((event.key === '+' || event.code === 'Equal') && zoom) {
958
971
  zoom.performZoomingByToolBar('zoomin');
959
972
  }
@@ -1028,6 +1041,7 @@ var Maps = /** @class */ (function (_super) {
1028
1041
  * This method is used to perform the operations when a click operation is performed on maps.
1029
1042
  *
1030
1043
  * @param {PointerEvent} e - Specifies the pointer event on maps.
1044
+ * @returns {void}
1031
1045
  */
1032
1046
  Maps.prototype.mapsOnClick = function (e) {
1033
1047
  var _this = this;
@@ -1093,8 +1107,9 @@ var Maps = /** @class */ (function (_super) {
1093
1107
  Maps.prototype.getClickLocation = function (targetId, pageX, pageY, targetElement, x, y) {
1094
1108
  var layerIndex = 0;
1095
1109
  var latLongValue;
1096
- if (targetId.indexOf('_LayerIndex_') !== -1 && !this.isTileMap && (parseInt(this.mouseDownEvent['x']) === parseInt(this.mouseClickEvent['x']))
1097
- && (parseInt(this.mouseDownEvent['y']) === parseInt(this.mouseClickEvent['y']))) {
1110
+ if (targetId.indexOf('_LayerIndex_') !== -1 && !this.isTileMap &&
1111
+ (parseInt(this.mouseDownEvent['x'], 10) === parseInt(this.mouseClickEvent['x'], 10)) &&
1112
+ (parseInt(this.mouseDownEvent['y'], 10) === parseInt(this.mouseClickEvent['y'], 10))) {
1098
1113
  layerIndex = parseFloat(targetId.split('_LayerIndex_')[1].split('_')[0]);
1099
1114
  if (this.layers[layerIndex].geometryType === 'Normal') {
1100
1115
  if (targetId.indexOf('_shapeIndex_') > -1) {
@@ -1131,12 +1146,21 @@ var Maps = /** @class */ (function (_super) {
1131
1146
  latLongValue = this.getGeoLocation(layerIndex, x, y);
1132
1147
  }
1133
1148
  }
1134
- else if (this.isTileMap && (parseInt(this.mouseDownEvent['x']) === parseInt(this.mouseClickEvent['x']))
1135
- && (parseInt(this.mouseDownEvent['y']) === parseInt(this.mouseClickEvent['y']))) {
1149
+ else if (this.isTileMap && (parseInt(this.mouseDownEvent['x'], 10) === parseInt(this.mouseClickEvent['x'], 10)) &&
1150
+ (parseInt(this.mouseDownEvent['y'], 10) === parseInt(this.mouseClickEvent['y'], 10))) {
1136
1151
  latLongValue = this.getTileGeoLocation(x, y);
1137
1152
  }
1138
1153
  return latLongValue;
1139
1154
  };
1155
+ Maps.prototype.removeTileMap = function () {
1156
+ var animateElement = document.getElementById(this.element.id + '_animated_tiles');
1157
+ if (!isNullOrUndefined(this.currentTiles) && animateElement.childElementCount !== this.currentTiles.childElementCount) {
1158
+ for (var l = animateElement.childElementCount - 1; l >= this.currentTiles.childElementCount; l--) {
1159
+ animateElement.removeChild(animateElement.children[l]);
1160
+ }
1161
+ }
1162
+ this.currentTiles = null;
1163
+ };
1140
1164
  /**
1141
1165
  * This method is used to perform operations when mouse click on maps.
1142
1166
  *
@@ -1168,6 +1192,9 @@ var Maps = /** @class */ (function (_super) {
1168
1192
  pageY = e.pageY;
1169
1193
  target = e.target;
1170
1194
  }
1195
+ if (this.isTileMap) {
1196
+ this.removeTileMap();
1197
+ }
1171
1198
  if (this.isTouch) {
1172
1199
  if (targetEle.id.indexOf('_ToolBar') === -1) {
1173
1200
  var latLongValue = this.getClickLocation(targetId, pageX, pageY, targetEle, pageX, pageY);
@@ -1204,13 +1231,14 @@ var Maps = /** @class */ (function (_super) {
1204
1231
  }
1205
1232
  var rect = this.element.getBoundingClientRect();
1206
1233
  var element = e.target;
1234
+ var animatedTiles = document.getElementById(this.element.id + '_animated_tiles');
1235
+ if (this.isTileMap && !isNullOrUndefined(animatedTiles)) {
1236
+ this.currentTiles = animatedTiles.cloneNode(true);
1237
+ }
1207
1238
  if (element.id.indexOf('_ToolBar') === -1) {
1208
1239
  var markerModule = this.markerModule;
1209
1240
  if (element.id.indexOf('shapeIndex') > -1 || element.id.indexOf('Tile') > -1) {
1210
1241
  this.mergeCluster();
1211
- if (element.id.indexOf('shapeIndex') > -1) {
1212
- this.triggerShapeSelection(element);
1213
- }
1214
1242
  }
1215
1243
  if (markerModule) {
1216
1244
  markerModule.markerClick(e);
@@ -1239,6 +1267,7 @@ var Maps = /** @class */ (function (_super) {
1239
1267
  * This method is used to perform operations when performing the double click operation on maps.
1240
1268
  *
1241
1269
  * @param {PointerEvent} e - Specifies the pointer event.
1270
+ * @returns {void}
1242
1271
  */
1243
1272
  Maps.prototype.mapsOnDoubleClick = function (e) {
1244
1273
  this.notify('dblclick', e);
@@ -1262,8 +1291,10 @@ var Maps = /** @class */ (function (_super) {
1262
1291
  latitude = latLongValue['latitude'];
1263
1292
  longitude = latLongValue['longitude'];
1264
1293
  }
1265
- var doubleClickArgs = { cancel: false, name: doubleClick, x: e.clientX, y: e.clientY,
1266
- target: targetId, latitude: latitude, longitude: longitude, isShapeSelected: null };
1294
+ var doubleClickArgs = {
1295
+ cancel: false, name: doubleClick, x: e.clientX, y: e.clientY,
1296
+ target: targetId, latitude: latitude, longitude: longitude, isShapeSelected: null
1297
+ };
1267
1298
  this.trigger('doubleClick', doubleClickArgs);
1268
1299
  }
1269
1300
  };
@@ -1363,28 +1394,30 @@ var Maps = /** @class */ (function (_super) {
1363
1394
  */
1364
1395
  Maps.prototype.mapsOnResize = function (e) {
1365
1396
  var _this = this;
1366
- this.isResize = this.isReset = true;
1367
- var args = {
1368
- cancel: false,
1369
- name: resize,
1370
- previousSize: this.availableSize,
1371
- currentSize: calculateSize(this),
1372
- maps: this
1373
- };
1374
- this.trigger(resize, args);
1375
- if (!args.cancel) {
1376
- if (this.resizeTo) {
1377
- clearTimeout(this.resizeTo);
1378
- }
1379
- if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-maps')) {
1380
- this.resizeTo = setTimeout(function () {
1381
- _this.unWireEVents();
1382
- _this.createSVG();
1383
- _this.refreshing = true;
1384
- _this.wireEVents();
1385
- _this.render();
1386
- _this.refreshing = false;
1387
- }, 500);
1397
+ if (!this.isDestroyed) {
1398
+ this.isResize = this.isReset = true;
1399
+ var args = {
1400
+ cancel: false,
1401
+ name: resize,
1402
+ previousSize: this.availableSize,
1403
+ currentSize: calculateSize(this),
1404
+ maps: this
1405
+ };
1406
+ this.trigger(resize, args);
1407
+ if (!args.cancel) {
1408
+ if (this.resizeTo) {
1409
+ clearTimeout(this.resizeTo);
1410
+ }
1411
+ if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-maps')) {
1412
+ this.resizeTo = setTimeout(function () {
1413
+ _this.unWireEVents();
1414
+ _this.createSVG();
1415
+ _this.refreshing = true;
1416
+ _this.wireEVents();
1417
+ _this.render();
1418
+ _this.refreshing = false;
1419
+ }, 500);
1420
+ }
1388
1421
  }
1389
1422
  }
1390
1423
  return false;
@@ -1399,32 +1432,34 @@ var Maps = /** @class */ (function (_super) {
1399
1432
  * @returns {void}
1400
1433
  */
1401
1434
  Maps.prototype.zoomByPosition = function (centerPosition, zoomFactor) {
1402
- var factor = this.mapLayerPanel.calculateFactor(this.layersCollection[0]);
1403
- var position;
1404
- var size = this.mapAreaRect;
1405
- if (!this.isTileMap && this.zoomModule) {
1406
- if (!isNullOrUndefined(centerPosition)) {
1407
- position = convertGeoToPoint(centerPosition.latitude, centerPosition.longitude, factor, this.layersCollection[0], this);
1408
- var mapRect = document.getElementById(this.element.id + '_Layer_Collections').getBoundingClientRect();
1409
- var svgRect = this.svgObject.getBoundingClientRect();
1410
- var xDiff = Math.abs(mapRect.left - svgRect.left) / this.scale;
1411
- var yDiff = Math.abs(mapRect.top - svgRect.top) / this.scale;
1412
- var x = this.translatePoint.x + xDiff;
1413
- var y = this.translatePoint.y + yDiff;
1414
- this.scale = zoomFactor;
1415
- this.translatePoint.x = ((mapRect.left < svgRect.left ? x : 0) + (size.width / 2) - (position.x * zoomFactor)) / zoomFactor;
1416
- this.translatePoint.y = ((mapRect.top < svgRect.top ? y : 0) + (size.height / 2) - (position.y * zoomFactor)) / zoomFactor;
1417
- this.zoomModule.applyTransform(this);
1435
+ if (!this.isDestroyed) {
1436
+ this.zoomNotApplied = false;
1437
+ var isRefresh = this.zoomSettings.zoomFactor === zoomFactor;
1438
+ if (!this.isTileMap && this.zoomModule) {
1439
+ if (!isNullOrUndefined(centerPosition)) {
1440
+ this.zoomSettings.zoomFactor = zoomFactor;
1441
+ isRefresh = this.centerPosition.latitude === centerPosition.latitude &&
1442
+ this.centerPosition.longitude === centerPosition.longitude ? true : isRefresh;
1443
+ this.centerPosition = centerPosition;
1444
+ this.isZoomByPosition = true;
1445
+ this.mapScaleValue = null;
1446
+ }
1447
+ else {
1448
+ this.zoomSettings.zoomFactor = zoomFactor;
1449
+ this.isZoomByPosition = true;
1450
+ this.mapScaleValue = null;
1451
+ }
1418
1452
  }
1419
- else {
1420
- position = { x: size.width / 2, y: size.height / 2 };
1421
- this.zoomModule.performZooming(position, zoomFactor, zoomFactor > this.scale ? 'ZoomIn' : 'ZoomOut');
1453
+ else if (this.zoomModule) {
1454
+ this.tileZoomLevel = this.zoomSettings.zoomFactor = zoomFactor;
1455
+ isRefresh = this.centerPosition.latitude === centerPosition.latitude &&
1456
+ this.centerPosition.longitude === centerPosition.longitude ? true : isRefresh;
1457
+ this.centerPosition = centerPosition;
1458
+ this.isZoomByPosition = true;
1459
+ }
1460
+ if (isRefresh) {
1461
+ this.refresh();
1422
1462
  }
1423
- }
1424
- else if (this.zoomModule) {
1425
- this.tileZoomLevel = zoomFactor;
1426
- this.tileTranslatePoint = this.mapLayerPanel['panTileMap'](this.availableSize.width, this.availableSize.height, { x: centerPosition.longitude, y: centerPosition.latitude });
1427
- this.mapLayerPanel.generateTiles(zoomFactor, this.tileTranslatePoint, null, new BingMap(this));
1428
1463
  }
1429
1464
  };
1430
1465
  /**
@@ -1432,38 +1467,44 @@ var Maps = /** @class */ (function (_super) {
1432
1467
  *
1433
1468
  * @param {PanDirection} direction - Specifies the direction in which the panning is performed.
1434
1469
  * @param {PointerEvent | TouchEvent} mouseLocation - Specifies the location of the mouse pointer in maps.
1470
+ * @returns {void}
1435
1471
  */
1436
1472
  Maps.prototype.panByDirection = function (direction, mouseLocation) {
1437
- var xDiff = 0;
1438
- var yDiff = 0;
1439
- switch (direction) {
1440
- case 'Left':
1441
- xDiff = -(this.mapAreaRect.width / 7);
1442
- break;
1443
- case 'Right':
1444
- xDiff = (this.mapAreaRect.width / 7);
1445
- break;
1446
- case 'Top':
1447
- yDiff = -(this.mapAreaRect.height / 7);
1448
- break;
1449
- case 'Bottom':
1450
- yDiff = (this.mapAreaRect.height / 7);
1451
- break;
1452
- }
1453
- if (this.zoomModule) {
1454
- this.zoomModule.panning(direction, xDiff, yDiff, mouseLocation);
1473
+ if (!this.isDestroyed) {
1474
+ var xDiff = 0;
1475
+ var yDiff = 0;
1476
+ switch (direction) {
1477
+ case 'Left':
1478
+ xDiff = -(this.mapAreaRect.width / 7);
1479
+ break;
1480
+ case 'Right':
1481
+ xDiff = (this.mapAreaRect.width / 7);
1482
+ break;
1483
+ case 'Top':
1484
+ yDiff = -(this.mapAreaRect.height / 7);
1485
+ break;
1486
+ case 'Bottom':
1487
+ yDiff = (this.mapAreaRect.height / 7);
1488
+ break;
1489
+ }
1490
+ if (this.zoomModule) {
1491
+ this.zoomModule.panning(direction, xDiff, yDiff, mouseLocation);
1492
+ }
1455
1493
  }
1456
1494
  };
1457
1495
  /**
1458
1496
  * This method is used to add the layers dynamically to the maps.
1459
1497
  *
1460
1498
  * @param {Object} layer - Specifies the layer for the maps.
1499
+ * @returns {void}
1461
1500
  */
1462
1501
  Maps.prototype.addLayer = function (layer) {
1463
- var mapsLayer = this.layers;
1464
- mapsLayer.push(layer);
1465
- this.isAddLayer = true;
1466
- this.layers = mapsLayer;
1502
+ if (!this.isDestroyed) {
1503
+ var mapsLayer = this.layers;
1504
+ mapsLayer.push(layer);
1505
+ this.isAddLayer = true;
1506
+ this.layers = mapsLayer;
1507
+ }
1467
1508
  };
1468
1509
  /**
1469
1510
  * This method is used to remove a layer from map.
@@ -1472,9 +1513,11 @@ var Maps = /** @class */ (function (_super) {
1472
1513
  * @returns {void}
1473
1514
  */
1474
1515
  Maps.prototype.removeLayer = function (index) {
1475
- var mapsLayer = this.layers;
1476
- mapsLayer.splice(index, 1);
1477
- this.layers = mapsLayer;
1516
+ if (!this.isDestroyed) {
1517
+ var mapsLayer = this.layers;
1518
+ mapsLayer.splice(index, 1);
1519
+ this.layers = mapsLayer;
1520
+ }
1478
1521
  };
1479
1522
  /**
1480
1523
  * This method is used to add markers dynamically in the maps.
@@ -1486,15 +1529,17 @@ var Maps = /** @class */ (function (_super) {
1486
1529
  * @returns {void}
1487
1530
  */
1488
1531
  Maps.prototype.addMarker = function (layerIndex, markerCollection) {
1489
- var layerEle = document.getElementById(this.element.id + '_LayerIndex_' + layerIndex);
1490
- if (markerCollection.length > 0 && layerEle) {
1491
- for (var _i = 0, markerCollection_1 = markerCollection; _i < markerCollection_1.length; _i++) {
1492
- var newMarker = markerCollection_1[_i];
1493
- this.layersCollection[layerIndex].markerSettings.push(new MarkerSettings(this, 'markerSettings', newMarker));
1532
+ if (!this.isDestroyed) {
1533
+ var layerEle = document.getElementById(this.element.id + '_LayerIndex_' + layerIndex);
1534
+ if (markerCollection.length > 0 && layerEle) {
1535
+ for (var _i = 0, markerCollection_1 = markerCollection; _i < markerCollection_1.length; _i++) {
1536
+ var newMarker = markerCollection_1[_i];
1537
+ this.layersCollection[layerIndex].markerSettings.push(new MarkerSettings(this, 'markerSettings', newMarker));
1538
+ }
1539
+ var markerModule = new Marker(this);
1540
+ markerModule.markerRender(this, layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
1541
+ this.arrangeTemplate();
1494
1542
  }
1495
- var markerModule = new Marker(this);
1496
- markerModule.markerRender(this, layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
1497
- this.arrangeTemplate();
1498
1543
  }
1499
1544
  };
1500
1545
  /**
@@ -1507,93 +1552,96 @@ var Maps = /** @class */ (function (_super) {
1507
1552
  * @returns {void}
1508
1553
  */
1509
1554
  Maps.prototype.shapeSelection = function (layerIndex, propertyName, name, enable) {
1510
- var targetEle;
1511
- var subLayerIndex;
1512
- var popertyNameArray = Array.isArray(propertyName) ? propertyName : Array(propertyName);
1513
- if (isNullOrUndefined(enable)) {
1514
- enable = true;
1515
- }
1516
- var selectionsettings = this.layers[layerIndex].selectionSettings;
1517
- if (!selectionsettings.enableMultiSelect && this.legendSelection && enable) {
1518
- this.removeShapeSelection();
1519
- }
1520
- if (this.layers[layerIndex].type === 'SubLayer') {
1521
- for (var i = 0; i < this.layersCollection.length; i++) {
1522
- if ((this.layersCollection[i].shapeData === this.layers[layerIndex].shapeData)) {
1523
- subLayerIndex = i;
1524
- break;
1555
+ if (!this.isDestroyed) {
1556
+ var targetEle = void 0;
1557
+ var subLayerIndex = void 0;
1558
+ var popertyNameArray = Array.isArray(propertyName) ? propertyName : Array(propertyName);
1559
+ if (isNullOrUndefined(enable)) {
1560
+ enable = true;
1561
+ }
1562
+ var selectionsettings = this.layers[layerIndex].selectionSettings;
1563
+ if (!selectionsettings.enableMultiSelect && this.legendSelection && enable) {
1564
+ this.removeShapeSelection();
1565
+ }
1566
+ if (this.layers[layerIndex].type === 'SubLayer') {
1567
+ for (var i = 0; i < this.layersCollection.length; i++) {
1568
+ if ((this.layersCollection[i].shapeData === this.layers[layerIndex].shapeData)) {
1569
+ subLayerIndex = i;
1570
+ break;
1571
+ }
1525
1572
  }
1526
1573
  }
1527
- }
1528
- if (selectionsettings.enable) {
1529
- var targetId = void 0;
1530
- var dataIndex = void 0;
1531
- var shapeIndex = void 0;
1532
- var indexValue = void 0;
1533
- var shapeDataValue = void 0;
1534
- var data = void 0;
1535
- var shapeData = this.layers[layerIndex].shapeData['features'];
1536
- for (var i = 0; i < shapeData.length; i++) {
1537
- for (var j = 0; j < popertyNameArray.length; j++) {
1538
- var propertyName_1 = !isNullOrUndefined(shapeData[i]['properties'][popertyNameArray[j]])
1539
- && isNaN(shapeData[i]['properties'][popertyNameArray[j]]) ?
1540
- shapeData[i]['properties'][popertyNameArray[j]].toLowerCase() : shapeData[i]['properties'][popertyNameArray[j]];
1541
- var shapeName = !isNullOrUndefined(name) && typeof name === 'string' ? name.toLowerCase() : name;
1542
- var k = void 0;
1543
- if (propertyName_1 === shapeName) {
1544
- if (!isNullOrUndefined(this.layers[layerIndex].shapeSettings.colorValuePath)) {
1545
- k = checkShapeDataFields(this.layers[layerIndex].dataSource, shapeData[i]['properties'], this.layers[layerIndex].shapeDataPath, this.layers[layerIndex].shapePropertyPath, this.layers[layerIndex]);
1546
- }
1547
- var baseLayer = this.layers[layerIndex];
1548
- if (this.baseLayerIndex >= 0 && baseLayer.isBaseLayer) {
1549
- indexValue = 0;
1550
- }
1551
- else if (this.layers[layerIndex].type === 'SubLayer') {
1552
- indexValue = subLayerIndex;
1553
- }
1554
- targetId = this.element.id + '_' + 'LayerIndex_' + indexValue + '_shapeIndex_' + i + '_dataIndex_' + k;
1555
- targetEle = getElement(targetId);
1556
- if (isNullOrUndefined(k) && isNullOrUndefined(targetEle)) {
1557
- targetId = this.element.id + '_' + 'LayerIndex_' + layerIndex + '_shapeIndex_' + i + '_dataIndex_null';
1574
+ if (selectionsettings.enable) {
1575
+ var targetId = void 0;
1576
+ var dataIndex = void 0;
1577
+ var shapeIndex = void 0;
1578
+ var indexValue = void 0;
1579
+ var shapeDataValue = void 0;
1580
+ var data = void 0;
1581
+ var shapeData = this.layers[layerIndex].shapeData['features'];
1582
+ for (var i = 0; i < shapeData.length; i++) {
1583
+ for (var j = 0; j < popertyNameArray.length; j++) {
1584
+ var propertyName_1 = !isNullOrUndefined(shapeData[i]['properties'][popertyNameArray[j]])
1585
+ && isNaN(shapeData[i]['properties'][popertyNameArray[j]]) ?
1586
+ shapeData[i]['properties'][popertyNameArray[j]].toLowerCase() : shapeData[i]['properties'][popertyNameArray[j]];
1587
+ var shapeName = !isNullOrUndefined(name) && typeof name === 'string' ? name.toLowerCase() : name;
1588
+ var k = void 0;
1589
+ if (propertyName_1 === shapeName) {
1590
+ if (!isNullOrUndefined(this.layers[layerIndex].shapeSettings.colorValuePath)) {
1591
+ k = checkShapeDataFields(this.layers[layerIndex].dataSource, shapeData[i]['properties'], this.layers[layerIndex].shapeDataPath, this.layers[layerIndex].shapePropertyPath, this.layers[layerIndex]);
1592
+ }
1593
+ var baseLayer = this.layers[layerIndex];
1594
+ if (this.baseLayerIndex >= 0 && baseLayer.isBaseLayer) {
1595
+ indexValue = 0;
1596
+ }
1597
+ else if (this.layers[layerIndex].type === 'SubLayer') {
1598
+ indexValue = subLayerIndex;
1599
+ }
1600
+ targetId = this.element.id + '_' + 'LayerIndex_' + indexValue + '_shapeIndex_' + i + '_dataIndex_' + k;
1558
1601
  targetEle = getElement(targetId);
1559
- }
1560
- shapeIndex = parseInt(targetEle.id.split('_shapeIndex_')[1].split('_')[0], 10);
1561
- shapeDataValue = this.layers[layerIndex].shapeData['features']['length'] > shapeIndex ?
1562
- this.layers[layerIndex].shapeData['features'][shapeIndex]['properties'] : null;
1563
- dataIndex = parseInt(targetEle.id.split('_dataIndex_')[1].split('_')[0], 10);
1564
- data = isNullOrUndefined(dataIndex) ? null : this.layers[layerIndex].dataSource[dataIndex];
1565
- if (enable) {
1566
- triggerItemSelectionEvent(selectionsettings, this, targetEle, shapeDataValue, data);
1567
- this.shapeSelectionClass = getElement('ShapeselectionMap');
1568
- if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1) {
1569
- this.legendModule.shapeHighLightAndSelection(targetEle, data, selectionsettings, 'selection', layerIndex);
1602
+ if (isNullOrUndefined(k) && isNullOrUndefined(targetEle)) {
1603
+ targetId = this.element.id + '_' + 'LayerIndex_' + layerIndex + '_shapeIndex_' + i + '_dataIndex_null';
1604
+ targetEle = getElement(targetId);
1570
1605
  }
1571
- var shapeToggled = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
1572
- if (shapeToggled) {
1573
- targetEle.setAttribute('class', 'ShapeselectionMapStyle');
1574
- if (this.selectedElementId.indexOf(targetEle.getAttribute('id')) === -1) {
1575
- this.selectedElementId.push(targetEle.getAttribute('id'));
1606
+ shapeIndex = parseInt(targetEle.id.split('_shapeIndex_')[1].split('_')[0], 10);
1607
+ shapeDataValue = this.layers[layerIndex].shapeData['features']['length'] > shapeIndex ?
1608
+ this.layers[layerIndex].shapeData['features'][shapeIndex]['properties'] : null;
1609
+ dataIndex = parseInt(targetEle.id.split('_dataIndex_')[1].split('_')[0], 10);
1610
+ data = isNullOrUndefined(dataIndex) ? null : this.layers[layerIndex].dataSource[dataIndex];
1611
+ if (enable) {
1612
+ triggerItemSelectionEvent(selectionsettings, this, targetEle, shapeDataValue, data);
1613
+ this.shapeSelectionClass = getElement('ShapeselectionMap');
1614
+ if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1) {
1615
+ this.legendModule.shapeHighLightAndSelection(targetEle, data, selectionsettings, 'selection', layerIndex);
1576
1616
  }
1577
- if (!selectionsettings.enableMultiSelect) {
1578
- return;
1617
+ var shapeToggled = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
1618
+ if (shapeToggled) {
1619
+ targetEle.setAttribute('class', 'ShapeselectionMapStyle');
1620
+ if (this.selectedElementId.indexOf(targetEle.getAttribute('id')) === -1) {
1621
+ this.selectedElementId.push(targetEle.getAttribute('id'));
1622
+ }
1623
+ if (!selectionsettings.enableMultiSelect) {
1624
+ return;
1625
+ }
1579
1626
  }
1580
1627
  }
1581
- }
1582
- else {
1583
- this.legendSelection = (!selectionsettings.enableMultiSelect && !this.legendSelection) ?
1584
- true : this.legendSelection;
1585
- if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1 &&
1586
- targetEle.getAttribute('class') === 'ShapeselectionMapStyle') {
1587
- this.legendModule.shapeHighLightAndSelection(targetEle, data, selectionsettings, 'selection', layerIndex);
1588
- }
1589
- var shapeToggled = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
1590
- if (shapeToggled) {
1591
- removeClass(targetEle);
1592
- var selectedElementIdIndex = this.selectedElementId.indexOf(targetEle.getAttribute('id'));
1593
- if (selectedElementIdIndex !== -1) {
1594
- this.selectedElementId.splice(selectedElementIdIndex, 1);
1595
- if (!selectionsettings.enableMultiSelect && this.legendSelection && this.selectedElementId.length > 0) {
1596
- this.removeShapeSelection();
1628
+ else {
1629
+ this.legendSelection = (!selectionsettings.enableMultiSelect && !this.legendSelection) ?
1630
+ true : this.legendSelection;
1631
+ if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1 &&
1632
+ targetEle.getAttribute('class') === 'ShapeselectionMapStyle') {
1633
+ this.legendModule.shapeHighLightAndSelection(targetEle, data, selectionsettings, 'selection', layerIndex);
1634
+ }
1635
+ var shapeToggled = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
1636
+ if (shapeToggled) {
1637
+ removeClass(targetEle);
1638
+ var selectedElementIdIndex = this.selectedElementId.indexOf(targetEle.getAttribute('id'));
1639
+ if (selectedElementIdIndex !== -1) {
1640
+ this.selectedElementId.splice(selectedElementIdIndex, 1);
1641
+ if (!selectionsettings.enableMultiSelect && this.legendSelection
1642
+ && this.selectedElementId.length > 0) {
1643
+ this.removeShapeSelection();
1644
+ }
1597
1645
  }
1598
1646
  }
1599
1647
  }
@@ -1614,48 +1662,55 @@ var Maps = /** @class */ (function (_super) {
1614
1662
  */
1615
1663
  Maps.prototype.zoomToCoordinates = function (minLatitude, minLongitude, maxLatitude, maxLongitude) {
1616
1664
  var _a, _b;
1617
- var centerLatitude;
1618
- var centerLongtitude;
1619
- var isTwoCoordinates = false;
1620
- if (isNullOrUndefined(maxLatitude) && isNullOrUndefined(maxLongitude)
1621
- || isNullOrUndefined(minLatitude) && isNullOrUndefined(minLongitude)) {
1622
- minLatitude = isNullOrUndefined(minLatitude) ? 0 : minLatitude;
1623
- minLongitude = isNullOrUndefined(minLatitude) ? 0 : minLongitude;
1624
- maxLatitude = isNullOrUndefined(maxLatitude) ? minLatitude : maxLatitude;
1625
- maxLongitude = isNullOrUndefined(maxLongitude) ? minLongitude : maxLongitude;
1626
- isTwoCoordinates = true;
1627
- }
1628
- if (minLatitude > maxLatitude) {
1629
- _a = [maxLatitude, minLatitude], minLatitude = _a[0], maxLatitude = _a[1];
1630
- }
1631
- if (minLongitude > maxLongitude) {
1632
- _b = [maxLongitude, minLongitude], minLongitude = _b[0], maxLongitude = _b[1];
1633
- }
1634
- if (!isTwoCoordinates) {
1635
- centerLatitude = (minLatitude + maxLatitude) / 2;
1636
- centerLongtitude = (minLongitude + maxLongitude) / 2;
1665
+ if (!this.isDestroyed) {
1666
+ var centerLatitude = void 0;
1667
+ var centerLongtitude = void 0;
1668
+ var isTwoCoordinates = false;
1669
+ this.centerPosition = {
1670
+ latitude: null,
1671
+ longitude: null
1672
+ };
1673
+ this.isZoomByPosition = false;
1674
+ if (isNullOrUndefined(maxLatitude) && isNullOrUndefined(maxLongitude)
1675
+ || isNullOrUndefined(minLatitude) && isNullOrUndefined(minLongitude)) {
1676
+ minLatitude = isNullOrUndefined(minLatitude) ? 0 : minLatitude;
1677
+ minLongitude = isNullOrUndefined(minLatitude) ? 0 : minLongitude;
1678
+ maxLatitude = isNullOrUndefined(maxLatitude) ? minLatitude : maxLatitude;
1679
+ maxLongitude = isNullOrUndefined(maxLongitude) ? minLongitude : maxLongitude;
1680
+ isTwoCoordinates = true;
1681
+ }
1682
+ if (minLatitude > maxLatitude) {
1683
+ _a = [maxLatitude, minLatitude], minLatitude = _a[0], maxLatitude = _a[1];
1684
+ }
1685
+ if (minLongitude > maxLongitude) {
1686
+ _b = [maxLongitude, minLongitude], minLongitude = _b[0], maxLongitude = _b[1];
1687
+ }
1688
+ if (!isTwoCoordinates) {
1689
+ centerLatitude = (minLatitude + maxLatitude) / 2;
1690
+ centerLongtitude = (minLongitude + maxLongitude) / 2;
1691
+ }
1692
+ else {
1693
+ centerLatitude = (minLatitude + maxLatitude);
1694
+ centerLongtitude = (minLongitude + maxLongitude);
1695
+ }
1696
+ this.centerLatOfGivenLocation = centerLatitude;
1697
+ this.centerLongOfGivenLocation = centerLongtitude;
1698
+ this.minLatOfGivenLocation = minLatitude;
1699
+ this.minLongOfGivenLocation = minLongitude;
1700
+ this.maxLatOfGivenLocation = maxLatitude;
1701
+ this.maxLongOfGivenLocation = maxLongitude;
1702
+ this.zoomNotApplied = true;
1703
+ this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this);
1704
+ var zoomArgs = {
1705
+ cancel: false, name: 'zoom', type: zoomIn, maps: this,
1706
+ tileTranslatePoint: {}, translatePoint: {},
1707
+ tileZoomLevel: this.isTileMap ? { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation } : {},
1708
+ scale: !this.isTileMap ? { previous: this.scale, current: this.scaleOfGivenLocation } :
1709
+ { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation }
1710
+ };
1711
+ this.trigger('zoom', zoomArgs);
1712
+ this.refresh();
1637
1713
  }
1638
- else {
1639
- centerLatitude = (minLatitude + maxLatitude);
1640
- centerLongtitude = (minLongitude + maxLongitude);
1641
- }
1642
- this.centerLatOfGivenLocation = centerLatitude;
1643
- this.centerLongOfGivenLocation = centerLongtitude;
1644
- this.minLatOfGivenLocation = minLatitude;
1645
- this.minLongOfGivenLocation = minLongitude;
1646
- this.maxLatOfGivenLocation = maxLatitude;
1647
- this.maxLongOfGivenLocation = maxLongitude;
1648
- this.zoomNotApplied = true;
1649
- this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this);
1650
- var zoomArgs = {
1651
- cancel: false, name: 'zoom', type: zoomIn, maps: this,
1652
- tileTranslatePoint: {}, translatePoint: {},
1653
- tileZoomLevel: this.isTileMap ? { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation } : {},
1654
- scale: !this.isTileMap ? { previous: this.scale, current: this.scaleOfGivenLocation } :
1655
- { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation }
1656
- };
1657
- this.trigger('zoom', zoomArgs);
1658
- this.refresh();
1659
1714
  };
1660
1715
  /**
1661
1716
  * This method is used to remove multiple selected shapes in the maps.
@@ -1706,6 +1761,8 @@ var Maps = /** @class */ (function (_super) {
1706
1761
  };
1707
1762
  /**
1708
1763
  * This method disposes the maps component.
1764
+ *
1765
+ * @returns {void}
1709
1766
  */
1710
1767
  Maps.prototype.destroy = function () {
1711
1768
  this.unWireEVents();
@@ -1762,93 +1819,96 @@ var Maps = /** @class */ (function (_super) {
1762
1819
  * @private
1763
1820
  */
1764
1821
  Maps.prototype.onPropertyChanged = function (newProp, oldProp) {
1765
- var render = false;
1766
- var isMarker = false;
1767
- var isLayer = false;
1768
- var isStaticMapType = false;
1769
- var layerEle;
1770
- if (newProp['layers']) {
1771
- var newLayerLength = Object.keys(newProp['layers']).length;
1772
- layerEle = document.getElementById(this.element.id + '_LayerIndex_' + (newLayerLength - 1));
1773
- }
1774
- for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
1775
- var prop = _a[_i];
1776
- switch (prop) {
1777
- case 'background':
1778
- this.renderBorder();
1779
- break;
1780
- case 'height':
1781
- case 'width':
1782
- case 'layers':
1783
- case 'projectionType':
1784
- case 'centerPosition':
1785
- case 'legendSettings':
1786
- case 'baseLayerIndex':
1787
- if (prop === 'layers') {
1788
- isLayer = true;
1789
- var layerPropLength = Object.keys(newProp.layers).length;
1790
- for (var x = 0; x < layerPropLength; x++) {
1791
- if (!isNullOrUndefined(newProp.layers[x])) {
1792
- var collection = Object.keys(newProp.layers[x]);
1793
- for (var _b = 0, collection_1 = collection; _b < collection_1.length; _b++) {
1794
- var collectionProp = collection_1[_b];
1795
- if ((collectionProp === 'layerType' && newProp.layers[x].layerType !== 'Geometry') || (isNullOrUndefined(this.layers[x].shapeData)
1796
- && !isNullOrUndefined(this.layers[x].urlTemplate) && this.layers[x].urlTemplate !== '')) {
1797
- this.isReset = true;
1798
- }
1799
- else if (collectionProp === 'markerSettings') {
1800
- isMarker = true;
1801
- }
1802
- else if (collectionProp === 'staticMapType') {
1803
- isStaticMapType = true;
1822
+ if (!this.isDestroyed) {
1823
+ var render = false;
1824
+ var isMarker = false;
1825
+ var isLayer = false;
1826
+ var isStaticMapType = false;
1827
+ var layerEle = void 0;
1828
+ if (newProp['layers']) {
1829
+ var newLayerLength = Object.keys(newProp['layers']).length;
1830
+ layerEle = document.getElementById(this.element.id + '_LayerIndex_' + (newLayerLength - 1));
1831
+ }
1832
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
1833
+ var prop = _a[_i];
1834
+ switch (prop) {
1835
+ case 'background':
1836
+ this.renderBorder();
1837
+ break;
1838
+ case 'height':
1839
+ case 'width':
1840
+ case 'layers':
1841
+ case 'projectionType':
1842
+ case 'centerPosition':
1843
+ case 'legendSettings':
1844
+ case 'baseLayerIndex':
1845
+ if (prop === 'layers') {
1846
+ isLayer = true;
1847
+ var layerPropLength = Object.keys(newProp.layers).length;
1848
+ for (var x = 0; x < layerPropLength; x++) {
1849
+ if (!isNullOrUndefined(newProp.layers[x])) {
1850
+ var collection = Object.keys(newProp.layers[x]);
1851
+ for (var _b = 0, collection_1 = collection; _b < collection_1.length; _b++) {
1852
+ var collectionProp = collection_1[_b];
1853
+ if ((collectionProp === 'layerType' && newProp.layers[x].layerType !== 'Geometry') ||
1854
+ (isNullOrUndefined(this.layers[x].shapeData)
1855
+ && !isNullOrUndefined(this.layers[x].urlTemplate) && this.layers[x].urlTemplate !== '')) {
1856
+ this.isReset = true;
1857
+ }
1858
+ else if (collectionProp === 'markerSettings') {
1859
+ isMarker = true;
1860
+ }
1861
+ else if (collectionProp === 'staticMapType') {
1862
+ isStaticMapType = true;
1863
+ }
1804
1864
  }
1805
1865
  }
1806
1866
  }
1807
1867
  }
1808
- }
1809
- render = true;
1810
- break;
1811
- case 'zoomSettings':
1812
- if (!isNullOrUndefined(oldProp.zoomSettings)) {
1813
- if (newProp.zoomSettings.zoomFactor !== oldProp.zoomSettings.zoomFactor && !isLayer) {
1814
- render = false;
1815
- }
1816
- else if (newProp.zoomSettings.shouldZoomInitially !== oldProp.zoomSettings.shouldZoomInitially) {
1817
- this.zoomSettings.zoomFactor = 1;
1818
- render = true;
1819
- }
1820
- else if (newProp.zoomSettings.enable !== oldProp.zoomSettings.enable) {
1821
- this.zoomSettings.zoomFactor = 1;
1822
- render = true;
1823
- }
1824
- else {
1825
- render = true;
1868
+ render = true;
1869
+ break;
1870
+ case 'zoomSettings':
1871
+ if (!isNullOrUndefined(oldProp.zoomSettings)) {
1872
+ if (newProp.zoomSettings.zoomFactor !== oldProp.zoomSettings.zoomFactor && !isLayer) {
1873
+ render = false;
1874
+ }
1875
+ else if (newProp.zoomSettings.shouldZoomInitially !== oldProp.zoomSettings.shouldZoomInitially) {
1876
+ this.zoomSettings.zoomFactor = 1;
1877
+ render = true;
1878
+ }
1879
+ else if (newProp.zoomSettings.enable !== oldProp.zoomSettings.enable) {
1880
+ this.zoomSettings.zoomFactor = 1;
1881
+ render = true;
1882
+ }
1883
+ else {
1884
+ render = true;
1885
+ }
1826
1886
  }
1827
- }
1828
- break;
1829
- case 'locale':
1830
- case 'currencyCode':
1831
- _super.prototype.refresh.call(this);
1832
- break;
1887
+ break;
1888
+ case 'locale':
1889
+ case 'currencyCode':
1890
+ _super.prototype.refresh.call(this);
1891
+ break;
1892
+ }
1833
1893
  }
1834
- }
1835
- if (render) {
1836
- if (newProp.layers && isMarker) {
1837
- removeElement(this.element.id + '_Markers_Group');
1838
- if (this.isTileMap) {
1839
- this.mapLayerPanel.renderTileLayer(this.mapLayerPanel, this.layers['currentFactor'], (this.layers.length - 1));
1894
+ if (render) {
1895
+ if (newProp.layers && isMarker) {
1896
+ removeElement(this.element.id + '_Markers_Group');
1897
+ if (this.isTileMap) {
1898
+ this.mapLayerPanel.renderTileLayer(this.mapLayerPanel, this.layers['currentFactor'], (this.layers.length - 1));
1899
+ }
1900
+ else {
1901
+ this.render();
1902
+ }
1903
+ }
1904
+ else if (newProp.layers && isStaticMapType) {
1905
+ this.mapLayerPanel.renderGoogleMap(this.layers[this.layers.length - 1].key, this.staticMapZoom);
1840
1906
  }
1841
1907
  else {
1842
- this.render();
1908
+ this.createSVG();
1909
+ this.renderElements();
1843
1910
  }
1844
1911
  }
1845
- else if (newProp.layers && isStaticMapType) {
1846
- this.mapLayerPanel.renderGoogleMap(this.layers[this.layers.length - 1].key, this.staticMapZoom);
1847
- }
1848
- else {
1849
- this.createSVG();
1850
- this.renderElements();
1851
- }
1852
1912
  }
1853
1913
  };
1854
1914
  /**
@@ -1861,7 +1921,7 @@ var Maps = /** @class */ (function (_super) {
1861
1921
  var modules = [];
1862
1922
  var isVisible = this.findVisibleLayers(this.layers);
1863
1923
  var annotationEnable = false;
1864
- this.annotations.map(function (annotation, index) {
1924
+ this.annotations.map(function (annotation) {
1865
1925
  annotationEnable = annotation.content != null;
1866
1926
  });
1867
1927
  if (this.isBubbleVisible()) {
@@ -1946,10 +2006,12 @@ var Maps = /** @class */ (function (_super) {
1946
2006
  };
1947
2007
  /**
1948
2008
  * To find marker visibility
2009
+ *
2010
+ * @returns {boolean} - Returns whether the markers are visible or not.
1949
2011
  */
1950
2012
  Maps.prototype.isMarkersVisible = function () {
1951
2013
  var isVisible = false;
1952
- Array.prototype.forEach.call(this.layers, function (layer, layerIndex) {
2014
+ Array.prototype.forEach.call(this.layers, function (layer) {
1953
2015
  for (var i = 0; i < layer.markerSettings.length; i++) {
1954
2016
  if (layer.markerSettings[i].visible) {
1955
2017
  isVisible = true;
@@ -1961,6 +2023,8 @@ var Maps = /** @class */ (function (_super) {
1961
2023
  };
1962
2024
  /**
1963
2025
  * To find DataLabel visibility
2026
+ *
2027
+ * @returns {boolean} - Returns whether the data labels are visible or not.
1964
2028
  */
1965
2029
  Maps.prototype.isDataLabelVisible = function () {
1966
2030
  var isVisible = false;
@@ -1974,10 +2038,12 @@ var Maps = /** @class */ (function (_super) {
1974
2038
  };
1975
2039
  /**
1976
2040
  * To find navigation line visibility
2041
+ *
2042
+ * @returns {boolean} - Returns whether the navigation lines are visible or not.
1977
2043
  */
1978
2044
  Maps.prototype.isNavigationVisible = function () {
1979
2045
  var isVisible = false;
1980
- Array.prototype.forEach.call(this.layers, function (layer, layerIndex) {
2046
+ Array.prototype.forEach.call(this.layers, function (layer) {
1981
2047
  for (var i = 0; i < layer.navigationLineSettings.length; i++) {
1982
2048
  if (layer.navigationLineSettings[i].visible) {
1983
2049
  isVisible = true;
@@ -1989,6 +2055,8 @@ var Maps = /** @class */ (function (_super) {
1989
2055
  };
1990
2056
  /**
1991
2057
  * To find space between the secondary element and svg element.
2058
+ *
2059
+ * @returns {Point} - Returns the left and top value of the secondary element of Maps.
1992
2060
  * @private
1993
2061
  */
1994
2062
  Maps.prototype.getExtraPosition = function () {
@@ -2046,7 +2114,7 @@ var Maps = /** @class */ (function (_super) {
2046
2114
  * @returns {void}
2047
2115
  */
2048
2116
  Maps.prototype.print = function (id) {
2049
- if ((this.allowPrint) && (this.printModule)) {
2117
+ if ((this.allowPrint) && (this.printModule) && !this.isDestroyed) {
2050
2118
  this.printModule.print(this, id);
2051
2119
  }
2052
2120
  };
@@ -2061,18 +2129,20 @@ var Maps = /** @class */ (function (_super) {
2061
2129
  */
2062
2130
  Maps.prototype.export = function (type, fileName, orientation, allowDownload) {
2063
2131
  var _this = this;
2064
- if (isNullOrUndefined(allowDownload)) {
2065
- allowDownload = true;
2066
- }
2067
- if ((type !== 'PDF') && (this.allowImageExport) && (this.imageExportModule)) {
2068
- return new Promise(function (resolve, reject) {
2069
- resolve(_this.imageExportModule.export(_this, type, fileName, allowDownload));
2070
- });
2071
- }
2072
- else if ((this.allowPdfExport) && (this.pdfExportModule)) {
2073
- return new Promise(function (resolve, reject) {
2074
- resolve(_this.pdfExportModule.export(_this, type, fileName, allowDownload, orientation));
2075
- });
2132
+ if (!this.isDestroyed) {
2133
+ if (isNullOrUndefined(allowDownload)) {
2134
+ allowDownload = true;
2135
+ }
2136
+ if ((type !== 'PDF') && (this.allowImageExport) && (this.imageExportModule)) {
2137
+ return new Promise(function (resolve, reject) {
2138
+ resolve(_this.imageExportModule.export(_this, type, fileName, allowDownload));
2139
+ });
2140
+ }
2141
+ else if ((this.allowPdfExport) && (this.pdfExportModule)) {
2142
+ return new Promise(function (resolve, reject) {
2143
+ resolve(_this.pdfExportModule.export(_this, type, fileName, allowDownload, orientation));
2144
+ });
2145
+ }
2076
2146
  }
2077
2147
  return null;
2078
2148
  };
@@ -2083,19 +2153,22 @@ var Maps = /** @class */ (function (_super) {
2083
2153
  * @returns {Promise<string>} - Returns the processed Bing URL as Promise.
2084
2154
  */
2085
2155
  Maps.prototype.getBingUrlTemplate = function (url) {
2086
- var promise = new Promise(function (resolve, reject) {
2087
- var ajax = new Ajax({
2088
- url: url
2156
+ var promise;
2157
+ if (!this.isDestroyed) {
2158
+ promise = new Promise(function (resolve, reject) {
2159
+ var ajax = new Ajax({
2160
+ url: url
2161
+ });
2162
+ ajax.onSuccess = function (json) {
2163
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2164
+ var jsonObject = JSON.parse(json);
2165
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2166
+ var resource = jsonObject['resourceSets'][0]['resources'][0];
2167
+ resolve(resource['imageUrl']);
2168
+ };
2169
+ ajax.send();
2089
2170
  });
2090
- ajax.onSuccess = function (json) {
2091
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2092
- var jsonObject = JSON.parse(json);
2093
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2094
- var resource = jsonObject['resourceSets'][0]['resources'][0];
2095
- resolve(resource['imageUrl']);
2096
- };
2097
- ajax.send();
2098
- });
2171
+ }
2099
2172
  return promise;
2100
2173
  };
2101
2174
  /**
@@ -2176,21 +2249,25 @@ var Maps = /** @class */ (function (_super) {
2176
2249
  * @returns {GeoPosition}- Returns the geo position
2177
2250
  */
2178
2251
  Maps.prototype.getGeoLocation = function (layerIndex, x, y) {
2179
- var container = document.getElementById(this.element.id);
2180
- var pageX = x - container.offsetLeft;
2181
- var pageY = y - container.offsetTop;
2182
- var currentLayer = this.layersCollection[layerIndex];
2183
- var translate = getTranslate(this, currentLayer, false);
2184
- var translatePoint = translate['location'];
2185
- var translatePointX = translatePoint.x * this.scale;
2186
- var translatePointY = translatePoint.y * this.scale;
2187
- var mapSize = (Math.min(this.mapAreaRect.height, this.mapAreaRect.width)
2188
- * this.mapLayerPanel['currentFactor']) * this.scale;
2189
- var xx = (this.clip(pageX - translatePointX, 0, mapSize - 1) / mapSize) - 0.5;
2190
- var yy = 0.5 - (this.clip(pageY - translatePointY, 0, mapSize - 1) / mapSize);
2191
- var lat = 90 - 360 * Math.atan(Math.exp(-yy * 2 * Math.PI)) / Math.PI;
2192
- var long = 360 * xx;
2193
- return { latitude: lat, longitude: long };
2252
+ var latitude = 0;
2253
+ var longitude = 0;
2254
+ if (!this.isDestroyed) {
2255
+ var container = document.getElementById(this.element.id);
2256
+ var pageX = x - container.offsetLeft;
2257
+ var pageY = y - container.offsetTop;
2258
+ var currentLayer = this.layersCollection[layerIndex];
2259
+ var translate = getTranslate(this, currentLayer, false);
2260
+ var translatePoint = translate['location'];
2261
+ var translatePointX = translatePoint.x * this.scale;
2262
+ var translatePointY = translatePoint.y * this.scale;
2263
+ var mapSize = (Math.min(this.mapAreaRect.height, this.mapAreaRect.width)
2264
+ * this.mapLayerPanel['currentFactor']) * this.scale;
2265
+ var xx = (this.clip(pageX - translatePointX, 0, mapSize - 1) / mapSize) - 0.5;
2266
+ var yy = 0.5 - (this.clip(pageY - translatePointY, 0, mapSize - 1) / mapSize);
2267
+ latitude = 90 - 360 * Math.atan(Math.exp(-yy * 2 * Math.PI)) / Math.PI;
2268
+ longitude = 360 * xx;
2269
+ }
2270
+ return { latitude: latitude, longitude: longitude };
2194
2271
  };
2195
2272
  Maps.prototype.clip = function (value, minVal, maxVal) {
2196
2273
  return Math.min(Math.max(value, minVal), maxVal);
@@ -2203,10 +2280,16 @@ var Maps = /** @class */ (function (_super) {
2203
2280
  * @returns {GeoPosition} - Returns the position
2204
2281
  */
2205
2282
  Maps.prototype.getTileGeoLocation = function (x, y) {
2206
- var container = document.getElementById(this.element.id);
2207
- var ele = document.getElementById(this.element.id + '_tile_parent');
2208
- var latLong = this.pointToLatLong(x + this.mapAreaRect.x - (ele.offsetLeft - container.offsetLeft), y + this.mapAreaRect.y - (ele.offsetTop - container.offsetTop));
2209
- return { latitude: latLong['latitude'], longitude: latLong['longitude'] };
2283
+ var latitude = 0;
2284
+ var longitude = 0;
2285
+ if (!this.isDestroyed) {
2286
+ var container = document.getElementById(this.element.id);
2287
+ var ele = document.getElementById(this.element.id + '_tile_parent');
2288
+ var latLong = this.pointToLatLong(x + this.mapAreaRect.x - (ele.offsetLeft - container.offsetLeft), y + this.mapAreaRect.y - (ele.offsetTop - container.offsetTop));
2289
+ latitude = latLong['latitude'];
2290
+ longitude = latLong['longitude'];
2291
+ }
2292
+ return { latitude: latitude, longitude: longitude };
2210
2293
  };
2211
2294
  /**
2212
2295
  * This method is used to convert the point to latitude and longitude in maps.
@@ -2216,14 +2299,18 @@ var Maps = /** @class */ (function (_super) {
2216
2299
  * @returns {Object} - Returns the object.
2217
2300
  */
2218
2301
  Maps.prototype.pointToLatLong = function (pageX, pageY) {
2219
- var padding = this.layers[this.layers.length - 1].layerType === 'GoogleStaticMap' ? 0 : 10;
2220
- pageY = (this.zoomSettings.enable) ? pageY + padding : pageY;
2221
- var mapSize = 256 * Math.pow(2, this.tileZoomLevel);
2222
- var x1 = (this.clip(pageX - (this.translatePoint.x * this.scale), 0, mapSize - 1) / mapSize) - 0.5;
2223
- var y1 = 0.5 - (this.clip(pageY - (this.translatePoint.y * this.scale), 0, mapSize - 1) / mapSize);
2224
- var lat = 90 - 360 * Math.atan(Math.exp(-y1 * 2 * Math.PI)) / Math.PI;
2225
- var long = 360 * x1;
2226
- return { latitude: lat, longitude: long };
2302
+ var latitude = 0;
2303
+ var longitude = 0;
2304
+ if (!this.isDestroyed) {
2305
+ var padding = this.layers[this.layers.length - 1].layerType === 'GoogleStaticMap' ? 0 : 10;
2306
+ pageY = (this.zoomSettings.enable) ? pageY + padding : pageY;
2307
+ var mapSize = 256 * Math.pow(2, this.tileZoomLevel);
2308
+ var x1 = (this.clip(pageX - (this.translatePoint.x * this.scale), 0, mapSize - 1) / mapSize) - 0.5;
2309
+ var y1 = 0.5 - (this.clip(pageY - (this.translatePoint.y * this.scale), 0, mapSize - 1) / mapSize);
2310
+ latitude = 90 - 360 * Math.atan(Math.exp(-y1 * 2 * Math.PI)) / Math.PI;
2311
+ longitude = 360 * x1;
2312
+ }
2313
+ return { latitude: latitude, longitude: longitude };
2227
2314
  };
2228
2315
  __decorate([
2229
2316
  Property(null)