@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.
@@ -1279,7 +1279,6 @@ function mergeSeparateCluster(sameMarkerData, maps) {
1279
1279
  const markerIndex = sameMarkerData[0].markerIndex;
1280
1280
  const dataIndex = sameMarkerData[0].dataIndex;
1281
1281
  const markerId = maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_' + markerIndex;
1282
- const marker = maps.layers[layerIndex].markerSettings[markerIndex];
1283
1282
  const clusterId = markerId + '_dataIndex_' + dataIndex + '_cluster_' + clusterIndex;
1284
1283
  const clusterEle = maps.layers[layerIndex].markerClusterSettings.shape === 'Balloon' ? getElement(clusterId + '_Group') : getElement(clusterId);
1285
1284
  const clusterEleLabel = getElement(clusterId + '_datalabel_' + clusterIndex);
@@ -7127,7 +7126,7 @@ class LayerPanel {
7127
7126
  }
7128
7127
  }
7129
7128
  }
7130
- generateTiles(zoomLevel, tileTranslatePoint, zoomType, bing, position) {
7129
+ generateTiles(zoomLevel, tileTranslatePoint, zoomType, bing, position, isPinch) {
7131
7130
  const userLang = this.mapObject.locale;
7132
7131
  const size = this.mapObject.availableSize;
7133
7132
  this.tiles = [];
@@ -7215,121 +7214,134 @@ class LayerPanel {
7215
7214
  }
7216
7215
  if (this.mapObject.previousScale !== this.mapObject.scale || this.mapObject.isReset || this.mapObject.isZoomByPosition
7217
7216
  || this.mapObject.zoomNotApplied) {
7218
- this.arrangeTiles(zoomType, this.animateToZoomX, this.animateToZoomY);
7217
+ this.arrangeTiles(zoomType, this.animateToZoomX, this.animateToZoomY, isPinch);
7219
7218
  }
7220
7219
  }
7221
- arrangeTiles(type, x, y) {
7220
+ arrangeTiles(type, x, y, isPinch = false) {
7222
7221
  const element = document.getElementById(this.mapObject.element.id + '_tile_parent');
7223
7222
  const element1 = document.getElementById(this.mapObject.element.id + '_tiles');
7224
- let timeOut;
7225
- if (!isNullOrUndefined(type) && type !== 'Pan') {
7226
- this.tileAnimation(type, x, y);
7227
- timeOut = animationMode === 'Disable' ? 0 : (this.mapObject.layersCollection[0].animationDuration === 0 &&
7228
- animationMode === 'Enable') ? 1000 : this.mapObject.layersCollection[0].animationDuration;
7229
- }
7230
- else {
7231
- timeOut = 0;
7232
- }
7233
- setTimeout(() => {
7234
- if (element) {
7235
- element.style.zIndex = '1';
7236
- }
7237
- if (element1) {
7238
- element1.style.zIndex = '0';
7239
- }
7240
- let animateElement;
7241
- if (!document.getElementById(this.mapObject.element.id + '_animated_tiles') && element) {
7242
- animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
7243
- element.appendChild(animateElement);
7223
+ if (!isPinch) {
7224
+ let timeOut;
7225
+ if (!isNullOrUndefined(type) && type !== 'Pan') {
7226
+ this.tileAnimation(type, x, y);
7227
+ timeOut = animationMode === 'Disable' ? 0 : (this.mapObject.layersCollection[0].animationDuration === 0 &&
7228
+ animationMode === 'Enable') ? 1000 : this.mapObject.layersCollection[0].animationDuration;
7244
7229
  }
7245
7230
  else {
7246
- if (type !== 'Pan' && element1 && element) {
7247
- element1.appendChild(element.children[0]);
7248
- if (!this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(this.mapObject.element.id + '_animated_tiles'))) {
7249
- document.getElementById(this.mapObject.element.id + '_animated_tiles').id =
7250
- this.mapObject.element.id + '_animated_tiles_old';
7251
- }
7231
+ timeOut = 0;
7232
+ }
7233
+ setTimeout(() => {
7234
+ if (element) {
7235
+ element.style.zIndex = '1';
7236
+ }
7237
+ if (element1) {
7238
+ element1.style.zIndex = '0';
7239
+ }
7240
+ let animateElement;
7241
+ if (!document.getElementById(this.mapObject.element.id + '_animated_tiles') && element) {
7252
7242
  animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
7253
7243
  element.appendChild(animateElement);
7254
7244
  }
7255
7245
  else {
7256
- animateElement = element ? element.children[0] : null;
7257
- }
7258
- }
7259
- for (let id = 0; id < this.tiles.length; id++) {
7260
- const tile = this.tiles[id];
7261
- let imgElement = null;
7262
- const mapId = this.mapObject.element.id;
7263
- if (type === 'Pan') {
7264
- let child = document.getElementById(mapId + '_tile_' + id);
7265
- let isNewTile = false;
7266
- if (isNullOrUndefined(child)) {
7267
- isNewTile = true;
7268
- child = createElement('div', { id: mapId + '_tile_' + id });
7269
- imgElement = createElement('img');
7246
+ if (type !== 'Pan' && element1 && element) {
7247
+ element1.appendChild(element.children[0]);
7248
+ if (!this.mapObject.isAddLayer && !isNullOrUndefined(document.getElementById(this.mapObject.element.id + '_animated_tiles'))) {
7249
+ document.getElementById(this.mapObject.element.id + '_animated_tiles').id =
7250
+ this.mapObject.element.id + '_animated_tiles_old';
7251
+ }
7252
+ animateElement = createElement('div', { id: this.mapObject.element.id + '_animated_tiles' });
7253
+ element.appendChild(animateElement);
7270
7254
  }
7271
7255
  else {
7272
- child.style.removeProperty('display');
7273
- imgElement = child.children[0];
7274
- }
7275
- if (!isNewTile && imgElement && imgElement.src !== tile.src) {
7276
- imgElement.src = tile.src;
7256
+ animateElement = element ? element.children[0] : null;
7277
7257
  }
7278
- child.style.position = 'absolute';
7279
- child.style.left = tile.left + 'px';
7280
- child.style.top = tile.top + 'px';
7281
- child.style.height = tile.height + 'px';
7282
- child.style.width = tile.width + 'px';
7283
- if (isNewTile) {
7284
- imgElement.setAttribute('height', '256px');
7285
- imgElement.setAttribute('width', '256px');
7286
- imgElement.setAttribute('src', tile.src);
7287
- imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7288
- imgElement.style.setProperty('user-select', 'none');
7289
- child.appendChild(imgElement);
7290
- animateElement.appendChild(child);
7258
+ }
7259
+ this.tileProcess(type, animateElement, isPinch);
7260
+ if (!isNullOrUndefined(this.mapObject.currentTiles)) {
7261
+ for (let l = this.tiles.length; l < animateElement.childElementCount; l++) {
7262
+ let isExistingElement = false;
7263
+ for (let a = 0; a < this.mapObject.currentTiles.childElementCount; a++) {
7264
+ if (!isExistingElement &&
7265
+ this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7266
+ isExistingElement = true;
7267
+ }
7268
+ }
7269
+ if (isExistingElement) {
7270
+ animateElement.children[l].style.display = 'none';
7271
+ }
7272
+ else {
7273
+ animateElement.removeChild(animateElement.children[l]);
7274
+ }
7291
7275
  }
7292
7276
  }
7293
- else {
7277
+ }, timeOut);
7278
+ }
7279
+ else {
7280
+ let animateElement = document.getElementById(this.mapObject.element.id + '_animates_tiles');
7281
+ if (isNullOrUndefined(animateElement)) {
7282
+ animateElement = createElement('div', { id: this.mapObject.element.id + '_animates_tiles' });
7283
+ }
7284
+ this.tileProcess(type, animateElement, isPinch);
7285
+ element1.appendChild(animateElement);
7286
+ }
7287
+ }
7288
+ tileProcess(type, animateElement, isPinch) {
7289
+ for (let id = 0; id < this.tiles.length; id++) {
7290
+ const tile = this.tiles[id];
7291
+ let imgElement = null;
7292
+ const mapId = this.mapObject.element.id;
7293
+ if (type === 'Pan') {
7294
+ let child = document.getElementById(mapId + '_tile_' + id);
7295
+ let isNewTile = false;
7296
+ if (isNullOrUndefined(child)) {
7297
+ isNewTile = true;
7298
+ child = createElement('div', { id: mapId + '_tile_' + id });
7294
7299
  imgElement = createElement('img');
7300
+ }
7301
+ else {
7302
+ child.style.removeProperty('display');
7303
+ imgElement = child.children[0];
7304
+ }
7305
+ if (!isNewTile && imgElement && imgElement.src !== tile.src) {
7306
+ imgElement.src = tile.src;
7307
+ }
7308
+ child.style.position = 'absolute';
7309
+ child.style.left = tile.left + 'px';
7310
+ child.style.top = tile.top + 'px';
7311
+ child.style.height = tile.height + 'px';
7312
+ child.style.width = tile.width + 'px';
7313
+ if (isNewTile) {
7295
7314
  imgElement.setAttribute('height', '256px');
7296
7315
  imgElement.setAttribute('width', '256px');
7297
7316
  imgElement.setAttribute('src', tile.src);
7298
- imgElement.style.setProperty('user-select', 'none');
7299
7317
  imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7300
- const child = createElement('div', { id: mapId + '_tile_' + id });
7301
- child.style.position = 'absolute';
7302
- child.style.left = tile.left + 'px';
7303
- child.style.top = tile.top + 'px';
7304
- child.style.height = tile.height + 'px';
7305
- child.style.width = tile.width + 'px';
7318
+ imgElement.style.setProperty('user-select', 'none');
7306
7319
  child.appendChild(imgElement);
7307
- if (animateElement) {
7308
- animateElement.appendChild(child);
7309
- }
7310
- }
7311
- if (id === (this.tiles.length - 1) && document.getElementById(this.mapObject.element.id + '_animated_tiles_old')) {
7312
- removeElement(this.mapObject.element.id + '_animated_tiles_old');
7320
+ animateElement.appendChild(child);
7313
7321
  }
7314
7322
  }
7315
- if (!isNullOrUndefined(this.mapObject.currentTiles)) {
7316
- for (let l = this.tiles.length; l < animateElement.childElementCount; l++) {
7317
- let isExistingElement = false;
7318
- for (let a = 0; a < this.mapObject.currentTiles.childElementCount; a++) {
7319
- if (!isExistingElement &&
7320
- this.mapObject.currentTiles.children[a].id === animateElement.children[l].id) {
7321
- isExistingElement = true;
7322
- }
7323
- }
7324
- if (isExistingElement) {
7325
- animateElement.children[l].style.display = 'none';
7326
- }
7327
- else {
7328
- animateElement.removeChild(animateElement.children[l]);
7329
- }
7323
+ else {
7324
+ imgElement = createElement('img');
7325
+ imgElement.setAttribute('height', '256px');
7326
+ imgElement.setAttribute('width', '256px');
7327
+ imgElement.setAttribute('src', tile.src);
7328
+ imgElement.style.setProperty('user-select', 'none');
7329
+ imgElement.setAttribute('alt', this.mapObject.getLocalizedLabel('ImageNotFound'));
7330
+ const child = createElement('div', { id: mapId + '_tile_' + id });
7331
+ child.style.position = 'absolute';
7332
+ child.style.left = tile.left + 'px';
7333
+ child.style.top = tile.top + 'px';
7334
+ child.style.height = tile.height + 'px';
7335
+ child.style.width = tile.width + 'px';
7336
+ child.appendChild(imgElement);
7337
+ if (animateElement) {
7338
+ animateElement.appendChild(child);
7330
7339
  }
7331
7340
  }
7332
- }, timeOut);
7341
+ if (!isPinch && id === (this.tiles.length - 1) && document.getElementById(this.mapObject.element.id + '_animated_tiles_old')) {
7342
+ removeElement(this.mapObject.element.id + '_animated_tiles_old');
7343
+ }
7344
+ }
7333
7345
  }
7334
7346
  /**
7335
7347
  * Animation for tile layers and hide the group element until the tile layer rendering.
@@ -9550,6 +9562,20 @@ let Maps = class Maps extends Component {
9550
9562
  if (!isNullOrUndefined(this.mapsTooltipModule)) {
9551
9563
  this.mapsTooltipModule.removeEventListener();
9552
9564
  }
9565
+ if (!isNullOrUndefined(this.zoomModule)) {
9566
+ this.zoomModule.removeEventListener();
9567
+ }
9568
+ if (!isNullOrUndefined(this.legendModule)) {
9569
+ this.legendModule.removeEventListener();
9570
+ }
9571
+ if (!isNullOrUndefined(this.selectionModule)) {
9572
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9573
+ this.selectionModule.removeEventListener();
9574
+ }
9575
+ if (!isNullOrUndefined(this.highlightModule)) {
9576
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9577
+ this.highlightModule.removeEventListener();
9578
+ }
9553
9579
  if (!isNullOrUndefined(this.bingMap)) {
9554
9580
  this.bingMap.destroy();
9555
9581
  }
@@ -14226,8 +14252,10 @@ class Legend {
14226
14252
  this.defsElement = null;
14227
14253
  this.legendElement = [];
14228
14254
  this.oldShapeElement = null;
14229
- this.removeEventListener();
14230
- this.maps = null;
14255
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14256
+ if (!this.maps.refreshing) {
14257
+ this.maps = null;
14258
+ }
14231
14259
  }
14232
14260
  }
14233
14261
 
@@ -14255,6 +14283,7 @@ class Highlight {
14255
14283
  * To unbind events for highlight module.
14256
14284
  *
14257
14285
  * @returns {void}
14286
+ * @private
14258
14287
  */
14259
14288
  removeEventListener() {
14260
14289
  if (this.maps.isDestroyed) {
@@ -14492,8 +14521,10 @@ class Highlight {
14492
14521
  */
14493
14522
  destroy() {
14494
14523
  this.highlightSettings = null;
14495
- this.removeEventListener();
14496
- this.maps = null;
14524
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14525
+ if (!this.maps.refreshing) {
14526
+ this.maps = null;
14527
+ }
14497
14528
  }
14498
14529
  }
14499
14530
 
@@ -14519,6 +14550,7 @@ class Selection {
14519
14550
  * For removing events from selection module.
14520
14551
  *
14521
14552
  * @returns {void}
14553
+ * @private
14522
14554
  */
14523
14555
  removeEventListener() {
14524
14556
  if (this.maps.isDestroyed) {
@@ -14819,8 +14851,10 @@ class Selection {
14819
14851
  */
14820
14852
  destroy() {
14821
14853
  this.selectionsettings = null;
14822
- this.removeEventListener();
14823
- this.maps = null;
14854
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14855
+ if (!this.maps.refreshing) {
14856
+ this.maps = null;
14857
+ }
14824
14858
  }
14825
14859
  }
14826
14860
 
@@ -15280,22 +15314,20 @@ class MapsTooltip {
15280
15314
  * @private
15281
15315
  */
15282
15316
  removeEventListener() {
15283
- if (this.maps) {
15284
- if (this.maps.isDestroyed) {
15285
- return;
15286
- }
15287
- if (this.maps.tooltipDisplayMode === 'DoubleClick') {
15288
- this.maps.off('dblclick', this.renderTooltip);
15289
- }
15290
- else if (this.maps.tooltipDisplayMode === 'Click') {
15291
- this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
15292
- }
15293
- else {
15294
- this.maps.off(Browser.touchMoveEvent, this.renderTooltip);
15295
- }
15296
- this.maps.off(Browser.touchCancelEvent, this.removeTooltip);
15297
- this.maps.element.removeEventListener('contextmenu', this.removeTooltip);
15317
+ if (this.maps.isDestroyed) {
15318
+ return;
15319
+ }
15320
+ if (this.maps.tooltipDisplayMode === 'DoubleClick') {
15321
+ this.maps.off('dblclick', this.renderTooltip);
15298
15322
  }
15323
+ else if (this.maps.tooltipDisplayMode === 'Click') {
15324
+ this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
15325
+ }
15326
+ else {
15327
+ this.maps.off(Browser.touchMoveEvent, this.renderTooltip);
15328
+ }
15329
+ this.maps.off(Browser.touchCancelEvent, this.removeTooltip);
15330
+ this.maps.element.removeEventListener('contextmenu', this.removeTooltip);
15299
15331
  }
15300
15332
  /**
15301
15333
  * Get module name.
@@ -15318,7 +15350,9 @@ class MapsTooltip {
15318
15350
  removeElement(this.maps.element.id + '_mapsTooltip');
15319
15351
  }
15320
15352
  this.svgTooltip = null;
15321
- this.maps = null;
15353
+ if (!this.maps.refreshing) {
15354
+ this.maps = null;
15355
+ }
15322
15356
  }
15323
15357
  }
15324
15358
 
@@ -15349,6 +15383,12 @@ class Zoom {
15349
15383
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15350
15384
  this.startTouches = [];
15351
15385
  /** @private */
15386
+ this.isCancellation = false;
15387
+ this.pinchTileZoomScale = 1;
15388
+ this.tileZoomLevel = 1;
15389
+ this.pinchZoomScale = 1;
15390
+ this.isPinchZooming = false;
15391
+ /** @private */
15352
15392
  this.mouseDownLatLong = { x: 0, y: 0 };
15353
15393
  /** @private */
15354
15394
  this.mouseMoveLatLong = { x: 0, y: 0 };
@@ -15541,6 +15581,22 @@ class Zoom {
15541
15581
  map.tileTranslatePoint.y = (currentLevel === 1) ? ((bounds.height / 2) - ((tileDefaultSize * 2) / 2) + (padding * 2)) :
15542
15582
  position.y - ((y * totalSize) / 100);
15543
15583
  }
15584
+ getTileTranslate(currentLevel, type) {
15585
+ const map = this.maps;
15586
+ const padding = type === 'ZoomOut' ? 10 : (type === 'Reset' && currentLevel > 1) ? 0 : 10;
15587
+ const bounds = map.availableSize;
15588
+ const totalSize = Math.pow(2, currentLevel) * 256;
15589
+ let x = (bounds.width / 2) - (totalSize / 2);
15590
+ let y = (bounds.height / 2) - (totalSize / 2);
15591
+ const position = convertTileLatLongToPoint(new MapLocation(this.pinchStartLatLong['longitude'], this.pinchStartLatLong['latitude']), currentLevel, { x: x, y: y }, true);
15592
+ x -= position.x - (bounds.width / 2);
15593
+ y = y - (position.y - (bounds.height / 2)) + padding;
15594
+ const scale = Math.pow(2, currentLevel - 1);
15595
+ map.tileTranslatePoint.x = x;
15596
+ map.tileTranslatePoint.y = y;
15597
+ map.translatePoint.x = (x - (0.01 * this.tileZoomLevel)) / scale;
15598
+ map.translatePoint.y = (y - (0.01 * this.tileZoomLevel)) / scale;
15599
+ }
15544
15600
  /**
15545
15601
  * @returns {void}
15546
15602
  * @private
@@ -15621,6 +15677,11 @@ class Zoom {
15621
15677
  this.setInteraction(null);
15622
15678
  }
15623
15679
  }
15680
+ tilePinchingProcess(scale) {
15681
+ this.tileZoomLevel = Math.round(scale);
15682
+ this.getTileTranslate(this.tileZoomLevel);
15683
+ this.maps.mapLayerPanel.generateTiles(this.tileZoomLevel, this.maps.tileTranslatePoint, null, null, null, true);
15684
+ }
15624
15685
  /**
15625
15686
  * @param {PointerEvent} e - Specifies the vent in the map
15626
15687
  * @returns {void}
@@ -15680,48 +15741,112 @@ class Zoom {
15680
15741
  }
15681
15742
  }
15682
15743
  else {
15683
- const touchCenter = this.getTouchCenterPoint();
15684
- const 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));
15685
- let factor = map.tileZoomLevel;
15744
+ this.isPinchZooming = true;
15745
+ const touchCenter = this.touchCenter;
15746
+ const touchOnePoint = this.getMousePosition(this.touchMoveList[0].pageX, this.touchMoveList[0].pageY);
15747
+ const touchTwoPoint = this.getMousePosition(this.touchMoveList[1].pageX, this.touchMoveList[1].pageY);
15748
+ const distance = Math.sqrt(Math.pow((touchOnePoint.x - touchTwoPoint.x), 2) + Math.pow((touchOnePoint.y - touchTwoPoint.y), 2));
15749
+ const pinchScale = distance / this.startDistance;
15686
15750
  if (!isNullOrUndefined(this.pinchDistance)) {
15751
+ let pinchZoomFactor = Math.log2(pinchScale * (256 * Math.pow(2, prevLevel)) / 256);
15752
+ pinchZoomFactor = Math.min(map.zoomSettings.maxZoom, Math.max(map.zoomSettings.minZoom, pinchZoomFactor));
15753
+ const scaleFactor = this.pinchDistance > distance ? (prevLevel * pinchScale) : pinchZoomFactor;
15754
+ let factor = pinchZoomFactor;
15755
+ let isZoomOut = false;
15687
15756
  if (this.pinchDistance > distance) {
15688
- factor = factor - 1;
15757
+ factor = (scaleFactor % 1);
15758
+ isZoomOut = true;
15689
15759
  }
15690
15760
  else if (this.pinchDistance < distance) {
15691
- factor = factor + 1;
15692
- }
15693
- factor = Math.min(this.maps.zoomSettings.maxZoom, Math.max(this.maps.zoomSettings.minZoom, factor));
15694
- if (factor !== map.tileZoomLevel) {
15695
- this.pinchFactor = factor;
15696
- map.previousScale = map.scale;
15697
- map.tileZoomLevel = this.pinchFactor;
15698
- map.scale = Math.pow(2, map.tileZoomLevel - 1);
15699
- this.getTileTranslatePosition(prevLevel, this.pinchFactor, { x: touchCenter.x, y: touchCenter.y }, null);
15700
- map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.scale)) / map.scale;
15701
- map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.scale)) / map.scale;
15702
- isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
15703
- if (isZoomCancelled) {
15704
- map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
15705
- map.scale = map.previousScale;
15706
- map.tileZoomLevel = prevLevel;
15707
- map.zoomSettings.zoomFactor = map.previousScale;
15761
+ factor = (scaleFactor % 1) + 1;
15762
+ }
15763
+ const zoomFactor = Math.ceil(scaleFactor);
15764
+ if (zoomFactor > map.zoomSettings.minZoom && zoomFactor <= map.zoomSettings.maxZoom) {
15765
+ const element = document.getElementById(map.element.id);
15766
+ if (element) {
15767
+ element.style.overflow = 'hidden';
15708
15768
  }
15709
- else {
15710
- map.mapLayerPanel.generateTiles(factor, map.tileTranslatePoint);
15769
+ this.tileZoomLevel = zoomFactor;
15770
+ const transformOriginX = (touchCenter.x / (map.mapAreaRect.width - map.mapAreaRect.x)) * 100;
15771
+ const transformOriginY = (touchCenter.y / (map.mapAreaRect.height - map.mapAreaRect.y)) * 100;
15772
+ const tilesParent = document.getElementById(map.element.id + '_tile_parent');
15773
+ let copyTilesParent = document.getElementById(map.element.id + '_tiles');
15774
+ if (!copyTilesParent) {
15775
+ copyTilesParent = document.createElement('div');
15776
+ copyTilesParent.id = map.element.id + '_tiles';
15777
+ map.element.appendChild(copyTilesParent);
15778
+ this.copyStyles(tilesParent, copyTilesParent);
15779
+ copyTilesParent.style.zIndex = '0';
15780
+ }
15781
+ copyTilesParent.style.visibility = 'hidden';
15782
+ tilesParent.style.transformOrigin = `${transformOriginX}% ${transformOriginY}%`;
15783
+ tilesParent.style.transform = `scale(${factor})`;
15784
+ const svgElement = document.getElementById(map.element.id + '_Tile_SVG_Parent');
15785
+ svgElement.style.transformOrigin = `${transformOriginX}% ${transformOriginY}%`;
15786
+ svgElement.style.transform = `scale(${factor})`;
15787
+ if (!this.isCancellation && (0.2 >= scaleFactor % 1 && scaleFactor % 1 >= 0.1 && !isZoomOut) || (scaleFactor % 1 <= 0.9 && isZoomOut)) {
15788
+ let animateTile = document.getElementById(map.element.id + '_animates_tiles');
15789
+ if (!animateTile) {
15790
+ animateTile = document.createElement('div');
15791
+ animateTile.id = map.element.id + '_animates_tiles';
15792
+ animateTile.classList.add(this.tileZoomLevel.toString());
15793
+ copyTilesParent.appendChild(animateTile);
15794
+ }
15795
+ if (animateTile.childElementCount === 0) {
15796
+ this.pinchZoomScale = isZoomOut ? Math.floor(scaleFactor) : Math.ceil(scaleFactor);
15797
+ this.tilePinchingProcess(this.pinchZoomScale);
15798
+ this.isCancellation = true;
15799
+ }
15800
+ }
15801
+ if (this.isCancellation && (scaleFactor % 1 >= 0.99 && !isZoomOut) || (scaleFactor % 1 <= 0.1 && isZoomOut)) {
15802
+ if (tilesParent.style.transformOrigin !== '' && this.isCancellation) {
15803
+ tilesParent.style.transformOrigin = '';
15804
+ tilesParent.style.transform = '';
15805
+ svgElement.style.transformOrigin = '';
15806
+ svgElement.style.transform = '';
15807
+ this.pinchTileZoomScale = isZoomOut ? Math.floor(scaleFactor) : Math.ceil(scaleFactor);
15808
+ this.getTileTranslate(this.pinchTileZoomScale);
15809
+ const targetElement = document.getElementById(map.element.id + '_animated_tiles');
15810
+ const sourceElement = document.getElementById(map.element.id + '_animates_tiles');
15811
+ while (targetElement.firstChild) {
15812
+ targetElement.removeChild(targetElement.firstChild);
15813
+ }
15814
+ Array.from(sourceElement.children).forEach((child) => {
15815
+ targetElement.appendChild(child.cloneNode(true));
15816
+ });
15817
+ document.getElementById(map.element.id + '_animated_tiles')['className'] = this.pinchTileZoomScale.toFixed(0);
15818
+ if (sourceElement) {
15819
+ while (sourceElement.firstChild) {
15820
+ sourceElement.removeChild(sourceElement.firstChild);
15821
+ }
15822
+ }
15823
+ this.isCancellation = false;
15824
+ map.mapScaleValue = this.pinchTileZoomScale;
15825
+ map.scale = Math.pow(2, this.pinchTileZoomScale - 1);
15826
+ this.applyTransform(map);
15827
+ }
15711
15828
  }
15712
15829
  }
15713
15830
  }
15714
15831
  this.pinchDistance = distance;
15715
15832
  }
15716
- map.mapScaleValue = zoomCalculationFactor;
15717
- if (!isZoomCancelled) {
15718
- this.applyTransform(map);
15833
+ if (!map.isTileMap) {
15834
+ map.mapScaleValue = zoomCalculationFactor;
15835
+ if (!isZoomCancelled) {
15836
+ this.applyTransform(map);
15837
+ }
15838
+ this.triggerZoomComplete(map, prevLevel, '');
15719
15839
  }
15720
- this.triggerZoomComplete(map, prevLevel, '');
15721
15840
  if (Browser.isDevice) {
15722
15841
  this.removeToolbarOpacity(map.isTileMap ? Math.round(map.tileZoomLevel) : map.scale, map.element.id + '_Zooming_');
15723
15842
  }
15724
15843
  }
15844
+ copyStyles(sourceElement, targetElement) {
15845
+ const sourceStyles = window.getComputedStyle(sourceElement);
15846
+ Array.from(sourceStyles).forEach((style) => {
15847
+ targetElement.style[style] = sourceStyles.getPropertyValue(style);
15848
+ });
15849
+ }
15725
15850
  getTouchCenterPoint() {
15726
15851
  const touchList = [];
15727
15852
  for (let i = 0; i < this.touchMoveList.length; i++) {
@@ -15785,6 +15910,7 @@ class Zoom {
15785
15910
  height: map.availableSize.height,
15786
15911
  style: 'position: absolute;'
15787
15912
  });
15913
+ rectSVGObject.style.position = 'absolute';
15788
15914
  const rectOption = new RectOption(map.element.id + '_ZoomRect', this.maps.themeStyle.rectangleZoomFillColor, border, this.maps.themeStyle.rectangleZoomFillOpacity, this.zoomingRect, 0, 0, '', '3');
15789
15915
  rectSVGObject.appendChild(map.renderer.drawRectangle(rectOption));
15790
15916
  getElementByID(map.element.id + '_Secondary_Element').appendChild(rectSVGObject);
@@ -15861,17 +15987,17 @@ class Zoom {
15861
15987
  if (maps.isTileMap && (currentEle.id.indexOf('_line_Group') > -1)) {
15862
15988
  currentEle.remove();
15863
15989
  if (layerElement.children.length > 0 && layerElement.children[0]) {
15864
- layerElement.insertBefore(maps.navigationLineModule.renderNavigation(this.currentLayer, maps.tileZoomLevel, this.index), layerElement.children[1]);
15990
+ layerElement.insertBefore(maps.navigationLineModule.renderNavigation(this.currentLayer, this.isPinchZooming ? this.pinchZoomScale : maps.tileZoomLevel, this.index), layerElement.children[1]);
15865
15991
  }
15866
15992
  else {
15867
- layerElement.appendChild(maps.navigationLineModule.renderNavigation(this.currentLayer, maps.tileZoomLevel, this.index));
15993
+ layerElement.appendChild(maps.navigationLineModule.renderNavigation(this.currentLayer, this.isPinchZooming ? this.pinchZoomScale : maps.tileZoomLevel, this.index));
15868
15994
  }
15869
15995
  }
15870
15996
  else if (maps.isTileMap && (currentEle.id.indexOf('_Polygons_Group') > -1)) {
15871
15997
  if (this.currentLayer.polygonSettings.polygons.length > 0) {
15872
15998
  this.currentLayer.polygonSettings.polygons.map((polygonSettings, polygonIndex) => {
15873
15999
  const markerData = polygonSettings.points;
15874
- const path = calculatePolygonPath(maps, maps.tileZoomLevel, this.currentLayer, markerData);
16000
+ const path = calculatePolygonPath(maps, this.isPinchZooming ? this.pinchZoomScale : maps.tileZoomLevel, this.currentLayer, markerData);
15875
16001
  const element = document.getElementById(maps.element.id + '_LayerIndex_' + this.index + '_PolygonIndex_' + polygonIndex);
15876
16002
  if (!isNullOrUndefined(element)) {
15877
16003
  element.setAttribute('d', path);
@@ -16093,7 +16219,7 @@ class Zoom {
16093
16219
  if (!eventArgs.cancel && markerSettings.visible && !isNullOrUndefined(long) && !isNullOrUndefined(lati)) {
16094
16220
  const markerID = this.maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_'
16095
16221
  + markerIndex + '_dataIndex_' + dataIndex;
16096
- const location = (this.maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(long, lati), this.maps.tileZoomLevel, this.maps.tileTranslatePoint, true) : convertGeoToPoint(lati, long, factor, currentLayers, this.maps);
16222
+ const location = (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);
16097
16223
  const transPoint = { x: x, y: y };
16098
16224
  if (eventArgs.template && (!isNaN(location.x) && !isNaN(location.y))) {
16099
16225
  markerTemplateCounts++;
@@ -16379,7 +16505,7 @@ class Zoom {
16379
16505
  !isNullOrUndefined(marker.dataSource[dataIndex]['latitude']) ? parseFloat(marker.dataSource[dataIndex]['latitude']) :
16380
16506
  !isNullOrUndefined(marker.dataSource[dataIndex]['Latitude']) ? parseFloat(marker.dataSource[dataIndex]['Latitude']) : 0;
16381
16507
  const duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
16382
- const location = (this.maps.isTileMap) ? convertTileLatLongToPoint(new Point(lng, lat), this.maps.tileZoomLevel, this.maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, layer, this.maps);
16508
+ const location = (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);
16383
16509
  if (this.maps.isTileMap) {
16384
16510
  if (type === 'Template') {
16385
16511
  element.style.left = (location.x + marker.offset.x) + 'px';
@@ -17306,6 +17432,7 @@ class Zoom {
17306
17432
  let pageY;
17307
17433
  let target;
17308
17434
  let touches = null;
17435
+ this.isPinchZooming = false;
17309
17436
  //eslint-disable-next-line @typescript-eslint/no-unused-vars
17310
17437
  const element = e.target;
17311
17438
  if (e.type === 'touchstart') {
@@ -17340,6 +17467,16 @@ class Zoom {
17340
17467
  this.pinchFactor = this.maps.scale;
17341
17468
  this.fingers = touches.length;
17342
17469
  }
17470
+ if (this.maps.isTileMap && this.isTouch && e['touches'].length > 1) {
17471
+ const startTouch = this.getMousePosition(e['touches'][0].pageX, e['touches'][0].pageY);
17472
+ const endTouch = this.getMousePosition(e['touches'][1].pageX, e['touches'][1].pageY);
17473
+ this.startDistance = Math.sqrt(Math.pow((startTouch.x - endTouch.x), 2) + Math.pow((startTouch.y - endTouch.y), 2));
17474
+ this.touchCenter = { x: (startTouch.x + endTouch.x) / 2, y: (startTouch.y + endTouch.y) / 2 };
17475
+ this.pinchStartLatLong = this.maps.pointToLatLong((startTouch.x + endTouch.x) / 2, (startTouch.y + endTouch.y) / 2);
17476
+ this.isCancellation = false;
17477
+ this.pinchTileZoomScale = this.maps.tileZoomLevel;
17478
+ this.pinchDistance = null;
17479
+ }
17343
17480
  this.isSingleClick = true;
17344
17481
  }
17345
17482
  /**
@@ -17375,7 +17512,7 @@ class Zoom {
17375
17512
  }
17376
17513
  }
17377
17514
  if (this.isTouch) {
17378
- if (this.maps.zoomSettings.pinchZooming && touches !== null) {
17515
+ if (this.maps.zoomSettings.enable && this.maps.zoomSettings.pinchZooming && touches !== null) {
17379
17516
  if (this.firstMove && touches.length === 2) {
17380
17517
  this.rectZoomingStart = false;
17381
17518
  this.updateInteraction();
@@ -17383,7 +17520,9 @@ class Zoom {
17383
17520
  }
17384
17521
  else if (touches.length === 2 && this.touchStartList.length === 2) {
17385
17522
  this.touchMoveList = targetTouches(e);
17386
- e.preventDefault();
17523
+ if (e.cancelable) {
17524
+ e.preventDefault();
17525
+ }
17387
17526
  this.rectZoomingStart = false;
17388
17527
  this.performPinchZooming(e);
17389
17528
  }
@@ -17391,7 +17530,7 @@ class Zoom {
17391
17530
  }
17392
17531
  }
17393
17532
  this.mouseMovePoints = this.getMousePosition(pageX, pageY);
17394
- if (zoom.enable && this.isPanModeEnabled && this.maps.markerDragId.indexOf('_MarkerIndex_') === -1 && ((Browser.isDevice && touches.length >= 1) || !Browser.isDevice)) {
17533
+ if (!this.isPinchZooming && (zoom.enable && this.isPanModeEnabled && this.maps.markerDragId.indexOf('_MarkerIndex_') === -1 && ((Browser.isDevice && touches.length >= 1) || !Browser.isDevice))) {
17395
17534
  e.preventDefault();
17396
17535
  this.maps.element.style.cursor = 'pointer';
17397
17536
  this.mouseMoveLatLong = { x: pageX, y: pageY };
@@ -17403,7 +17542,7 @@ class Zoom {
17403
17542
  this.mouseDownLatLong['y'] = pageY;
17404
17543
  }
17405
17544
  }
17406
- if (this.isTouch ? (touches !== null && touches.length === 1 && this.rectZoomingStart) : this.rectZoomingStart) {
17545
+ if (!this.isPinchZooming && (this.isTouch ? (touches !== null && touches.length === 1 && this.rectZoomingStart) : this.rectZoomingStart)) {
17407
17546
  e.preventDefault();
17408
17547
  const scale = this.maps.isTileMap ? Math.round(this.maps.tileZoomLevel) : Math.round(this.maps.mapScaleValue);
17409
17548
  if (this.maps.zoomSettings.enableSelectionZooming && scale < this.maps.zoomSettings.maxZoom) {
@@ -17427,7 +17566,26 @@ class Zoom {
17427
17566
  this.touchStartList = [];
17428
17567
  this.touchMoveList = [];
17429
17568
  this.lastScale = 1;
17569
+ this.isCancellation = false;
17430
17570
  this.maps.element.style.cursor = 'auto';
17571
+ if (this.isPinchZooming && this.maps.isTileMap) {
17572
+ this.isPinchZooming = false;
17573
+ const tilesParent = document.getElementById(this.maps.element.id + '_tile_parent');
17574
+ const svgElement = document.getElementById(this.maps.element.id + '_Tile_SVG_Parent');
17575
+ tilesParent.style.transformOrigin = '';
17576
+ tilesParent.style.transform = '';
17577
+ svgElement.style.transformOrigin = '';
17578
+ svgElement.style.transform = '';
17579
+ this.maps.tileZoomLevel = this.maps.mapScaleValue = this.maps.zoomSettings.zoomFactor = this.pinchZoomScale;
17580
+ this.maps.scale = Math.pow(2, this.pinchZoomScale - 1);
17581
+ this.tileZoomLevel = Math.round(this.pinchZoomScale);
17582
+ this.getTileTranslate(this.tileZoomLevel);
17583
+ this.maps.mapLayerPanel.generateTiles(this.tileZoomLevel, this.maps.tileTranslatePoint);
17584
+ this.applyTransform(this.maps);
17585
+ if (document.getElementById(this.maps.element.id + '_animates_tiles')) {
17586
+ document.getElementById(this.maps.element.id + '_animates_tiles').remove();
17587
+ }
17588
+ }
17431
17589
  if (this.isPanModeEnabled && this.maps.zoomSettings.enablePanning && !isNullOrUndefined(this.maps.previousPoint) &&
17432
17590
  (!this.maps.isTileMap ? (this.maps.translatePoint.x !== this.maps.previousPoint.x && this.maps.translatePoint.y !== this.maps.previousPoint.y)
17433
17591
  : this.isPanningInProgress)) {
@@ -17627,10 +17785,13 @@ class Zoom {
17627
17785
  this.startTouches = [];
17628
17786
  this.mouseDownLatLong = null;
17629
17787
  this.mouseMoveLatLong = null;
17630
- this.removeEventListener();
17631
17788
  this.layerCollectionEle = null;
17632
17789
  this.currentLayer = null;
17633
17790
  this.pinchDistance = null;
17791
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17792
+ if (!this.maps.refreshing) {
17793
+ this.maps = null;
17794
+ }
17634
17795
  }
17635
17796
  }
17636
17797