@syncfusion/ej2-maps 20.1.55 → 20.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,8 +25,6 @@ var Zoom = /** @class */ (function () {
25
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
26
  this.startTouches = [];
27
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
- this.shapeZoomLocation = [];
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
28
  this.intersect = [];
31
29
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
30
  this.mouseDownLatLong = { x: 0, y: 0 };
@@ -66,7 +64,8 @@ var Zoom = /** @class */ (function () {
66
64
  var minZoom = map.zoomSettings.minZoom;
67
65
  newZoomFactor = (minZoom > newZoomFactor && type === 'ZoomIn') ? minZoom + 1 : newZoomFactor;
68
66
  var prevTilePoint = map.tileTranslatePoint;
69
- if ((!map.isTileMap) && (type === 'ZoomIn' ? newZoomFactor >= minZoom && newZoomFactor <= maxZoom : newZoomFactor >= minZoom)) {
67
+ if ((!map.isTileMap) && ((type === 'ZoomIn' ? newZoomFactor >= minZoom && newZoomFactor <= maxZoom : newZoomFactor >= minZoom)
68
+ || map.isReset)) {
70
69
  var availSize = map.mapAreaRect;
71
70
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
71
  var minBounds = map.baseMapRectBounds['min'];
@@ -74,17 +73,29 @@ var Zoom = /** @class */ (function () {
74
73
  var maxBounds = map.baseMapRectBounds['max'];
75
74
  var mapTotalWidth = Math.abs(minBounds['x'] - maxBounds['x']);
76
75
  var mapTotalHeight = Math.abs(minBounds['y'] - maxBounds['y']);
77
- var point = map.translatePoint;
78
- var translatePointX = point.x - (((availSize.width / scale) - (availSize.width / newZoomFactor)) / (availSize.width / position.x));
79
- var translatePointY = point.y - (((availSize.height / scale) - (availSize.height / newZoomFactor)) / (availSize.height / position.y));
80
- var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * newZoomFactor;
81
- translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
82
- translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
83
- map.translatePoint = new Point(translatePointX, translatePointY);
76
+ var translatePointX = void 0;
77
+ var translatePointY = void 0;
78
+ if (newZoomFactor < 1.2 && map.projectionType !== 'Eckert5') {
79
+ if (mapTotalWidth === 0 || mapTotalHeight === 0 || mapTotalWidth === mapTotalHeight) {
80
+ mapTotalWidth = availSize.width / 2;
81
+ mapTotalHeight = availSize.height;
82
+ }
83
+ newZoomFactor = parseFloat(Math.min(availSize.width / mapTotalWidth, availSize.height / mapTotalHeight).toFixed(2));
84
+ map.translatePoint = this.calculateInitalZoomTranslatePoint(newZoomFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map);
85
+ }
86
+ else {
87
+ var point = map.translatePoint;
88
+ translatePointX = point.x - (((availSize.width / scale) - (availSize.width / newZoomFactor)) / (availSize.width / position.x));
89
+ translatePointY = point.y - (((availSize.height / scale) - (availSize.height / newZoomFactor)) / (availSize.height / position.y));
90
+ var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * newZoomFactor;
91
+ translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
92
+ translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
93
+ map.translatePoint = new Point(translatePointX, translatePointY);
94
+ }
84
95
  map.scale = newZoomFactor;
85
96
  if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
86
97
  map.translatePoint = map.previousPoint;
87
- map.scale = map.previousScale;
98
+ map.scale = map.mapScaleValue = map.previousScale;
88
99
  }
89
100
  else {
90
101
  this.applyTransform();
@@ -140,6 +151,14 @@ var Zoom = /** @class */ (function () {
140
151
  }
141
152
  this.maps.zoomNotApplied = false;
142
153
  };
154
+ Zoom.prototype.calculateInitalZoomTranslatePoint = function (newZoomFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map) {
155
+ mapTotalWidth *= newZoomFactor;
156
+ mapTotalHeight *= newZoomFactor;
157
+ var widthDiff = minBounds['x'] !== 0 && map.translateType === 'layers' ? map.availableSize.width - availSize.width : 0;
158
+ var translatePointX = availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2))) - widthDiff;
159
+ var translatePointY = availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)));
160
+ return new Point(translatePointX, translatePointY);
161
+ };
143
162
  Zoom.prototype.triggerZoomEvent = function (prevTilePoint, prevLevel, type) {
144
163
  var map = this.maps;
145
164
  var zoomArgs;
@@ -267,12 +286,24 @@ var Zoom = /** @class */ (function () {
267
286
  var mapTotalHeight = Math.abs(minBounds['y'] - maxBounds['y']);
268
287
  var mapTotalWidth = Math.abs(minBounds['x'] - maxBounds['x']);
269
288
  var translatePoint = map.translatePoint;
270
- var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * zoomCalculationFactor;
271
- var translatePointX = translatePoint.x - (((availSize.width / map.scale) - (availSize.width / zoomCalculationFactor)) / (availSize.width / touchCenter.x));
272
- var translatePointY = translatePoint.y - (((availSize.height / map.scale) - (availSize.height / zoomCalculationFactor)) / (availSize.height / touchCenter.y));
273
- translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
274
- translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
275
- map.translatePoint = new Point(translatePointX, translatePointY);
289
+ var translatePointX = void 0;
290
+ var translatePointY = void 0;
291
+ if (zoomCalculationFactor < 1.2 && map.projectionType !== 'Eckert5') {
292
+ if (mapTotalWidth === 0 || mapTotalHeight === 0 || mapTotalWidth === mapTotalHeight) {
293
+ mapTotalWidth = availSize.width / 2;
294
+ mapTotalHeight = availSize.height;
295
+ }
296
+ zoomCalculationFactor = parseFloat(Math.min(availSize.width / mapTotalWidth, availSize.height / mapTotalHeight).toFixed(2));
297
+ map.translatePoint = this.calculateInitalZoomTranslatePoint(zoomCalculationFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map);
298
+ }
299
+ else {
300
+ var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * zoomCalculationFactor;
301
+ translatePointX = translatePoint.x - (((availSize.width / map.scale) - (availSize.width / zoomCalculationFactor)) / (availSize.width / touchCenter.x));
302
+ translatePointY = translatePoint.y - (((availSize.height / map.scale) - (availSize.height / zoomCalculationFactor)) / (availSize.height / touchCenter.y));
303
+ translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
304
+ translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
305
+ map.translatePoint = new Point(translatePointX, translatePointY);
306
+ }
276
307
  map.scale = zoomCalculationFactor;
277
308
  isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
278
309
  if (isZoomCancelled) {
@@ -386,11 +417,10 @@ var Zoom = /** @class */ (function () {
386
417
  layerElement.appendChild(this.maps.navigationLineModule.renderNavigation(this.currentLayer, this.maps.tileZoomLevel, this.index));
387
418
  }
388
419
  }
389
- else {
420
+ else if (currentEle.id.indexOf('Legend') == -1) {
390
421
  changeBorderWidth(currentEle, this.index, scale, this.maps);
391
422
  this.maps.zoomTranslatePoint = this.maps.translatePoint;
392
423
  this.animateTransform(currentEle, animate, x, y, scale);
393
- this.shapeZoomLocation = currentEle.childNodes;
394
424
  }
395
425
  }
396
426
  else if (currentEle.id.indexOf('_Markers_Group') > -1) {
@@ -497,7 +527,7 @@ var Zoom = /** @class */ (function () {
497
527
  for (var k = 0; k < currentEle.childElementCount; k++) {
498
528
  if (currentEle.childNodes[k]['id'].indexOf('_LabelIndex_') > -1) {
499
529
  var labelIndex = parseFloat(currentEle.childNodes[k]['id'].split('_LabelIndex_')[1].split('_')[0]);
500
- this.zoomshapewidth = this.shapeZoomLocation[labelIndex].getBoundingClientRect();
530
+ this.zoomshapewidth = currentEle.childNodes[k].getBoundingClientRect();
501
531
  this.maps.zoomShapeCollection.push(this.zoomshapewidth);
502
532
  this.dataLabelTranslate(currentEle.childNodes[k], factor, x, y, scale, 'DataLabel', animate);
503
533
  var dataLabel = this.maps.layers[this.index].dataLabelSettings;
@@ -716,7 +746,7 @@ var Zoom = /** @class */ (function () {
716
746
  }
717
747
  if (this.maps.layers[this.index].dataLabelSettings.smartLabelMode === 'Hide') {
718
748
  if (scale > 1) {
719
- text = (this.zoomshapewidth['width'] >= zoomtextSize['width']) ? zoomtext : '';
749
+ text = ((this.maps.dataLabelShape[l] * scale) >= zoomtextSize['width']) ? zoomtext : '';
720
750
  element.innerHTML = text;
721
751
  }
722
752
  else {
@@ -726,7 +756,7 @@ var Zoom = /** @class */ (function () {
726
756
  }
727
757
  if (this.maps.layers[this.index].dataLabelSettings.smartLabelMode === 'Trim') {
728
758
  if (scale > 1) {
729
- zoomtrimLabel = textTrim(this.zoomshapewidth['width'], zoomtext, style);
759
+ zoomtrimLabel = textTrim((this.maps.dataLabelShape[l] * scale), zoomtext, style);
730
760
  text = zoomtrimLabel;
731
761
  element.innerHTML = text;
732
762
  }
@@ -764,7 +794,7 @@ var Zoom = /** @class */ (function () {
764
794
  || textLocations['heightTop'] > this.intersect[j]['heightBottom']) {
765
795
  trimmedLable = !isNullOrUndefined(text) ? text : zoomtext;
766
796
  if (scale > 1) {
767
- trimmedLable = textTrim(this.zoomshapewidth['width'], trimmedLable, style);
797
+ trimmedLable = textTrim((this.maps.dataLabelShape[l] * scale), trimmedLable, style);
768
798
  }
769
799
  element.innerHTML = trimmedLable;
770
800
  }
@@ -790,11 +820,11 @@ var Zoom = /** @class */ (function () {
790
820
  }
791
821
  this.intersect.push(textLocations);
792
822
  if (isNullOrUndefined(trimmedLable)) {
793
- trimmedLable = textTrim(this.zoomshapewidth['width'], zoomtext, style);
823
+ trimmedLable = textTrim((this.maps.dataLabelShape[l] * scale), zoomtext, style);
794
824
  element.innerHTML = trimmedLable;
795
825
  }
796
826
  }
797
- else {
827
+ if (animate || duration > 0) {
798
828
  smoothTranslate(element, 0, duration, new MapLocation(labelX, labelY));
799
829
  }
800
830
  }
@@ -916,7 +946,7 @@ var Zoom = /** @class */ (function () {
916
946
  var layerRect = getElementByID(map.element.id + '_Layer_Collections').getBoundingClientRect();
917
947
  var elementRect = getElementByID(map.element.id + '_svg').getBoundingClientRect();
918
948
  var panningXDirection = ((xDifference < 0 ? layerRect.left <= (elementRect.left + map.mapAreaRect.x) :
919
- ((layerRect.left + layerRect.width) >= (elementRect.left + elementRect.width) + map.mapAreaRect.x + map.margin.left)));
949
+ ((layerRect.left + layerRect.width + map.mapAreaRect.x) >= (elementRect.width))));
920
950
  var panningYDirection = ((yDifference < 0 ? layerRect.top <= (elementRect.top + map.mapAreaRect.y) :
921
951
  ((layerRect.top + layerRect.height + legendHeight + map.margin.top) >= (elementRect.top + elementRect.height))));
922
952
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1009,14 +1039,26 @@ var Zoom = /** @class */ (function () {
1009
1039
  var max = map.baseMapRectBounds['max'];
1010
1040
  var mapWidth = Math.abs(max['x'] - min['x']);
1011
1041
  var mapHeight = Math.abs(min['y'] - max['y']);
1012
- var translatePointX = translatePoint.x - (((size.width / scale) - (size.width / zoomFactor)) / 2);
1013
- var translatePointY = translatePoint.y - (((size.height / scale) - (size.height / zoomFactor)) / 2);
1014
- var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * zoomFactor;
1015
- translatePointX = (currentHeight < map.mapAreaRect.height) ? (size.x + ((-(min['x'])) + ((size.width / 2) - (mapWidth / 2))))
1016
- : translatePointX;
1017
- translatePointY = (currentHeight < map.mapAreaRect.height) ? (size.y + ((-(min['y'])) + ((size.height / 2) - (mapHeight / 2))))
1018
- : translatePointY;
1019
- map.translatePoint = new Point(translatePointX, translatePointY);
1042
+ var translatePointX = void 0;
1043
+ var translatePointY = void 0;
1044
+ if (zoomFactor < 1.2 && map.projectionType !== 'Eckert5') {
1045
+ if (mapHeight === 0 || mapWidth === 0 || mapHeight === mapWidth) {
1046
+ mapWidth = size.width / 2;
1047
+ mapHeight = size.height;
1048
+ }
1049
+ zoomFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));
1050
+ map.translatePoint = this.calculateInitalZoomTranslatePoint(zoomFactor, mapWidth, mapHeight, size, min, map);
1051
+ }
1052
+ else {
1053
+ translatePointX = translatePoint.x - (((size.width / scale) - (size.width / zoomFactor)) / 2);
1054
+ translatePointY = translatePoint.y - (((size.height / scale) - (size.height / zoomFactor)) / 2);
1055
+ var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * zoomFactor;
1056
+ translatePointX = (currentHeight < map.mapAreaRect.height) ? (size.x + ((-(min['x'])) + ((size.width / 2) - (mapWidth / 2))))
1057
+ : translatePointX;
1058
+ translatePointY = (currentHeight < map.mapAreaRect.height) ? (size.y + ((-(min['y'])) + ((size.height / 2) - (mapHeight / 2))))
1059
+ : translatePointY;
1060
+ map.translatePoint = new Point(translatePointX, translatePointY);
1061
+ }
1020
1062
  map.zoomTranslatePoint = map.translatePoint;
1021
1063
  map.scale = zoomFactor;
1022
1064
  if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
@@ -1340,7 +1382,12 @@ var Zoom = /** @class */ (function () {
1340
1382
  x = (size.width / 2) - (toolBarSize.width / 2);
1341
1383
  break;
1342
1384
  case 'Far':
1343
- x = (size.width - toolBarSize.width) - padding;
1385
+ if (!isNullOrUndefined(map.legendModule) && map.legendSettings.position === 'Left') {
1386
+ x = size.width + size.x - toolBarSize.width - padding;
1387
+ }
1388
+ else {
1389
+ x = (size.width - toolBarSize.width) - padding;
1390
+ }
1344
1391
  break;
1345
1392
  }
1346
1393
  var extraPosition = map.getExtraPosition();
@@ -1396,6 +1443,7 @@ var Zoom = /** @class */ (function () {
1396
1443
  }
1397
1444
  else {
1398
1445
  map.mapScaleValue = value - delta;
1446
+ map.isReset = (map.mapScaleValue < 1) ? true : false;
1399
1447
  map.staticMapZoom = map.tileZoomLevel;
1400
1448
  if (map.mapScaleValue === 1) {
1401
1449
  map.markerCenterLatitude = null;
@@ -807,6 +807,8 @@ export function drawSymbols(shape, imageUrl, location, markerID, shapeCustom, ma
807
807
  var padding = 5;
808
808
  var rectOptions;
809
809
  var pathOptions = new PathOption(markerID, fill, borderWidth, borderColor, opacity, borderOpacity, dashArray, '');
810
+ size.width = typeof (size.width) === 'string' ? parseInt(size.width, 10) : size.width;
811
+ size.height = typeof (size.height) === 'string' ? parseInt(size.height, 10) : size.height;
810
812
  if (shape === 'Circle') {
811
813
  var radius = (size.width + size.height) / 4;
812
814
  var circleOptions = new CircleOption(markerID, fill, border, opacity, location.x, location.y, radius, dashArray);
@@ -2042,6 +2044,10 @@ export function getTranslate(mapObject, layer, animate) {
2042
2044
  }
2043
2045
  else {
2044
2046
  if (isNullOrUndefined(mapObject.previousProjection) || mapObject.previousProjection !== mapObject.projectionType) {
2047
+ if (mapHeight === 0 || mapWidth === 0 || mapHeight === mapWidth) {
2048
+ mapWidth = size.width / 2;
2049
+ mapHeight = size.height;
2050
+ }
2045
2051
  scaleFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));
2046
2052
  mapWidth *= scaleFactor;
2047
2053
  mapHeight *= scaleFactor;
@@ -2091,7 +2097,7 @@ export function getTranslate(mapObject, layer, animate) {
2091
2097
  mapObject.zoomTranslatePoint.y = y;
2092
2098
  }
2093
2099
  else {
2094
- if (!isNullOrUndefined(mapObject.previousProjection) && mapObject.mapScaleValue === 1 && !mapObject.zoomModule.isDragZoom) {
2100
+ if (!isNullOrUndefined(mapObject.previousProjection) && (mapObject.mapScaleValue === 1 || mapObject.mapScaleValue <= 1.05) && !mapObject.zoomModule.isDragZoom) {
2095
2101
  scaleFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));
2096
2102
  mapWidth *= scaleFactor;
2097
2103
  x = size.x + ((-(min['x'])) + ((size.width / 2) - (mapWidth / 2)));
@@ -2918,6 +2924,7 @@ export function changeBorderWidth(element, index, scale, maps) {
2918
2924
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2919
2925
  var borderWidthValue = maps.layersCollection[index].shapeSettings.borderWidthValuePath;
2920
2926
  var borderWidth = maps.layersCollection[index].shapeSettings.border.width;
2927
+ var circleRadius = maps.layersCollection[index].shapeSettings.circleRadius;
2921
2928
  if (maps.layersCollection[index].shapeSettings.borderWidthValuePath) {
2922
2929
  value = checkShapeDataFields(
2923
2930
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2938,8 +2945,8 @@ export function changeBorderWidth(element, index, scale, maps) {
2938
2945
  currentStroke = (isNullOrUndefined(borderWidth) ? 0 : borderWidth);
2939
2946
  }
2940
2947
  childNode.setAttribute('stroke-width', (currentStroke / scale).toString());
2941
- if (element.id.indexOf('_LineString') > -1 && isNullOrUndefined(currentStroke)) {
2942
- childNode.setAttribute('stroke-width', (1 / scale).toString());
2948
+ if (element.id.indexOf('_Point') > -1 || element.id.indexOf('_MultiPoint') > -1) {
2949
+ childNode.setAttribute('r', (circleRadius / scale).toString());
2943
2950
  }
2944
2951
  }
2945
2952
  }