@syncfusion/ej2-maps 28.2.9 → 29.1.34

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.
@@ -1333,7 +1333,6 @@ function mergeSeparateCluster(sameMarkerData, maps) {
1333
1333
  var markerIndex = sameMarkerData[0].markerIndex;
1334
1334
  var dataIndex = sameMarkerData[0].dataIndex;
1335
1335
  var markerId = maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_' + markerIndex;
1336
- var marker = maps.layers[layerIndex].markerSettings[markerIndex];
1337
1336
  var clusterId = markerId + '_dataIndex_' + dataIndex + '_cluster_' + clusterIndex;
1338
1337
  var clusterEle = maps.layers[layerIndex].markerClusterSettings.shape === 'Balloon' ? getElement(clusterId + '_Group') : getElement(clusterId);
1339
1338
  var clusterEleLabel = getElement(clusterId + '_datalabel_' + clusterIndex);
@@ -7395,7 +7394,7 @@ var LayerPanel = /** @__PURE__ @class */ (function () {
7395
7394
  }
7396
7395
  }
7397
7396
  };
7398
- LayerPanel.prototype.generateTiles = function (zoomLevel, tileTranslatePoint, zoomType, bing, position) {
7397
+ LayerPanel.prototype.generateTiles = function (zoomLevel, tileTranslatePoint, zoomType, bing, position, isPinch) {
7399
7398
  var userLang = this.mapObject.locale;
7400
7399
  var size = this.mapObject.availableSize;
7401
7400
  this.tiles = [];
@@ -7485,122 +7484,136 @@ var LayerPanel = /** @__PURE__ @class */ (function () {
7485
7484
  }
7486
7485
  if (this.mapObject.previousScale !== this.mapObject.scale || this.mapObject.isReset || this.mapObject.isZoomByPosition
7487
7486
  || this.mapObject.zoomNotApplied) {
7488
- this.arrangeTiles(zoomType, this.animateToZoomX, this.animateToZoomY);
7487
+ this.arrangeTiles(zoomType, this.animateToZoomX, this.animateToZoomY, isPinch);
7489
7488
  }
7490
7489
  };
7491
- LayerPanel.prototype.arrangeTiles = function (type, x, y) {
7490
+ LayerPanel.prototype.arrangeTiles = function (type, x, y, isPinch) {
7492
7491
  var _this = this;
7492
+ if (isPinch === void 0) { isPinch = false; }
7493
7493
  var element = document.getElementById(this.mapObject.element.id + '_tile_parent');
7494
7494
  var element1 = document.getElementById(this.mapObject.element.id + '_tiles');
7495
- var timeOut;
7496
- if (!isNullOrUndefined(type) && type !== 'Pan') {
7497
- this.tileAnimation(type, x, y);
7498
- timeOut = animationMode === 'Disable' ? 0 : (this.mapObject.layersCollection[0].animationDuration === 0 &&
7499
- animationMode === 'Enable') ? 1000 : this.mapObject.layersCollection[0].animationDuration;
7500
- }
7501
- else {
7502
- timeOut = 0;
7503
- }
7504
- setTimeout(function () {
7505
- if (element) {
7506
- element.style.zIndex = '1';
7507
- }
7508
- if (element1) {
7509
- element1.style.zIndex = '0';
7510
- }
7511
- var animateElement;
7512
- if (!document.getElementById(_this.mapObject.element.id + '_animated_tiles') && element) {
7513
- animateElement = createElement('div', { id: _this.mapObject.element.id + '_animated_tiles' });
7514
- element.appendChild(animateElement);
7495
+ if (!isPinch) {
7496
+ var timeOut = void 0;
7497
+ if (!isNullOrUndefined(type) && type !== 'Pan') {
7498
+ this.tileAnimation(type, x, y);
7499
+ timeOut = animationMode === 'Disable' ? 0 : (this.mapObject.layersCollection[0].animationDuration === 0 &&
7500
+ animationMode === 'Enable') ? 1000 : this.mapObject.layersCollection[0].animationDuration;
7515
7501
  }
7516
7502
  else {
7517
- if (type !== 'Pan' && element1 && element) {
7518
- element1.appendChild(element.children[0]);
7519
- if (!_this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(_this.mapObject.element.id + '_animated_tiles'))) {
7520
- document.getElementById(_this.mapObject.element.id + '_animated_tiles').id =
7521
- _this.mapObject.element.id + '_animated_tiles_old';
7522
- }
7503
+ timeOut = 0;
7504
+ }
7505
+ setTimeout(function () {
7506
+ if (element) {
7507
+ element.style.zIndex = '1';
7508
+ }
7509
+ if (element1) {
7510
+ element1.style.zIndex = '0';
7511
+ }
7512
+ var animateElement;
7513
+ if (!document.getElementById(_this.mapObject.element.id + '_animated_tiles') && element) {
7523
7514
  animateElement = createElement('div', { id: _this.mapObject.element.id + '_animated_tiles' });
7524
7515
  element.appendChild(animateElement);
7525
7516
  }
7526
7517
  else {
7527
- animateElement = element ? element.children[0] : null;
7528
- }
7529
- }
7530
- for (var id = 0; id < _this.tiles.length; id++) {
7531
- var tile = _this.tiles[id];
7532
- var imgElement = null;
7533
- var mapId = _this.mapObject.element.id;
7534
- if (type === 'Pan') {
7535
- var child = document.getElementById(mapId + '_tile_' + id);
7536
- var isNewTile = false;
7537
- if (isNullOrUndefined(child)) {
7538
- isNewTile = true;
7539
- child = createElement('div', { id: mapId + '_tile_' + id });
7540
- imgElement = createElement('img');
7518
+ if (type !== 'Pan' && element1 && element) {
7519
+ element1.appendChild(element.children[0]);
7520
+ if (!_this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(_this.mapObject.element.id + '_animated_tiles'))) {
7521
+ document.getElementById(_this.mapObject.element.id + '_animated_tiles').id =
7522
+ _this.mapObject.element.id + '_animated_tiles_old';
7523
+ }
7524
+ animateElement = createElement('div', { id: _this.mapObject.element.id + '_animated_tiles' });
7525
+ element.appendChild(animateElement);
7541
7526
  }
7542
7527
  else {
7543
- child.style.removeProperty('display');
7544
- imgElement = child.children[0];
7545
- }
7546
- if (!isNewTile && imgElement && imgElement.src !== tile.src) {
7547
- imgElement.src = tile.src;
7528
+ animateElement = element ? element.children[0] : null;
7548
7529
  }
7549
- child.style.position = 'absolute';
7550
- child.style.left = tile.left + 'px';
7551
- child.style.top = tile.top + 'px';
7552
- child.style.height = tile.height + 'px';
7553
- child.style.width = tile.width + 'px';
7554
- if (isNewTile) {
7555
- imgElement.setAttribute('height', '256px');
7556
- imgElement.setAttribute('width', '256px');
7557
- imgElement.setAttribute('src', tile.src);
7558
- imgElement.setAttribute('alt', _this.mapObject.getLocalizedLabel('ImageNotFound'));
7559
- imgElement.style.setProperty('user-select', 'none');
7560
- child.appendChild(imgElement);
7561
- animateElement.appendChild(child);
7530
+ }
7531
+ _this.tileProcess(type, animateElement, isPinch);
7532
+ if (!isNullOrUndefined(_this.mapObject.currentTiles)) {
7533
+ for (var l = _this.tiles.length; l < animateElement.childElementCount; l++) {
7534
+ var isExistingElement = false;
7535
+ for (var a = 0; a < _this.mapObject.currentTiles.childElementCount; a++) {
7536
+ if (!isExistingElement &&
7537
+ _this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7538
+ isExistingElement = true;
7539
+ }
7540
+ }
7541
+ if (isExistingElement) {
7542
+ animateElement.children[l].style.display = 'none';
7543
+ }
7544
+ else {
7545
+ animateElement.removeChild(animateElement.children[l]);
7546
+ }
7562
7547
  }
7563
7548
  }
7564
- else {
7549
+ }, timeOut);
7550
+ }
7551
+ else {
7552
+ var animateElement = document.getElementById(this.mapObject.element.id + '_animates_tiles');
7553
+ if (isNullOrUndefined(animateElement)) {
7554
+ animateElement = createElement('div', { id: this.mapObject.element.id + '_animates_tiles' });
7555
+ }
7556
+ this.tileProcess(type, animateElement, isPinch);
7557
+ element1.appendChild(animateElement);
7558
+ }
7559
+ };
7560
+ LayerPanel.prototype.tileProcess = function (type, animateElement, isPinch) {
7561
+ for (var id = 0; id < this.tiles.length; id++) {
7562
+ var tile = this.tiles[id];
7563
+ var imgElement = null;
7564
+ var mapId = this.mapObject.element.id;
7565
+ if (type === 'Pan') {
7566
+ var child = document.getElementById(mapId + '_tile_' + id);
7567
+ var isNewTile = false;
7568
+ if (isNullOrUndefined(child)) {
7569
+ isNewTile = true;
7570
+ child = createElement('div', { id: mapId + '_tile_' + id });
7565
7571
  imgElement = createElement('img');
7572
+ }
7573
+ else {
7574
+ child.style.removeProperty('display');
7575
+ imgElement = child.children[0];
7576
+ }
7577
+ if (!isNewTile && imgElement && imgElement.src !== tile.src) {
7578
+ imgElement.src = tile.src;
7579
+ }
7580
+ child.style.position = 'absolute';
7581
+ child.style.left = tile.left + 'px';
7582
+ child.style.top = tile.top + 'px';
7583
+ child.style.height = tile.height + 'px';
7584
+ child.style.width = tile.width + 'px';
7585
+ if (isNewTile) {
7566
7586
  imgElement.setAttribute('height', '256px');
7567
7587
  imgElement.setAttribute('width', '256px');
7568
7588
  imgElement.setAttribute('src', tile.src);
7589
+ imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7569
7590
  imgElement.style.setProperty('user-select', 'none');
7570
- imgElement.setAttribute('alt', _this.mapObject.getLocalizedLabel('ImageNotFound'));
7571
- var child = createElement('div', { id: mapId + '_tile_' + id });
7572
- child.style.position = 'absolute';
7573
- child.style.left = tile.left + 'px';
7574
- child.style.top = tile.top + 'px';
7575
- child.style.height = tile.height + 'px';
7576
- child.style.width = tile.width + 'px';
7577
7591
  child.appendChild(imgElement);
7578
- if (animateElement) {
7579
- animateElement.appendChild(child);
7580
- }
7581
- }
7582
- if (id === (_this.tiles.length - 1) && document.getElementById(_this.mapObject.element.id + '_animated_tiles_old')) {
7583
- removeElement(_this.mapObject.element.id + '_animated_tiles_old');
7592
+ animateElement.appendChild(child);
7584
7593
  }
7585
7594
  }
7586
- if (!isNullOrUndefined(_this.mapObject.currentTiles)) {
7587
- for (var l = _this.tiles.length; l < animateElement.childElementCount; l++) {
7588
- var isExistingElement = false;
7589
- for (var a = 0; a < _this.mapObject.currentTiles.childElementCount; a++) {
7590
- if (!isExistingElement &&
7591
- _this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7592
- isExistingElement = true;
7593
- }
7594
- }
7595
- if (isExistingElement) {
7596
- animateElement.children[l].style.display = 'none';
7597
- }
7598
- else {
7599
- animateElement.removeChild(animateElement.children[l]);
7600
- }
7595
+ else {
7596
+ imgElement = createElement('img');
7597
+ imgElement.setAttribute('height', '256px');
7598
+ imgElement.setAttribute('width', '256px');
7599
+ imgElement.setAttribute('src', tile.src);
7600
+ imgElement.style.setProperty('user-select', 'none');
7601
+ imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7602
+ var child = createElement('div', { id: mapId + '_tile_' + id });
7603
+ child.style.position = 'absolute';
7604
+ child.style.left = tile.left + 'px';
7605
+ child.style.top = tile.top + 'px';
7606
+ child.style.height = tile.height + 'px';
7607
+ child.style.width = tile.width + 'px';
7608
+ child.appendChild(imgElement);
7609
+ if (animateElement) {
7610
+ animateElement.appendChild(child);
7601
7611
  }
7602
7612
  }
7603
- }, timeOut);
7613
+ if (!isPinch && id === (this.tiles.length - 1) && document.getElementById(this.mapObject.element.id + '_animated_tiles_old')) {
7614
+ removeElement(this.mapObject.element.id + '_animated_tiles_old');
7615
+ }
7616
+ }
7604
7617
  };
7605
7618
  /**
7606
7619
  * Animation for tile layers and hide the group element until the tile layer rendering.
@@ -9859,6 +9872,20 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
9859
9872
  if (!isNullOrUndefined(this.mapsTooltipModule)) {
9860
9873
  this.mapsTooltipModule.removeEventListener();
9861
9874
  }
9875
+ if (!isNullOrUndefined(this.zoomModule)) {
9876
+ this.zoomModule.removeEventListener();
9877
+ }
9878
+ if (!isNullOrUndefined(this.legendModule)) {
9879
+ this.legendModule.removeEventListener();
9880
+ }
9881
+ if (!isNullOrUndefined(this.selectionModule)) {
9882
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9883
+ this.selectionModule.removeEventListener();
9884
+ }
9885
+ if (!isNullOrUndefined(this.highlightModule)) {
9886
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9887
+ this.highlightModule.removeEventListener();
9888
+ }
9862
9889
  if (!isNullOrUndefined(this.bingMap)) {
9863
9890
  this.bingMap.destroy();
9864
9891
  }
@@ -14583,8 +14610,10 @@ var Legend = /** @__PURE__ @class */ (function () {
14583
14610
  this.defsElement = null;
14584
14611
  this.legendElement = [];
14585
14612
  this.oldShapeElement = null;
14586
- this.removeEventListener();
14587
- this.maps = null;
14613
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14614
+ if (!this.maps.refreshing) {
14615
+ this.maps = null;
14616
+ }
14588
14617
  };
14589
14618
  return Legend;
14590
14619
  }());
@@ -14613,6 +14642,7 @@ var Highlight = /** @__PURE__ @class */ (function () {
14613
14642
  * To unbind events for highlight module.
14614
14643
  *
14615
14644
  * @returns {void}
14645
+ * @private
14616
14646
  */
14617
14647
  Highlight.prototype.removeEventListener = function () {
14618
14648
  if (this.maps.isDestroyed) {
@@ -14851,8 +14881,10 @@ var Highlight = /** @__PURE__ @class */ (function () {
14851
14881
  */
14852
14882
  Highlight.prototype.destroy = function () {
14853
14883
  this.highlightSettings = null;
14854
- this.removeEventListener();
14855
- this.maps = null;
14884
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14885
+ if (!this.maps.refreshing) {
14886
+ this.maps = null;
14887
+ }
14856
14888
  };
14857
14889
  return Highlight;
14858
14890
  }());
@@ -14879,6 +14911,7 @@ var Selection = /** @__PURE__ @class */ (function () {
14879
14911
  * For removing events from selection module.
14880
14912
  *
14881
14913
  * @returns {void}
14914
+ * @private
14882
14915
  */
14883
14916
  Selection.prototype.removeEventListener = function () {
14884
14917
  if (this.maps.isDestroyed) {
@@ -15180,8 +15213,10 @@ var Selection = /** @__PURE__ @class */ (function () {
15180
15213
  */
15181
15214
  Selection.prototype.destroy = function () {
15182
15215
  this.selectionsettings = null;
15183
- this.removeEventListener();
15184
- this.maps = null;
15216
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15217
+ if (!this.maps.refreshing) {
15218
+ this.maps = null;
15219
+ }
15185
15220
  };
15186
15221
  return Selection;
15187
15222
  }());
@@ -15645,22 +15680,20 @@ var MapsTooltip = /** @__PURE__ @class */ (function () {
15645
15680
  * @private
15646
15681
  */
15647
15682
  MapsTooltip.prototype.removeEventListener = function () {
15648
- if (this.maps) {
15649
- if (this.maps.isDestroyed) {
15650
- return;
15651
- }
15652
- if (this.maps.tooltipDisplayMode === 'DoubleClick') {
15653
- this.maps.off('dblclick', this.renderTooltip);
15654
- }
15655
- else if (this.maps.tooltipDisplayMode === 'Click') {
15656
- this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
15657
- }
15658
- else {
15659
- this.maps.off(Browser.touchMoveEvent, this.renderTooltip);
15660
- }
15661
- this.maps.off(Browser.touchCancelEvent, this.removeTooltip);
15662
- this.maps.element.removeEventListener('contextmenu', this.removeTooltip);
15683
+ if (this.maps.isDestroyed) {
15684
+ return;
15685
+ }
15686
+ if (this.maps.tooltipDisplayMode === 'DoubleClick') {
15687
+ this.maps.off('dblclick', this.renderTooltip);
15663
15688
  }
15689
+ else if (this.maps.tooltipDisplayMode === 'Click') {
15690
+ this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
15691
+ }
15692
+ else {
15693
+ this.maps.off(Browser.touchMoveEvent, this.renderTooltip);
15694
+ }
15695
+ this.maps.off(Browser.touchCancelEvent, this.removeTooltip);
15696
+ this.maps.element.removeEventListener('contextmenu', this.removeTooltip);
15664
15697
  };
15665
15698
  /**
15666
15699
  * Get module name.
@@ -15683,7 +15716,9 @@ var MapsTooltip = /** @__PURE__ @class */ (function () {
15683
15716
  removeElement(this.maps.element.id + '_mapsTooltip');
15684
15717
  }
15685
15718
  this.svgTooltip = null;
15686
- this.maps = null;
15719
+ if (!this.maps.refreshing) {
15720
+ this.maps = null;
15721
+ }
15687
15722
  };
15688
15723
  return MapsTooltip;
15689
15724
  }());
@@ -15715,6 +15750,12 @@ var Zoom = /** @__PURE__ @class */ (function () {
15715
15750
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15716
15751
  this.startTouches = [];
15717
15752
  /** @private */
15753
+ this.isCancellation = false;
15754
+ this.pinchTileZoomScale = 1;
15755
+ this.tileZoomLevel = 1;
15756
+ this.pinchZoomScale = 1;
15757
+ this.isPinchZooming = false;
15758
+ /** @private */
15718
15759
  this.mouseDownLatLong = { x: 0, y: 0 };
15719
15760
  /** @private */
15720
15761
  this.mouseMoveLatLong = { x: 0, y: 0 };
@@ -15909,6 +15950,22 @@ var Zoom = /** @__PURE__ @class */ (function () {
15909
15950
  map.tileTranslatePoint.y = (currentLevel === 1) ? ((bounds.height / 2) - ((tileDefaultSize * 2) / 2) + (padding * 2)) :
15910
15951
  position.y - ((y * totalSize) / 100);
15911
15952
  };
15953
+ Zoom.prototype.getTileTranslate = function (currentLevel, type) {
15954
+ var map = this.maps;
15955
+ var padding = type === 'ZoomOut' ? 10 : (type === 'Reset' && currentLevel > 1) ? 0 : 10;
15956
+ var bounds = map.availableSize;
15957
+ var totalSize = Math.pow(2, currentLevel) * 256;
15958
+ var x = (bounds.width / 2) - (totalSize / 2);
15959
+ var y = (bounds.height / 2) - (totalSize / 2);
15960
+ var position = convertTileLatLongToPoint(new MapLocation(this.pinchStartLatLong['longitude'], this.pinchStartLatLong['latitude']), currentLevel, { x: x, y: y }, true);
15961
+ x -= position.x - (bounds.width / 2);
15962
+ y = y - (position.y - (bounds.height / 2)) + padding;
15963
+ var scale = Math.pow(2, currentLevel - 1);
15964
+ map.tileTranslatePoint.x = x;
15965
+ map.tileTranslatePoint.y = y;
15966
+ map.translatePoint.x = (x - (0.01 * this.tileZoomLevel)) / scale;
15967
+ map.translatePoint.y = (y - (0.01 * this.tileZoomLevel)) / scale;
15968
+ };
15912
15969
  /**
15913
15970
  * @returns {void}
15914
15971
  * @private
@@ -15989,6 +16046,11 @@ var Zoom = /** @__PURE__ @class */ (function () {
15989
16046
  this.setInteraction(null);
15990
16047
  }
15991
16048
  };
16049
+ Zoom.prototype.tilePinchingProcess = function (scale) {
16050
+ this.tileZoomLevel = Math.round(scale);
16051
+ this.getTileTranslate(this.tileZoomLevel);
16052
+ this.maps.mapLayerPanel.generateTiles(this.tileZoomLevel, this.maps.tileTranslatePoint, null, null, null, true);
16053
+ };
15992
16054
  /**
15993
16055
  * @param {PointerEvent} e - Specifies the vent in the map
15994
16056
  * @returns {void}
@@ -16048,48 +16110,112 @@ var Zoom = /** @__PURE__ @class */ (function () {
16048
16110
  }
16049
16111
  }
16050
16112
  else {
16051
- var touchCenter = this.getTouchCenterPoint();
16052
- var distance = Math.sqrt(Math.pow((this.touchMoveList[0].pageX - this.touchMoveList[1].pageX), 2) + Math.pow((this.touchMoveList[0].pageY - this.touchMoveList[1].pageY), 2));
16053
- var factor = map.tileZoomLevel;
16113
+ this.isPinchZooming = true;
16114
+ var touchCenter = this.touchCenter;
16115
+ var touchOnePoint = this.getMousePosition(this.touchMoveList[0].pageX, this.touchMoveList[0].pageY);
16116
+ var touchTwoPoint = this.getMousePosition(this.touchMoveList[1].pageX, this.touchMoveList[1].pageY);
16117
+ var distance = Math.sqrt(Math.pow((touchOnePoint.x - touchTwoPoint.x), 2) + Math.pow((touchOnePoint.y - touchTwoPoint.y), 2));
16118
+ var pinchScale = distance / this.startDistance;
16054
16119
  if (!isNullOrUndefined(this.pinchDistance)) {
16120
+ var pinchZoomFactor = Math.log2(pinchScale * (256 * Math.pow(2, prevLevel)) / 256);
16121
+ pinchZoomFactor = Math.min(map.zoomSettings.maxZoom, Math.max(map.zoomSettings.minZoom, pinchZoomFactor));
16122
+ var scaleFactor = this.pinchDistance > distance ? (prevLevel * pinchScale) : pinchZoomFactor;
16123
+ var factor = pinchZoomFactor;
16124
+ var isZoomOut = false;
16055
16125
  if (this.pinchDistance > distance) {
16056
- factor = factor - 1;
16126
+ factor = (scaleFactor % 1);
16127
+ isZoomOut = true;
16057
16128
  }
16058
16129
  else if (this.pinchDistance < distance) {
16059
- factor = factor + 1;
16060
- }
16061
- factor = Math.min(this.maps.zoomSettings.maxZoom, Math.max(this.maps.zoomSettings.minZoom, factor));
16062
- if (factor !== map.tileZoomLevel) {
16063
- this.pinchFactor = factor;
16064
- map.previousScale = map.scale;
16065
- map.tileZoomLevel = this.pinchFactor;
16066
- map.scale = Math.pow(2, map.tileZoomLevel - 1);
16067
- this.getTileTranslatePosition(prevLevel, this.pinchFactor, { x: touchCenter.x, y: touchCenter.y }, null);
16068
- map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.scale)) / map.scale;
16069
- map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.scale)) / map.scale;
16070
- isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
16071
- if (isZoomCancelled) {
16072
- map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
16073
- map.scale = map.previousScale;
16074
- map.tileZoomLevel = prevLevel;
16075
- map.zoomSettings.zoomFactor = map.previousScale;
16130
+ factor = (scaleFactor % 1) + 1;
16131
+ }
16132
+ var zoomFactor = Math.ceil(scaleFactor);
16133
+ if (zoomFactor > map.zoomSettings.minZoom && zoomFactor <= map.zoomSettings.maxZoom) {
16134
+ var element = document.getElementById(map.element.id);
16135
+ if (element) {
16136
+ element.style.overflow = 'hidden';
16076
16137
  }
16077
- else {
16078
- map.mapLayerPanel.generateTiles(factor, map.tileTranslatePoint);
16138
+ this.tileZoomLevel = zoomFactor;
16139
+ var transformOriginX = (touchCenter.x / (map.mapAreaRect.width - map.mapAreaRect.x)) * 100;
16140
+ var transformOriginY = (touchCenter.y / (map.mapAreaRect.height - map.mapAreaRect.y)) * 100;
16141
+ var tilesParent = document.getElementById(map.element.id + '_tile_parent');
16142
+ var copyTilesParent = document.getElementById(map.element.id + '_tiles');
16143
+ if (!copyTilesParent) {
16144
+ copyTilesParent = document.createElement('div');
16145
+ copyTilesParent.id = map.element.id + '_tiles';
16146
+ map.element.appendChild(copyTilesParent);
16147
+ this.copyStyles(tilesParent, copyTilesParent);
16148
+ copyTilesParent.style.zIndex = '0';
16149
+ }
16150
+ copyTilesParent.style.visibility = 'hidden';
16151
+ tilesParent.style.transformOrigin = transformOriginX + "% " + transformOriginY + "%";
16152
+ tilesParent.style.transform = "scale(" + factor + ")";
16153
+ var svgElement = document.getElementById(map.element.id + '_Tile_SVG_Parent');
16154
+ svgElement.style.transformOrigin = transformOriginX + "% " + transformOriginY + "%";
16155
+ svgElement.style.transform = "scale(" + factor + ")";
16156
+ if (!this.isCancellation && (0.2 >= scaleFactor % 1 && scaleFactor % 1 >= 0.1 && !isZoomOut) || (scaleFactor % 1 <= 0.9 && isZoomOut)) {
16157
+ var animateTile = document.getElementById(map.element.id + '_animates_tiles');
16158
+ if (!animateTile) {
16159
+ animateTile = document.createElement('div');
16160
+ animateTile.id = map.element.id + '_animates_tiles';
16161
+ animateTile.classList.add(this.tileZoomLevel.toString());
16162
+ copyTilesParent.appendChild(animateTile);
16163
+ }
16164
+ if (animateTile.childElementCount === 0) {
16165
+ this.pinchZoomScale = isZoomOut ? Math.floor(scaleFactor) : Math.ceil(scaleFactor);
16166
+ this.tilePinchingProcess(this.pinchZoomScale);
16167
+ this.isCancellation = true;
16168
+ }
16169
+ }
16170
+ if (this.isCancellation && (scaleFactor % 1 >= 0.99 && !isZoomOut) || (scaleFactor % 1 <= 0.1 && isZoomOut)) {
16171
+ if (tilesParent.style.transformOrigin !== '' && this.isCancellation) {
16172
+ tilesParent.style.transformOrigin = '';
16173
+ tilesParent.style.transform = '';
16174
+ svgElement.style.transformOrigin = '';
16175
+ svgElement.style.transform = '';
16176
+ this.pinchTileZoomScale = isZoomOut ? Math.floor(scaleFactor) : Math.ceil(scaleFactor);
16177
+ this.getTileTranslate(this.pinchTileZoomScale);
16178
+ var targetElement_1 = document.getElementById(map.element.id + '_animated_tiles');
16179
+ var sourceElement = document.getElementById(map.element.id + '_animates_tiles');
16180
+ while (targetElement_1.firstChild) {
16181
+ targetElement_1.removeChild(targetElement_1.firstChild);
16182
+ }
16183
+ Array.from(sourceElement.children).forEach(function (child) {
16184
+ targetElement_1.appendChild(child.cloneNode(true));
16185
+ });
16186
+ document.getElementById(map.element.id + '_animated_tiles')['className'] = this.pinchTileZoomScale.toFixed(0);
16187
+ if (sourceElement) {
16188
+ while (sourceElement.firstChild) {
16189
+ sourceElement.removeChild(sourceElement.firstChild);
16190
+ }
16191
+ }
16192
+ this.isCancellation = false;
16193
+ map.mapScaleValue = this.pinchTileZoomScale;
16194
+ map.scale = Math.pow(2, this.pinchTileZoomScale - 1);
16195
+ this.applyTransform(map);
16196
+ }
16079
16197
  }
16080
16198
  }
16081
16199
  }
16082
16200
  this.pinchDistance = distance;
16083
16201
  }
16084
- map.mapScaleValue = zoomCalculationFactor;
16085
- if (!isZoomCancelled) {
16086
- this.applyTransform(map);
16202
+ if (!map.isTileMap) {
16203
+ map.mapScaleValue = zoomCalculationFactor;
16204
+ if (!isZoomCancelled) {
16205
+ this.applyTransform(map);
16206
+ }
16207
+ this.triggerZoomComplete(map, prevLevel, '');
16087
16208
  }
16088
- this.triggerZoomComplete(map, prevLevel, '');
16089
16209
  if (Browser.isDevice) {
16090
16210
  this.removeToolbarOpacity(map.isTileMap ? Math.round(map.tileZoomLevel) : map.scale, map.element.id + '_Zooming_');
16091
16211
  }
16092
16212
  };
16213
+ Zoom.prototype.copyStyles = function (sourceElement, targetElement) {
16214
+ var sourceStyles = window.getComputedStyle(sourceElement);
16215
+ Array.from(sourceStyles).forEach(function (style) {
16216
+ targetElement.style[style] = sourceStyles.getPropertyValue(style);
16217
+ });
16218
+ };
16093
16219
  Zoom.prototype.getTouchCenterPoint = function () {
16094
16220
  var touchList = [];
16095
16221
  for (var i = 0; i < this.touchMoveList.length; i++) {
@@ -16153,6 +16279,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
16153
16279
  height: map.availableSize.height,
16154
16280
  style: 'position: absolute;'
16155
16281
  });
16282
+ rectSVGObject.style.position = 'absolute';
16156
16283
  var rectOption = new RectOption(map.element.id + '_ZoomRect', this.maps.themeStyle.rectangleZoomFillColor, border, this.maps.themeStyle.rectangleZoomFillOpacity, this.zoomingRect, 0, 0, '', '3');
16157
16284
  rectSVGObject.appendChild(map.renderer.drawRectangle(rectOption));
16158
16285
  getElementByID(map.element.id + '_Secondary_Element').appendChild(rectSVGObject);
@@ -16230,17 +16357,17 @@ var Zoom = /** @__PURE__ @class */ (function () {
16230
16357
  if (maps.isTileMap && (currentEle.id.indexOf('_line_Group') > -1)) {
16231
16358
  currentEle.remove();
16232
16359
  if (layerElement.children.length > 0 && layerElement.children[0]) {
16233
- layerElement.insertBefore(maps.navigationLineModule.renderNavigation(this_1.currentLayer, maps.tileZoomLevel, this_1.index), layerElement.children[1]);
16360
+ layerElement.insertBefore(maps.navigationLineModule.renderNavigation(this_1.currentLayer, this_1.isPinchZooming ? this_1.pinchZoomScale : maps.tileZoomLevel, this_1.index), layerElement.children[1]);
16234
16361
  }
16235
16362
  else {
16236
- layerElement.appendChild(maps.navigationLineModule.renderNavigation(this_1.currentLayer, maps.tileZoomLevel, this_1.index));
16363
+ layerElement.appendChild(maps.navigationLineModule.renderNavigation(this_1.currentLayer, this_1.isPinchZooming ? this_1.pinchZoomScale : maps.tileZoomLevel, this_1.index));
16237
16364
  }
16238
16365
  }
16239
16366
  else if (maps.isTileMap && (currentEle.id.indexOf('_Polygons_Group') > -1)) {
16240
16367
  if (this_1.currentLayer.polygonSettings.polygons.length > 0) {
16241
16368
  this_1.currentLayer.polygonSettings.polygons.map(function (polygonSettings, polygonIndex) {
16242
16369
  var markerData = polygonSettings.points;
16243
- var path = calculatePolygonPath(maps, maps.tileZoomLevel, _this.currentLayer, markerData);
16370
+ var path = calculatePolygonPath(maps, _this.isPinchZooming ? _this.pinchZoomScale : maps.tileZoomLevel, _this.currentLayer, markerData);
16244
16371
  var element = document.getElementById(maps.element.id + '_LayerIndex_' + _this.index + '_PolygonIndex_' + polygonIndex);
16245
16372
  if (!isNullOrUndefined(element)) {
16246
16373
  element.setAttribute('d', path);
@@ -16470,7 +16597,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
16470
16597
  if (!eventArgs.cancel && markerSettings.visible && !isNullOrUndefined(long) && !isNullOrUndefined(lati)) {
16471
16598
  var markerID = _this.maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_'
16472
16599
  + markerIndex + '_dataIndex_' + dataIndex;
16473
- var location_1 = (_this.maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(long, lati), _this.maps.tileZoomLevel, _this.maps.tileTranslatePoint, true) : convertGeoToPoint(lati, long, factor, currentLayers, _this.maps);
16600
+ var location_1 = (_this.maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(long, lati), _this.isPinchZooming ? _this.pinchZoomScale : _this.maps.tileZoomLevel, _this.maps.tileTranslatePoint, true) : convertGeoToPoint(lati, long, factor, currentLayers, _this.maps);
16474
16601
  var transPoint = { x: x, y: y };
16475
16602
  if (eventArgs.template && (!isNaN(location_1.x) && !isNaN(location_1.y))) {
16476
16603
  markerTemplateCounts++;
@@ -16758,7 +16885,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
16758
16885
  !isNullOrUndefined(marker.dataSource[dataIndex]['latitude']) ? parseFloat(marker.dataSource[dataIndex]['latitude']) :
16759
16886
  !isNullOrUndefined(marker.dataSource[dataIndex]['Latitude']) ? parseFloat(marker.dataSource[dataIndex]['Latitude']) : 0;
16760
16887
  var duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
16761
- var location_2 = (this.maps.isTileMap) ? convertTileLatLongToPoint(new Point(lng, lat), this.maps.tileZoomLevel, this.maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, layer, this.maps);
16888
+ var location_2 = (this.maps.isTileMap) ? convertTileLatLongToPoint(new Point(lng, lat), this.isPinchZooming ? this.pinchZoomScale : this.maps.tileZoomLevel, this.maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, layer, this.maps);
16762
16889
  if (this.maps.isTileMap) {
16763
16890
  if (type === 'Template') {
16764
16891
  element.style.left = (location_2.x + marker.offset.x) + 'px';
@@ -17686,6 +17813,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
17686
17813
  var pageY;
17687
17814
  var target;
17688
17815
  var touches = null;
17816
+ this.isPinchZooming = false;
17689
17817
  //eslint-disable-next-line @typescript-eslint/no-unused-vars
17690
17818
  var element = e.target;
17691
17819
  if (e.type === 'touchstart') {
@@ -17720,6 +17848,16 @@ var Zoom = /** @__PURE__ @class */ (function () {
17720
17848
  this.pinchFactor = this.maps.scale;
17721
17849
  this.fingers = touches.length;
17722
17850
  }
17851
+ if (this.maps.isTileMap && this.isTouch && e['touches'].length > 1) {
17852
+ var startTouch = this.getMousePosition(e['touches'][0].pageX, e['touches'][0].pageY);
17853
+ var endTouch = this.getMousePosition(e['touches'][1].pageX, e['touches'][1].pageY);
17854
+ this.startDistance = Math.sqrt(Math.pow((startTouch.x - endTouch.x), 2) + Math.pow((startTouch.y - endTouch.y), 2));
17855
+ this.touchCenter = { x: (startTouch.x + endTouch.x) / 2, y: (startTouch.y + endTouch.y) / 2 };
17856
+ this.pinchStartLatLong = this.maps.pointToLatLong((startTouch.x + endTouch.x) / 2, (startTouch.y + endTouch.y) / 2);
17857
+ this.isCancellation = false;
17858
+ this.pinchTileZoomScale = this.maps.tileZoomLevel;
17859
+ this.pinchDistance = null;
17860
+ }
17723
17861
  this.isSingleClick = true;
17724
17862
  };
17725
17863
  /**
@@ -17755,7 +17893,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
17755
17893
  }
17756
17894
  }
17757
17895
  if (this.isTouch) {
17758
- if (this.maps.zoomSettings.pinchZooming && touches !== null) {
17896
+ if (this.maps.zoomSettings.enable && this.maps.zoomSettings.pinchZooming && touches !== null) {
17759
17897
  if (this.firstMove && touches.length === 2) {
17760
17898
  this.rectZoomingStart = false;
17761
17899
  this.updateInteraction();
@@ -17763,7 +17901,9 @@ var Zoom = /** @__PURE__ @class */ (function () {
17763
17901
  }
17764
17902
  else if (touches.length === 2 && this.touchStartList.length === 2) {
17765
17903
  this.touchMoveList = targetTouches(e);
17766
- e.preventDefault();
17904
+ if (e.cancelable) {
17905
+ e.preventDefault();
17906
+ }
17767
17907
  this.rectZoomingStart = false;
17768
17908
  this.performPinchZooming(e);
17769
17909
  }
@@ -17771,7 +17911,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
17771
17911
  }
17772
17912
  }
17773
17913
  this.mouseMovePoints = this.getMousePosition(pageX, pageY);
17774
- if (zoom.enable && this.isPanModeEnabled && this.maps.markerDragId.indexOf('_MarkerIndex_') === -1 && ((Browser.isDevice && touches.length >= 1) || !Browser.isDevice)) {
17914
+ if (!this.isPinchZooming && (zoom.enable && this.isPanModeEnabled && this.maps.markerDragId.indexOf('_MarkerIndex_') === -1 && ((Browser.isDevice && touches.length >= 1) || !Browser.isDevice))) {
17775
17915
  e.preventDefault();
17776
17916
  this.maps.element.style.cursor = 'pointer';
17777
17917
  this.mouseMoveLatLong = { x: pageX, y: pageY };
@@ -17783,7 +17923,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
17783
17923
  this.mouseDownLatLong['y'] = pageY;
17784
17924
  }
17785
17925
  }
17786
- if (this.isTouch ? (touches !== null && touches.length === 1 && this.rectZoomingStart) : this.rectZoomingStart) {
17926
+ if (!this.isPinchZooming && (this.isTouch ? (touches !== null && touches.length === 1 && this.rectZoomingStart) : this.rectZoomingStart)) {
17787
17927
  e.preventDefault();
17788
17928
  var scale = this.maps.isTileMap ? Math.round(this.maps.tileZoomLevel) : Math.round(this.maps.mapScaleValue);
17789
17929
  if (this.maps.zoomSettings.enableSelectionZooming && scale < this.maps.zoomSettings.maxZoom) {
@@ -17807,7 +17947,26 @@ var Zoom = /** @__PURE__ @class */ (function () {
17807
17947
  this.touchStartList = [];
17808
17948
  this.touchMoveList = [];
17809
17949
  this.lastScale = 1;
17950
+ this.isCancellation = false;
17810
17951
  this.maps.element.style.cursor = 'auto';
17952
+ if (this.isPinchZooming && this.maps.isTileMap) {
17953
+ this.isPinchZooming = false;
17954
+ var tilesParent = document.getElementById(this.maps.element.id + '_tile_parent');
17955
+ var svgElement = document.getElementById(this.maps.element.id + '_Tile_SVG_Parent');
17956
+ tilesParent.style.transformOrigin = '';
17957
+ tilesParent.style.transform = '';
17958
+ svgElement.style.transformOrigin = '';
17959
+ svgElement.style.transform = '';
17960
+ this.maps.tileZoomLevel = this.maps.mapScaleValue = this.maps.zoomSettings.zoomFactor = this.pinchZoomScale;
17961
+ this.maps.scale = Math.pow(2, this.pinchZoomScale - 1);
17962
+ this.tileZoomLevel = Math.round(this.pinchZoomScale);
17963
+ this.getTileTranslate(this.tileZoomLevel);
17964
+ this.maps.mapLayerPanel.generateTiles(this.tileZoomLevel, this.maps.tileTranslatePoint);
17965
+ this.applyTransform(this.maps);
17966
+ if (document.getElementById(this.maps.element.id + '_animates_tiles')) {
17967
+ document.getElementById(this.maps.element.id + '_animates_tiles').remove();
17968
+ }
17969
+ }
17811
17970
  if (this.isPanModeEnabled && this.maps.zoomSettings.enablePanning && !isNullOrUndefined(this.maps.previousPoint) &&
17812
17971
  (!this.maps.isTileMap ? (this.maps.translatePoint.x !== this.maps.previousPoint.x && this.maps.translatePoint.y !== this.maps.previousPoint.y)
17813
17972
  : this.isPanningInProgress)) {
@@ -18007,10 +18166,13 @@ var Zoom = /** @__PURE__ @class */ (function () {
18007
18166
  this.startTouches = [];
18008
18167
  this.mouseDownLatLong = null;
18009
18168
  this.mouseMoveLatLong = null;
18010
- this.removeEventListener();
18011
18169
  this.layerCollectionEle = null;
18012
18170
  this.currentLayer = null;
18013
18171
  this.pinchDistance = null;
18172
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18173
+ if (!this.maps.refreshing) {
18174
+ this.maps = null;
18175
+ }
18014
18176
  };
18015
18177
  return Zoom;
18016
18178
  }());