@syncfusion/ej2-maps 24.2.9 → 25.1.37

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 (40) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/dist/ej2-maps.min.js +2 -2
  3. package/dist/ej2-maps.umd.min.js +2 -2
  4. package/dist/ej2-maps.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-maps.es2015.js +650 -333
  6. package/dist/es6/ej2-maps.es2015.js.map +1 -1
  7. package/dist/es6/ej2-maps.es5.js +664 -348
  8. package/dist/es6/ej2-maps.es5.js.map +1 -1
  9. package/dist/global/ej2-maps.min.js +2 -2
  10. package/dist/global/ej2-maps.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +13 -13
  13. package/src/maps/layers/bubble.js +2 -3
  14. package/src/maps/layers/color-mapping.d.ts +0 -1
  15. package/src/maps/layers/color-mapping.js +0 -1
  16. package/src/maps/layers/data-label.js +19 -17
  17. package/src/maps/layers/layer-panel.js +13 -7
  18. package/src/maps/layers/legend.js +11 -3
  19. package/src/maps/layers/marker.d.ts +4 -0
  20. package/src/maps/layers/marker.js +16 -13
  21. package/src/maps/layers/polygon.d.ts +0 -1
  22. package/src/maps/layers/polygon.js +1 -4
  23. package/src/maps/maps-model.d.ts +14 -0
  24. package/src/maps/maps.d.ts +14 -2
  25. package/src/maps/maps.js +118 -46
  26. package/src/maps/model/base-model.d.ts +51 -0
  27. package/src/maps/model/base.d.ts +43 -1
  28. package/src/maps/model/base.js +32 -0
  29. package/src/maps/model/constants.d.ts +12 -0
  30. package/src/maps/model/constants.js +12 -0
  31. package/src/maps/model/interface.d.ts +8 -0
  32. package/src/maps/user-interaction/tooltip.js +151 -110
  33. package/src/maps/user-interaction/zoom.d.ts +3 -5
  34. package/src/maps/user-interaction/zoom.js +202 -108
  35. package/src/maps/utils/helper.d.ts +7 -1
  36. package/src/maps/utils/helper.js +89 -37
  37. package/.eslintrc.json +0 -260
  38. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -72
  39. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -49
  40. package/tslint.json +0 -111
@@ -1,4 +1,4 @@
1
- import { Point, getElementByID, PathOption, Rect, convertGeoToPoint, CircleOption, convertTileLatLongToPoint } from '../utils/helper';
1
+ import { Point, getElementByID, PathOption, Rect, convertGeoToPoint, CircleOption, convertTileLatLongToPoint, measureTextElement } from '../utils/helper';
2
2
  import { RectOption, createTooltip, calculateScale, getTouchCenter, getTouches, targetTouches } from '../utils/helper';
3
3
  import { MapLocation, zoomAnimate, smoothTranslate, measureText, textTrim, clusterTemplate, marker } from '../utils/helper';
4
4
  import { markerTemplate, removeElement, getElement, clusterSeparate, markerColorChoose, calculatePolygonPath } from '../utils/helper';
@@ -13,7 +13,7 @@ import { getValueFromObject } from '../utils/helper';
13
13
  var Zoom = /** @class */ (function () {
14
14
  function Zoom(maps) {
15
15
  /** @private */
16
- this.isPanning = false;
16
+ this.isPanModeEnabled = false;
17
17
  /** @private */
18
18
  this.mouseEnter = false;
19
19
  /** @private */
@@ -34,9 +34,6 @@ var Zoom = /** @class */ (function () {
34
34
  this.startTouches = [];
35
35
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
36
  /** @private */
37
- this.intersect = [];
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- /** @private */
40
37
  this.mouseDownLatLong = { x: 0, y: 0 };
41
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
39
  /** @private */
@@ -173,6 +170,7 @@ var Zoom = /** @class */ (function () {
173
170
  }, animationDuration);
174
171
  }
175
172
  }
173
+ this.triggerZoomComplete(map, prevLevel, type);
176
174
  }
177
175
  this.maps.zoomNotApplied = false;
178
176
  if (this.maps.isDevice) {
@@ -261,12 +259,12 @@ var Zoom = /** @class */ (function () {
261
259
  map.translatePoint = new Point(translatePointX, translatePointY);
262
260
  }
263
261
  map.scale = zoomCalculationFactor < this.maps.zoomSettings.maxZoom ? zoomCalculationFactor : this.maps.zoomSettings.maxZoom;
264
- map.zoomTranslatePoint = map.translatePoint;
265
262
  isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
266
263
  if (isZoomCancelled) {
267
264
  map.translatePoint = map.previousPoint;
268
265
  map.scale = map.previousScale;
269
266
  }
267
+ map.zoomTranslatePoint = map.translatePoint;
270
268
  }
271
269
  else {
272
270
  zoomCalculationFactor = prevLevel + (Math.round(prevLevel + (((size.width / zoomRect.width) + (size.height / zoomRect.height)) / 2)));
@@ -296,6 +294,7 @@ var Zoom = /** @class */ (function () {
296
294
  }
297
295
  }
298
296
  this.isZoomFinal = this.isZoomSelection && Math.round(map.scale) === this.maps.zoomSettings.maxZoom;
297
+ this.triggerZoomComplete(map, prevLevel, '');
299
298
  this.removeToolbarOpacity(map.scale, this.maps.element.id + '_Zooming_');
300
299
  };
301
300
  Zoom.prototype.setInteraction = function (newInteraction) {
@@ -389,10 +388,41 @@ var Zoom = /** @class */ (function () {
389
388
  if (!isZoomCancelled) {
390
389
  this.applyTransform(map);
391
390
  }
391
+ this.triggerZoomComplete(map, prevLevel, '');
392
392
  if (Browser.isDevice) {
393
393
  this.removeToolbarOpacity(map.isTileMap ? Math.round(map.tileZoomLevel) : map.scale, map.element.id + '_Zooming_');
394
394
  }
395
395
  };
396
+ Zoom.prototype.triggerZoomComplete = function (map, prevLevel, type) {
397
+ if (map.zoomSettings.enable) {
398
+ var zoomArgs = void 0;
399
+ if (map.isTileMap) {
400
+ map.mapScaleValue = isNullOrUndefined(map.mapScaleValue) ? 1 : map.mapScaleValue;
401
+ map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.mapScaleValue)) / map.scale;
402
+ map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.mapScaleValue)) / map.scale;
403
+ }
404
+ var minMaxLatitudeLongitude = this.maps.getMinMaxLatitudeLongitude();
405
+ if (!map.isTileMap) {
406
+ zoomArgs = {
407
+ cancel: false, name: 'zoomComplete', type: type, maps: map,
408
+ tileTranslatePoint: {}, translatePoint: { previous: map.previousPoint, current: map.translatePoint },
409
+ tileZoomLevel: {}, scale: { previous: map.previousScale, current: map.scale },
410
+ minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
411
+ minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
412
+ };
413
+ }
414
+ else {
415
+ zoomArgs = {
416
+ cancel: false, name: 'zoomComplete', type: type, maps: map,
417
+ tileTranslatePoint: { previous: map.tileTranslatePoint, current: map.tileTranslatePoint }, translatePoint: { previous: map.previousPoint, current: map.translatePoint },
418
+ tileZoomLevel: { previous: prevLevel, current: map.tileZoomLevel }, scale: { previous: map.previousScale, current: map.scale },
419
+ minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
420
+ minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
421
+ };
422
+ }
423
+ this.maps.trigger('zoomComplete', zoomArgs);
424
+ }
425
+ };
396
426
  /**
397
427
  * @private
398
428
  */
@@ -446,7 +476,7 @@ var Zoom = /** @class */ (function () {
446
476
  /**
447
477
  * @private
448
478
  */
449
- Zoom.prototype.applyTransform = function (maps, animate) {
479
+ Zoom.prototype.applyTransform = function (maps, animate, isPanning) {
450
480
  var _this = this;
451
481
  var layerIndex;
452
482
  this.templateCount = 0;
@@ -458,6 +488,7 @@ var Zoom = /** @class */ (function () {
458
488
  var scale = maps.scale;
459
489
  var x = maps.translatePoint.x;
460
490
  var y = maps.translatePoint.y;
491
+ var currentLabelIndex = 0;
461
492
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
462
493
  var collection = [];
463
494
  maps.zoomShapeCollection = [];
@@ -504,7 +535,7 @@ var Zoom = /** @class */ (function () {
504
535
  }
505
536
  }
506
537
  else if (currentEle.id.indexOf('_Markers_Group') > -1) {
507
- if ((!this_1.isPanning) && !isNullOrUndefined(currentEle.childNodes[0])) {
538
+ if ((!this_1.isPanModeEnabled) && !isNullOrUndefined(currentEle.childNodes[0])) {
508
539
  this_1.markerTranslates(currentEle.childNodes[0], factor_1, x, y, scale, 'Marker', layerElement, animate);
509
540
  }
510
541
  currentEle = layerElement.childNodes[j];
@@ -528,7 +559,7 @@ var Zoom = /** @class */ (function () {
528
559
  }
529
560
  }
530
561
  }
531
- if (((_this.currentLayer.animationDuration > 0 || animationMode === 'Enable') || ((maps.layersCollection[0].animationDuration > 0 || animationMode === 'Enable') && _this.currentLayer.type === 'SubLayer')) && !_this.isPanning) {
562
+ if (((_this.currentLayer.animationDuration > 0 || animationMode === 'Enable') || ((maps.layersCollection[0].animationDuration > 0 || animationMode === 'Enable') && _this.currentLayer.type === 'SubLayer')) && !_this.isPanModeEnabled) {
532
563
  if (maps.isTileMap) {
533
564
  var groupElement = document.querySelector('.GroupElement');
534
565
  if (groupElement && !(document.querySelector('.ClusterGroupElement')) && markerAnimation_1) {
@@ -541,7 +572,7 @@ var Zoom = /** @class */ (function () {
541
572
  }
542
573
  }
543
574
  });
544
- if (this_1.isPanning && maps.markerModule.sameMarkerData.length > 0) {
575
+ if (this_1.isPanModeEnabled && maps.markerModule.sameMarkerData.length > 0) {
545
576
  clusterSeparate(maps.markerModule.sameMarkerData, maps, currentEle, true);
546
577
  }
547
578
  else if (maps.markerModule.sameMarkerData.length > 0) {
@@ -551,7 +582,7 @@ var Zoom = /** @class */ (function () {
551
582
  }
552
583
  }
553
584
  if (document.getElementById(maps.element.id + '_mapsTooltip') && maps.mapsTooltipModule.tooltipTargetID.indexOf('_MarkerIndex_')
554
- && !this_1.isPanning) {
585
+ && !this_1.isPanModeEnabled) {
555
586
  var mapsTooltip = maps.mapsTooltipModule;
556
587
  var tooltipElement = currentEle.querySelector('#' + mapsTooltip.tooltipTargetID);
557
588
  if (!isNullOrUndefined(tooltipElement)) {
@@ -602,24 +633,25 @@ var Zoom = /** @class */ (function () {
602
633
  }
603
634
  }
604
635
  else if (currentEle.id.indexOf('_dataLableIndex_Group') > -1 && !isNullOrUndefined(maps.layers[this_1.index])) {
605
- this_1.intersect = [];
606
636
  maps.zoomLabelPositions = [];
607
637
  maps.zoomLabelPositions = maps.dataLabelModule.dataLabelCollections;
608
- var labelAnimate = !maps.isTileMap && animate;
609
- for (var k = 0; k < currentEle.childElementCount; k++) {
638
+ var labelAnimate_1 = !maps.isTileMap && animate;
639
+ var intersect_1 = [];
640
+ Array.prototype.forEach.call(currentEle.childNodes, function (childNode, k) {
610
641
  if (currentEle.childNodes[k]['id'].indexOf('_LabelIndex_') > -1) {
611
642
  var labelIndex = parseFloat(currentEle.childNodes[k]['id'].split('_LabelIndex_')[1].split('_')[0]);
612
- this_1.zoomshapewidth = currentEle.childNodes[k].getBoundingClientRect();
613
- maps.zoomShapeCollection.push(this_1.zoomshapewidth);
614
- this_1.dataLabelTranslate(currentEle.childNodes[k], factor_1, x, y, scale, 'DataLabel', labelAnimate);
615
- var dataLabel = maps.layers[this_1.index].dataLabelSettings;
643
+ var zoomShapeWidth = currentEle.childNodes[k].id;
644
+ maps.zoomShapeCollection.push(zoomShapeWidth);
645
+ _this.dataLabelTranslate(currentEle.childNodes[k], factor_1, x, y, scale, 'DataLabel', labelAnimate_1, currentLabelIndex, isPanning, intersect_1);
646
+ currentLabelIndex++;
647
+ var dataLabel = maps.layers[_this.index].dataLabelSettings;
616
648
  var border = dataLabel.border;
617
649
  if (k > 0 && border['width'] > 1) {
618
650
  if (currentEle.childNodes[k - 1]['id'].indexOf('_rectIndex_') > -1 && !isNullOrUndefined(maps.zoomLabelPositions[labelIndex])) {
619
651
  var labelX = ((maps.zoomLabelPositions[labelIndex]['location']['x'] + x) * scale);
620
652
  var labelY = ((maps.zoomLabelPositions[labelIndex]['location']['y'] + y) * scale);
621
653
  var zoomtext = currentEle.childNodes[k]['textContent'];
622
- var style = maps.layers[this_1.index].dataLabelSettings.textStyle;
654
+ var style = maps.layers[_this.index].dataLabelSettings.textStyle;
623
655
  var zoomtextSize = measureText(zoomtext, style);
624
656
  var padding = 5;
625
657
  var rectElement = currentEle.childNodes[k - 1];
@@ -630,7 +662,7 @@ var Zoom = /** @class */ (function () {
630
662
  }
631
663
  }
632
664
  }
633
- }
665
+ });
634
666
  }
635
667
  };
636
668
  for (var j = 0; j < elementCount; j++) {
@@ -779,6 +811,7 @@ var Zoom = /** @class */ (function () {
779
811
  * @private
780
812
  */
781
813
  Zoom.prototype.processTemplate = function (x, y, scale, maps) {
814
+ var currentLabelIndex = 0;
782
815
  for (var i = 0; i < this.templateCount; i++) {
783
816
  var factor = maps.mapLayerPanel.calculateFactor(this.currentLayer);
784
817
  var markerTemplateElement = getElementByID(maps.element.id + '_LayerIndex_' +
@@ -795,7 +828,8 @@ var Zoom = /** @class */ (function () {
795
828
  }
796
829
  if ((!isNullOrUndefined(datalabelTemplateElemement)) && datalabelTemplateElemement.childElementCount > 0) {
797
830
  for (var k = 0; k < datalabelTemplateElemement.childElementCount; k++) {
798
- this.dataLabelTranslate(datalabelTemplateElemement.childNodes[k], factor, x, y, scale, 'Template');
831
+ this.dataLabelTranslate(datalabelTemplateElemement.childNodes[k], factor, x, y, scale, 'Template', false, currentLabelIndex);
832
+ currentLabelIndex++;
799
833
  }
800
834
  }
801
835
  if (!isNullOrUndefined(polygonElement)) {
@@ -806,7 +840,7 @@ var Zoom = /** @class */ (function () {
806
840
  }
807
841
  }
808
842
  };
809
- Zoom.prototype.dataLabelTranslate = function (element, factor, x, y, scale, type, animate) {
843
+ Zoom.prototype.dataLabelTranslate = function (element, factor, x, y, scale, type, animate, currentLabelIndex, isPanning, intersect) {
810
844
  if (animate === void 0) { animate = false; }
811
845
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
812
846
  var labelCollection = this.maps.dataLabelModule.dataLabelCollections;
@@ -823,77 +857,80 @@ var Zoom = /** @class */ (function () {
823
857
  labelIndex = parseFloat(element.id.split('_LabelIndex_')[1].split('_')[0]);
824
858
  }
825
859
  var duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
826
- for (var l = 0; l < labelCollection.length; l++) {
827
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
828
- var label = labelCollection[l];
829
- if (label['layerIndex'] === layerIndex && label['shapeIndex'] === shapeIndex
830
- && label['labelIndex'] === labelIndex) {
831
- var labelX = label['location']['x'];
832
- var labelY = label['location']['y'];
833
- if (type === 'Template') {
834
- var locationX = 0;
835
- var locationY = 0;
836
- if (this.maps.isTileMap) {
837
- zoomtext = label['dataLabelText'];
838
- zoomtextSize = measureText(zoomtext, style);
839
- locationX = ((labelX + x) * scale) - (zoomtextSize['width'] / 2);
840
- locationY = ((labelY + y) * scale) - (zoomtextSize['height']);
841
- }
842
- else {
843
- var layerEle = getElementByID(this.maps.element.id + '_Layer_Collections');
844
- labelX = ((Math.abs(this.maps.baseMapRectBounds['min']['x'] - labelX)) * scale);
845
- labelY = ((Math.abs(this.maps.baseMapRectBounds['min']['y'] - labelY)) * scale);
846
- var layerOffset = layerEle.getBoundingClientRect();
847
- var elementOffset = element.parentElement.getBoundingClientRect();
848
- locationX = ((labelX) + (layerOffset.left - elementOffset.left));
849
- locationY = ((labelY) + (layerOffset.top - elementOffset.top));
850
- }
851
- element.style.left = locationX + 'px';
852
- element.style.top = locationY + 'px';
853
- }
854
- else {
855
- labelX = ((labelX + x) * scale);
856
- labelY = ((labelY + y) * scale);
860
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
861
+ var label = labelCollection[currentLabelIndex];
862
+ var index = currentLabelIndex;
863
+ if (label['layerIndex'] === layerIndex && label['shapeIndex'] === shapeIndex
864
+ && label['labelIndex'] === labelIndex) {
865
+ var labelX = label['location']['x'];
866
+ var labelY = label['location']['y'];
867
+ if (type === 'Template') {
868
+ var locationX = 0;
869
+ var locationY = 0;
870
+ if (this.maps.isTileMap) {
857
871
  zoomtext = label['dataLabelText'];
858
872
  zoomtextSize = measureText(zoomtext, style);
859
- var start = labelY - zoomtextSize['height'] / 4;
860
- var end = labelY + zoomtextSize['height'] / 4;
873
+ locationX = ((labelX + x) * scale) - (zoomtextSize['width'] / 2);
874
+ locationY = ((labelY + y) * scale) - (zoomtextSize['height']);
875
+ }
876
+ else {
877
+ var layerEle = getElementByID(this.maps.element.id + '_Layer_Collections');
878
+ labelX = ((Math.abs(this.maps.baseMapRectBounds['min']['x'] - labelX)) * scale);
879
+ labelY = ((Math.abs(this.maps.baseMapRectBounds['min']['y'] - labelY)) * scale);
880
+ var layerOffset = layerEle.getBoundingClientRect();
881
+ var elementOffset = element.parentElement.getBoundingClientRect();
882
+ locationX = ((labelX) + (layerOffset.left - elementOffset.left));
883
+ locationY = ((labelY) + (layerOffset.top - elementOffset.top));
884
+ }
885
+ element.style.left = locationX + 'px';
886
+ element.style.top = locationY + 'px';
887
+ }
888
+ else {
889
+ labelX = ((labelX + x) * scale);
890
+ labelY = ((labelY + y) * scale);
891
+ zoomtext = label['dataLabelText'];
892
+ if (!animate || duration === 0) {
893
+ element.setAttribute('transform', 'translate( ' + labelX + ' ' + labelY + ' )');
894
+ }
895
+ if ((isNullOrUndefined(isPanning) || !isPanning) && (this.maps.layers[this.index].dataLabelSettings.smartLabelMode !== 'None' ||
896
+ this.maps.layers[this.index].dataLabelSettings.intersectionAction !== 'None')) {
897
+ zoomtextSize = measureTextElement(zoomtext, style);
898
+ var start = labelY - zoomtextSize['height'] / 2;
899
+ var end = labelY + zoomtextSize['height'] / 2;
861
900
  var xpositionEnds = labelX + zoomtextSize['width'] / 2;
862
901
  var xpositionStart = labelX - zoomtextSize['width'] / 2;
863
902
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
864
903
  var textLocations = { rightWidth: xpositionEnds, leftWidth: xpositionStart, heightTop: start, heightBottom: end };
865
- if (!animate || duration === 0) {
866
- element.setAttribute('transform', 'translate( ' + labelX + ' ' + labelY + ' )');
867
- }
868
904
  if (this.maps.layers[this.index].dataLabelSettings.smartLabelMode === 'Hide') {
869
905
  if (scale > 1) {
870
- text = ((this.maps.dataLabelShape[l] * scale) >= zoomtextSize['width']) ? zoomtext : '';
906
+ text = ((this.maps.dataLabelShape[index] * scale) >= zoomtextSize['width']) ? zoomtext : '';
871
907
  element.textContent = text;
872
908
  }
873
909
  else {
874
- text = (this.maps.dataLabelShape[l] >= zoomtextSize['width']) ? zoomtext : '';
910
+ text = (this.maps.dataLabelShape[index] >= zoomtextSize['width']) ? zoomtext : '';
875
911
  element.textContent = text;
876
912
  }
877
913
  }
914
+ var widthList = [];
878
915
  if (this.maps.layers[this.index].dataLabelSettings.smartLabelMode === 'Trim') {
879
916
  if (scale > 1) {
880
- zoomtrimLabel = textTrim((this.maps.dataLabelShape[l] * scale), zoomtext, style);
917
+ zoomtrimLabel = textTrim((this.maps.dataLabelShape[index] * scale), zoomtext, style, zoomtextSize.width, true, widthList);
881
918
  text = zoomtrimLabel;
882
919
  element.textContent = text;
883
920
  }
884
921
  else {
885
- zoomtrimLabel = textTrim(this.maps.dataLabelShape[l], zoomtext, style);
922
+ zoomtrimLabel = textTrim(this.maps.dataLabelShape[index], zoomtext, style, zoomtextSize.width, true, widthList);
886
923
  text = zoomtrimLabel;
887
924
  element.textContent = text;
888
925
  }
889
926
  }
890
927
  if (this.maps.layers[this.index].dataLabelSettings.intersectionAction === 'Hide') {
891
- for (var m = 0; m < this.intersect.length; m++) {
892
- if (!isNullOrUndefined(this.intersect[m])) {
893
- if (textLocations['leftWidth'] > this.intersect[m]['rightWidth']
894
- || textLocations['rightWidth'] < this.intersect[m]['leftWidth']
895
- || textLocations['heightTop'] > this.intersect[m]['heightBottom']
896
- || textLocations['heightBottom'] < this.intersect[m]['heightTop']) {
928
+ for (var m = 0; m < intersect.length; m++) {
929
+ if (!isNullOrUndefined(intersect[m])) {
930
+ if (textLocations['leftWidth'] > intersect[m]['rightWidth']
931
+ || textLocations['rightWidth'] < intersect[m]['leftWidth']
932
+ || textLocations['heightTop'] > intersect[m]['heightBottom']
933
+ || textLocations['heightBottom'] < intersect[m]['heightTop']) {
897
934
  text = !isNullOrUndefined(text) ? text : zoomtext;
898
935
  element.textContent = text;
899
936
  }
@@ -904,50 +941,53 @@ var Zoom = /** @class */ (function () {
904
941
  }
905
942
  }
906
943
  }
907
- this.intersect.push(textLocations);
944
+ intersect.push(textLocations);
908
945
  }
909
946
  if (this.maps.layers[this.index].dataLabelSettings.intersectionAction === 'Trim') {
910
- for (var j = 0; j < this.intersect.length; j++) {
911
- if (!isNullOrUndefined(this.intersect[j])) {
912
- if (textLocations['rightWidth'] < this.intersect[j]['leftWidth']
913
- || textLocations['leftWidth'] > this.intersect[j]['rightWidth']
914
- || textLocations['heightBottom'] < this.intersect[j]['heightTop']
915
- || textLocations['heightTop'] > this.intersect[j]['heightBottom']) {
947
+ for (var j = 0; j < intersect.length; j++) {
948
+ if (!isNullOrUndefined(intersect[j])) {
949
+ if (textLocations['rightWidth'] < intersect[j]['leftWidth']
950
+ || textLocations['leftWidth'] > intersect[j]['rightWidth']
951
+ || textLocations['heightBottom'] < intersect[j]['heightTop']
952
+ || textLocations['heightTop'] > intersect[j]['heightBottom']) {
916
953
  trimmedLable = !isNullOrUndefined(text) ? text : zoomtext;
917
954
  if (scale > 1) {
918
- trimmedLable = textTrim((this.maps.dataLabelShape[l] * scale), trimmedLable, style);
955
+ var trimmedWidth = widthList.length > 0 ? widthList[0] : zoomtextSize.width;
956
+ trimmedLable = textTrim((this.maps.dataLabelShape[index] * scale), trimmedLable, style, trimmedWidth, true);
919
957
  }
920
958
  element.textContent = trimmedLable;
921
959
  }
922
960
  else {
923
- if (textLocations['leftWidth'] > this.intersect[j]['leftWidth']) {
924
- var width = this.intersect[j]['rightWidth'] - textLocations['leftWidth'];
961
+ if (textLocations['leftWidth'] > intersect[j]['leftWidth']) {
962
+ var width = intersect[j]['rightWidth'] - textLocations['leftWidth'];
925
963
  var difference = width - (textLocations['rightWidth'] - textLocations['leftWidth']);
926
964
  text = !isNullOrUndefined(text) ? text : zoomtext;
927
- trimmedLable = textTrim(difference, text, style);
965
+ var trimmedWidth = widthList.length > 0 ? widthList[0] : zoomtextSize.width;
966
+ trimmedLable = textTrim(difference, text, style, trimmedWidth, true);
928
967
  element.textContent = trimmedLable;
929
968
  break;
930
969
  }
931
- if (textLocations['leftWidth'] < this.intersect[j]['leftWidth']) {
932
- var width = textLocations['rightWidth'] - this.intersect[j]['leftWidth'];
970
+ if (textLocations['leftWidth'] < intersect[j]['leftWidth']) {
971
+ var width = textLocations['rightWidth'] - intersect[j]['leftWidth'];
933
972
  var difference = Math.abs(width - (textLocations['rightWidth'] - textLocations['leftWidth']));
934
973
  text = !isNullOrUndefined(text) ? text : zoomtext;
935
- trimmedLable = textTrim(difference, text, style);
974
+ var trimmedWidth = widthList.length > 0 ? widthList[0] : zoomtextSize.width;
975
+ trimmedLable = textTrim(difference, text, style, trimmedWidth, true);
936
976
  element.textContent = trimmedLable;
937
977
  break;
938
978
  }
939
979
  }
940
980
  }
941
981
  }
942
- this.intersect.push(textLocations);
982
+ intersect.push(textLocations);
943
983
  if (isNullOrUndefined(trimmedLable)) {
944
- trimmedLable = textTrim((this.maps.dataLabelShape[l] * scale), zoomtext, style);
984
+ trimmedLable = textTrim((this.maps.dataLabelShape[index] * scale), zoomtext, style, zoomtextSize.width, true);
945
985
  element.textContent = trimmedLable;
946
986
  }
947
987
  }
948
- if (animate || duration > 0) {
949
- smoothTranslate(element, 0, duration, new MapLocation(labelX, labelY));
950
- }
988
+ }
989
+ if (animate || duration > 0) {
990
+ smoothTranslate(element, 0, duration, new MapLocation(labelX, labelY));
951
991
  }
952
992
  }
953
993
  }
@@ -1093,15 +1133,15 @@ var Zoom = /** @class */ (function () {
1093
1133
  if (!panArgs.cancel) {
1094
1134
  if (panningXDirection && panningYDirection) {
1095
1135
  map.translatePoint = new Point(x, y);
1096
- this.applyTransform(map);
1136
+ this.applyTransform(map, false, true);
1097
1137
  }
1098
1138
  else if (panningXDirection) {
1099
1139
  map.translatePoint = new Point(x, map.translatePoint.y);
1100
- this.applyTransform(map);
1140
+ this.applyTransform(map, false, true);
1101
1141
  }
1102
1142
  else if (panningYDirection) {
1103
1143
  map.translatePoint = new Point(map.translatePoint.x, y);
1104
- this.applyTransform(map);
1144
+ this.applyTransform(map, false, true);
1105
1145
  }
1106
1146
  }
1107
1147
  this.maps.zoomNotApplied = false;
@@ -1117,8 +1157,8 @@ var Zoom = /** @class */ (function () {
1117
1157
  map.tileTranslatePoint.x = x + xDifference;
1118
1158
  map.tileTranslatePoint.y = y + yDifference;
1119
1159
  }
1120
- map.translatePoint.x = (map.tileTranslatePoint.x - xDifference) / map.scale;
1121
- map.translatePoint.y = (map.tileTranslatePoint.y - yDifference) / map.scale;
1160
+ map.translatePoint.x = (map.tileTranslatePoint.x) / map.scale;
1161
+ map.translatePoint.y = (map.tileTranslatePoint.y) / map.scale;
1122
1162
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1123
1163
  var location_4 = this.maps.getTileGeoLocation(mouseLocation['layerX'], mouseLocation['layerY']);
1124
1164
  var minMaxLatitudeLongitude = this.maps.getMinMaxLatitudeLongitude();
@@ -1132,7 +1172,9 @@ var Zoom = /** @class */ (function () {
1132
1172
  };
1133
1173
  map.trigger(pan, panArgs);
1134
1174
  map.mapLayerPanel.generateTiles(map.tileZoomLevel, map.tileTranslatePoint, 'Pan');
1135
- this.applyTransform(map);
1175
+ this.applyTransform(map, false, true);
1176
+ map.translatePoint.x = (map.tileTranslatePoint.x - xDifference) / map.scale;
1177
+ map.translatePoint.y = (map.tileTranslatePoint.y - yDifference) / map.scale;
1136
1178
  }
1137
1179
  map.zoomTranslatePoint = map.translatePoint;
1138
1180
  this.mouseDownPoints = this.mouseMovePoints;
@@ -1257,6 +1299,7 @@ var Zoom = /** @class */ (function () {
1257
1299
  }
1258
1300
  this.maps.zoomNotApplied = false;
1259
1301
  }
1302
+ this.triggerZoomComplete(map, prevLevel, type);
1260
1303
  };
1261
1304
  /**
1262
1305
  * @private
@@ -1548,7 +1591,7 @@ var Zoom = /** @class */ (function () {
1548
1591
  };
1549
1592
  Zoom.prototype.panningStyle = function (toolbar) {
1550
1593
  var svg = getElementByID(this.maps.element.id + '_svg');
1551
- if (toolbar === 'pan' || (this.isPanning && toolbar !== 'reset')) {
1594
+ if (toolbar === 'pan' || (this.isPanModeEnabled && toolbar !== 'reset')) {
1552
1595
  svg.setAttribute('class', 'e-maps-panning');
1553
1596
  }
1554
1597
  else {
@@ -1895,8 +1938,8 @@ var Zoom = /** @class */ (function () {
1895
1938
  this.isTouch = true;
1896
1939
  touches = e.touches;
1897
1940
  target = e.target;
1898
- pageX = touches[0].clientX;
1899
- pageY = touches[0].clientY;
1941
+ pageX = touches[0].pageX;
1942
+ pageY = touches[0].pageY;
1900
1943
  }
1901
1944
  else {
1902
1945
  pageX = e.pageX;
@@ -1904,11 +1947,11 @@ var Zoom = /** @class */ (function () {
1904
1947
  target = e.target;
1905
1948
  }
1906
1949
  if (!this.maps.zoomSettings.enablePanning) {
1907
- this.isPan = this.isPanning = this.panColor !== this.selectionColor ? this.maps.zoomSettings.enablePanning
1950
+ this.isPan = this.isPanModeEnabled = this.panColor !== this.selectionColor ? this.maps.zoomSettings.enablePanning
1908
1951
  : this.zoomColor === this.selectionColor;
1909
1952
  }
1910
1953
  else {
1911
- this.isPan = this.isPanning = !this.isZoomSelection;
1954
+ this.isPan = this.isPanModeEnabled = !this.isZoomSelection;
1912
1955
  }
1913
1956
  this.mouseDownLatLong = { x: pageX, y: pageY };
1914
1957
  var scale = this.maps.isTileMap ? Math.round(this.maps.tileZoomLevel) : Math.round(this.maps.mapScaleValue);
@@ -1936,8 +1979,8 @@ var Zoom = /** @class */ (function () {
1936
1979
  this.isTouch = true;
1937
1980
  target = e.target;
1938
1981
  touches = e.touches;
1939
- pageX = touches[0].clientX;
1940
- pageY = touches[0].clientY;
1982
+ pageX = touches[0].pageX;
1983
+ pageY = touches[0].pageY;
1941
1984
  }
1942
1985
  else {
1943
1986
  pageX = e.pageX;
@@ -1971,7 +2014,7 @@ var Zoom = /** @class */ (function () {
1971
2014
  this.mouseMovePoints = this.getMousePosition(pageX, pageY);
1972
2015
  var targetId = e.target['id'];
1973
2016
  var targetEle = e.target;
1974
- if (zoom.enable && this.isPanning && this.maps.markerDragId.indexOf('_MarkerIndex_') == -1 && ((Browser.isDevice && touches.length >= 1) || !Browser.isDevice)) {
2017
+ if (zoom.enable && this.isPanModeEnabled && this.maps.markerDragId.indexOf('_MarkerIndex_') == -1 && ((Browser.isDevice && touches.length >= 1) || !Browser.isDevice)) {
1975
2018
  e.preventDefault();
1976
2019
  this.maps.element.style.cursor = 'pointer';
1977
2020
  this.mouseMoveLatLong = { x: pageX, y: pageY };
@@ -2002,13 +2045,66 @@ var Zoom = /** @class */ (function () {
2002
2045
  var isDragZoom;
2003
2046
  var map = this.maps;
2004
2047
  this.rectZoomingStart = false;
2005
- this.isPanning = false;
2006
2048
  this.isSingleClick = this.isSingleClick ? true : false;
2007
2049
  this.isTouch = false;
2008
2050
  this.touchStartList = [];
2009
2051
  this.touchMoveList = [];
2010
2052
  this.lastScale = 1;
2011
2053
  this.maps.element.style.cursor = 'auto';
2054
+ // eslint-disable-next-line max-len
2055
+ if (this.isPanModeEnabled && this.maps.zoomSettings.enablePanning && !isNullOrUndefined(this.maps.previousPoint) &&
2056
+ (this.maps.translatePoint.x !== this.maps.previousPoint.x && this.maps.translatePoint.y !== this.maps.previousPoint.y)) {
2057
+ var pageX = void 0;
2058
+ var pageY = void 0;
2059
+ var layerX = 0;
2060
+ var layerY = 0;
2061
+ var target = void 0;
2062
+ var rect = this.maps.element.getBoundingClientRect();
2063
+ var element = e.target;
2064
+ if (e.type.indexOf('touch') !== -1) {
2065
+ var touchArg = e;
2066
+ layerX = pageX = touchArg.changedTouches[0].pageX;
2067
+ pageY = touchArg.changedTouches[0].pageY;
2068
+ layerY = pageY - (this.maps.isTileMap ? 10 : 0);
2069
+ target = touchArg.target;
2070
+ this.maps.mouseClickEvent = { x: pageX, y: pageY };
2071
+ }
2072
+ else {
2073
+ pageX = e.pageX;
2074
+ pageY = e.pageY;
2075
+ layerX = e['layerX'];
2076
+ layerY = e['layerY'] - (this.maps.isTileMap ? 10 : 0);
2077
+ target = e.target;
2078
+ }
2079
+ var panCompleteEventArgs = void 0;
2080
+ var minMaxLatitudeLongitude = this.maps.getMinMaxLatitudeLongitude();
2081
+ if (!this.maps.isTileMap) {
2082
+ this.maps.mouseClickEvent['x'] = this.maps.mouseDownEvent['x'];
2083
+ this.maps.mouseClickEvent['y'] = this.maps.mouseDownEvent['y'];
2084
+ var location_5 = this.maps.getClickLocation(element.id, pageX, pageY, element, pageX, pageY);
2085
+ panCompleteEventArgs = {
2086
+ cancel: false, name: 'panComplete', maps: this.maps,
2087
+ tileTranslatePoint: {}, translatePoint: { previous: this.maps.previousPoint, current: this.maps.translatePoint },
2088
+ scale: this.maps.scale, tileZoomLevel: this.maps.tileZoomLevel, latitude: !isNullOrUndefined(location_5) ?
2089
+ location_5.latitude : 0, longitude: !isNullOrUndefined(location_5) ? location_5.longitude : 0,
2090
+ minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
2091
+ minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
2092
+ };
2093
+ }
2094
+ else {
2095
+ var location_6 = this.maps.getTileGeoLocation(layerX, layerY);
2096
+ panCompleteEventArgs = {
2097
+ cancel: false, name: 'panComplete', maps: this.maps,
2098
+ tileTranslatePoint: { previous: this.maps.tileTranslatePoint, current: this.maps.tileTranslatePoint },
2099
+ translatePoint: { previous: this.maps.previousPoint, current: this.maps.translatePoint }, scale: this.maps.scale,
2100
+ tileZoomLevel: this.maps.tileZoomLevel, latitude: location_6.latitude, longitude: location_6.longitude,
2101
+ minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
2102
+ minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
2103
+ };
2104
+ }
2105
+ this.maps.trigger('panComplete', panCompleteEventArgs);
2106
+ }
2107
+ this.isPanModeEnabled = false;
2012
2108
  if ((!isNullOrUndefined(this.distanceX) || !isNullOrUndefined(this.distanceY)) && (!isNullOrUndefined(this.currentLayer) && this.currentLayer.type === 'SubLayer')) {
2013
2109
  this.toAlignSublayer();
2014
2110
  this.distanceX = this.distanceY = null;
@@ -2026,7 +2122,7 @@ var Zoom = /** @class */ (function () {
2026
2122
  * @private
2027
2123
  */
2028
2124
  Zoom.prototype.mouseCancelHandler = function (e) {
2029
- this.isPanning = false;
2125
+ this.isPanModeEnabled = false;
2030
2126
  this.isTouch = false;
2031
2127
  this.rectZoomingStart = false;
2032
2128
  var zoomRectElement = getElementByID(this.maps.element.id + '_Selection_Rect_Zooming');
@@ -2106,7 +2202,7 @@ var Zoom = /** @class */ (function () {
2106
2202
  this.maps.off(Browser.touchMoveEvent, this.mouseMoveHandler);
2107
2203
  this.maps.off(Browser.touchStartEvent, this.mouseDownHandler);
2108
2204
  this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
2109
- this.maps.off(this.cancelEvent, this.mouseCancelHandler);
2205
+ EventHandler.remove(this.maps.element, this.cancelEvent, this.mouseCancelHandler);
2110
2206
  };
2111
2207
  /**
2112
2208
  * Get module name.
@@ -2135,14 +2231,12 @@ var Zoom = /** @class */ (function () {
2135
2231
  this.mouseDownPoints = null;
2136
2232
  this.mouseMovePoints = null;
2137
2233
  this.startTouches = [];
2138
- this.zoomshapewidth = null;
2139
- this.intersect = [];
2140
2234
  this.mouseDownLatLong = null;
2141
2235
  this.mouseMoveLatLong = null;
2142
2236
  this.removeEventListener();
2143
- //TODO: Calling the below code throws spec issue.
2144
- //this.maps = null;
2237
+ this.layerCollectionEle = null;
2145
2238
  this.currentLayer = null;
2239
+ this.maps = null;
2146
2240
  };
2147
2241
  return Zoom;
2148
2242
  }());
@@ -219,6 +219,8 @@ export declare class GeoLocation {
219
219
  * @private
220
220
  */
221
221
  export declare function measureText(text: string, font: FontModel): Size;
222
+ /** @private */
223
+ export declare function measureTextElement(text: string, font: FontModel): Size;
222
224
  /**
223
225
  * Internal use of text options
224
226
  *
@@ -484,6 +486,10 @@ export declare function markerShapeChoose(eventArgs: IMarkerRenderingEventArgs,
484
486
  * @private
485
487
  */
486
488
  export declare function clusterTemplate(currentLayer: LayerSettings, markerTemplate: HTMLElement | Element, maps: Maps, layerIndex: number, markerCollection: Element, layerElement: Element, check: boolean, zoomCheck: boolean): boolean;
489
+ /** @private */
490
+ export declare function markerClusterListHandler(maps: Maps, currentZoomFactor: number, layerIndex: number, index: number, indexCollection: number[]): void;
491
+ /** @private */
492
+ export declare function markerBoundsComparer(tempElement: Element, markerBounds: ClientRect, colloideBounds: ClientRect[], indexCollection: number[], p: number): void;
487
493
  /**
488
494
  *
489
495
  * @param {MarkerClusterData[]} sameMarkerData - Specifies the marker data
@@ -816,7 +822,7 @@ export declare function isCustomPath(layerData: any[]): boolean;
816
822
  * @returns {string} - Returns the string
817
823
  * @private
818
824
  */
819
- export declare function textTrim(maxWidth: number, text: string, font: FontModel): string;
825
+ export declare function textTrim(maxWidth: number, text: string, font: FontModel, width?: number, isCanvasMeasure?: boolean, widthList?: number[]): string;
820
826
  /**
821
827
  * Method to calculate x position of title
822
828
  *