@syncfusion/ej2-maps 21.2.4 → 21.2.10

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.
@@ -1046,10 +1046,10 @@ function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex, markerC
1046
1046
  var ele = drawSymbols(shapeCustom['shape'], shapeCustom['imageUrl'], { x: 0, y: 0 }, clusterID, shapeCustom, markerCollection, maps);
1047
1047
  ele.setAttribute('transform', 'translate( ' + tempX + ' ' + tempY + ' )');
1048
1048
  if (eventArg.shape === 'Balloon') {
1049
- ele.children[0].innerText = indexCollection.toString();
1049
+ ele.children[0].textContent = indexCollection.toString();
1050
1050
  }
1051
1051
  else {
1052
- ele.innerText = indexCollection.toString();
1052
+ ele.textContent = indexCollection.toString();
1053
1053
  }
1054
1054
  options = new TextOption(labelID, (0), postionY, 'middle', (colloideBounds.length + 1).toString(), '', '');
1055
1055
  textElement = renderTextElement(options, style, style.color, markerCollection);
@@ -1148,7 +1148,7 @@ function mergeSeparateCluster(sameMarkerData, maps, markerElement) {
1148
1148
  var markerEle;
1149
1149
  var markerDataLength = sameMarkerData[0].data.length;
1150
1150
  for (var i = 0; i < markerDataLength; i++) {
1151
- markerEle = marker.shape === 'Balloon' ? getElement(markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index'] + '_Group') : getElement(markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index']);
1151
+ markerEle = marker.shape === 'Balloon' && isNullOrUndefined(marker.template) ? getElement(markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index'] + '_Group') : getElement(markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index']);
1152
1152
  markerEle['style']['visibility'] = 'hidden';
1153
1153
  }
1154
1154
  removeElement(maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_' + markerIndex + '_markerClusterConnectorLine');
@@ -1177,7 +1177,7 @@ function clusterSeparate(sameMarkerData, maps, markerElement, isDom) {
1177
1177
  var clusterEleLabel = getElementFunction(getQueryConnect + '' + clusterId + '_datalabel_' + clusterIndex);
1178
1178
  clusterEle.setAttribute('visibility', 'hidden');
1179
1179
  clusterEleLabel.setAttribute('visibility', 'hidden');
1180
- var markerEle = marker.shape === 'Balloon' ? getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + dataIndex + '_Group') : getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + dataIndex);
1180
+ var markerEle = marker.shape === 'Balloon' && isNullOrUndefined(marker.template) ? getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + dataIndex + '_Group') : getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + dataIndex);
1181
1181
  var height = markerEle.parentElement.id.indexOf('Template_Group') > -1 ? markerEle.getBoundingClientRect().height : marker.height;
1182
1182
  var width = markerEle.parentElement.id.indexOf('Template_Group') > -1 ? markerEle.getBoundingClientRect().width : marker.width;
1183
1183
  var centerX = +clusterEle.getAttribute('transform').split('translate(')[1].trim().split(' ')[0];
@@ -1213,7 +1213,7 @@ function clusterSeparate(sameMarkerData, maps, markerElement, isDom) {
1213
1213
  var x1 = centerX + radius * Math.sin((Math.PI * 2 * newAngle) / 360);
1214
1214
  var y1 = centerY + radius * Math.cos((Math.PI * 2 * newAngle) / 360);
1215
1215
  path += start + 'L ' + (x1) + ' ' + y1 + ' ';
1216
- markerEle = marker.shape === 'Balloon' ? getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index'] + '_Group') : getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index']);
1216
+ markerEle = marker.shape === 'Balloon' && isNullOrUndefined(marker.template) ? getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index'] + '_Group') : getElementFunction(getQueryConnect + '' + markerId + '_dataIndex_' + sameMarkerData[0].data[i]['index']);
1217
1217
  if (markerEle.parentElement.id.indexOf('Template_Group') > -1) {
1218
1218
  markerEle['style']['transform'] = '';
1219
1219
  markerEle['style']['left'] = maps.isTileMap ? x1 - (width / 2) + 'px' : (x1 - (width / 2) - 10) + 'px';
@@ -5498,7 +5498,7 @@ var Marker = /** @__PURE__ @class */ (function () {
5498
5498
  if ((target.indexOf('_cluster_') > -1)) {
5499
5499
  var isClusterSame = false;
5500
5500
  var clusterElement = document.getElementById(target.indexOf('_datalabel_') > -1 ? layer.markerClusterSettings.shape === 'Balloon' ? target.split('_datalabel_')[0] + '_Group' : target.split('_datalabel_')[0] : layer.markerClusterSettings.shape === 'Balloon' ? target + '_Group' : target);
5501
- var indexes = layer.markerClusterSettings.shape === 'Balloon' ? clusterElement.children[0].innerText.split(',').map(Number) : clusterElement.innerText.split(',').map(Number);
5501
+ var indexes = layer.markerClusterSettings.shape === 'Balloon' ? clusterElement.children[0].textContent.split(',').map(Number) : clusterElement.textContent.split(',').map(Number);
5502
5502
  collection_1 = [];
5503
5503
  for (var _i = 0, indexes_1 = indexes; _i < indexes_1.length; _i++) {
5504
5504
  var i = indexes_1[_i];
@@ -7352,6 +7352,7 @@ var LayerPanel = /** @__PURE__ @class */ (function () {
7352
7352
  imgElement.setAttribute('width', '256px');
7353
7353
  imgElement.setAttribute('src', tile.src);
7354
7354
  imgElement.setAttribute('alt', _this.mapObject.getLocalizedLabel('ImageNotFound'));
7355
+ imgElement.style.setProperty('user-select', 'none');
7355
7356
  child.appendChild(imgElement);
7356
7357
  animateElement.appendChild(child);
7357
7358
  }
@@ -7362,6 +7363,7 @@ var LayerPanel = /** @__PURE__ @class */ (function () {
7362
7363
  imgElement.setAttribute('width', '256px');
7363
7364
  imgElement.setAttribute('src', tile.src);
7364
7365
  imgElement.setAttribute('alt', _this.mapObject.getLocalizedLabel('ImageNotFound'));
7366
+ imgElement.style.setProperty('user-select', 'none');
7365
7367
  var child = createElement('div', { id: mapId + '_tile_' + id });
7366
7368
  child.style.position = 'absolute';
7367
7369
  child.style.left = tile.left + 'px';
@@ -14380,93 +14382,103 @@ var Zoom = /** @__PURE__ @class */ (function () {
14380
14382
  var scale = map.previousScale = map.scale;
14381
14383
  var maxZoom = map.zoomSettings.maxZoom;
14382
14384
  var minZoom = map.zoomSettings.minZoom;
14383
- newZoomFactor = (minZoom > newZoomFactor && type === 'ZoomIn') ? minZoom + 1 : newZoomFactor;
14384
14385
  newZoomFactor = maxZoom >= newZoomFactor ? newZoomFactor : maxZoom;
14385
- var prevTilePoint = map.tileTranslatePoint;
14386
- if ((!map.isTileMap) && ((type === 'ZoomIn' ? newZoomFactor >= minZoom && newZoomFactor <= maxZoom : newZoomFactor >= minZoom)
14387
- || map.isReset)) {
14388
- var availSize = map.mapAreaRect;
14389
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14390
- var minBounds = map.baseMapRectBounds['min'];
14391
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14392
- var maxBounds = map.baseMapRectBounds['max'];
14393
- var mapTotalWidth = Math.abs(minBounds['x'] - maxBounds['x']);
14394
- var mapTotalHeight = Math.abs(minBounds['y'] - maxBounds['y']);
14395
- var translatePointX = void 0;
14396
- var translatePointY = void 0;
14397
- if (newZoomFactor < 1.2 && map.projectionType !== 'Eckert5') {
14398
- if (mapTotalWidth === 0 || mapTotalHeight === 0 || mapTotalWidth === mapTotalHeight) {
14399
- mapTotalWidth = availSize.width / 2;
14400
- mapTotalHeight = availSize.height;
14386
+ var isToolbarPerform = true;
14387
+ switch (type.toLowerCase()) {
14388
+ case 'zoomin':
14389
+ isToolbarPerform = newZoomFactor <= this.maps.zoomSettings.maxZoom;
14390
+ break;
14391
+ case 'zoomout':
14392
+ isToolbarPerform = newZoomFactor >= this.maps.zoomSettings.minZoom;
14393
+ break;
14394
+ }
14395
+ if (isToolbarPerform) {
14396
+ var prevTilePoint = map.tileTranslatePoint;
14397
+ if ((!map.isTileMap) && ((type === 'ZoomIn' ? newZoomFactor >= minZoom && newZoomFactor <= maxZoom : newZoomFactor >= minZoom)
14398
+ || map.isReset)) {
14399
+ var availSize = map.mapAreaRect;
14400
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14401
+ var minBounds = map.baseMapRectBounds['min'];
14402
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14403
+ var maxBounds = map.baseMapRectBounds['max'];
14404
+ var mapTotalWidth = Math.abs(minBounds['x'] - maxBounds['x']);
14405
+ var mapTotalHeight = Math.abs(minBounds['y'] - maxBounds['y']);
14406
+ var translatePointX = void 0;
14407
+ var translatePointY = void 0;
14408
+ if (newZoomFactor < 1.2 && map.projectionType !== 'Eckert5') {
14409
+ if (mapTotalWidth === 0 || mapTotalHeight === 0 || mapTotalWidth === mapTotalHeight) {
14410
+ mapTotalWidth = availSize.width / 2;
14411
+ mapTotalHeight = availSize.height;
14412
+ }
14413
+ newZoomFactor = parseFloat(Math.min(availSize.width / mapTotalWidth, availSize.height / mapTotalHeight).toFixed(2));
14414
+ newZoomFactor = newZoomFactor > 1.05 ? 1 : newZoomFactor;
14415
+ map.translatePoint = this.calculateInitalZoomTranslatePoint(newZoomFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map);
14416
+ }
14417
+ else {
14418
+ var point = map.translatePoint;
14419
+ translatePointX = point.x - (((availSize.width / scale) - (availSize.width / newZoomFactor)) / (availSize.width / position.x));
14420
+ translatePointY = point.y - (((availSize.height / scale) - (availSize.height / newZoomFactor)) / (availSize.height / position.y));
14421
+ var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * newZoomFactor;
14422
+ translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
14423
+ translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
14424
+ map.translatePoint = new Point(translatePointX, translatePointY);
14425
+ }
14426
+ map.scale = newZoomFactor;
14427
+ if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
14428
+ map.translatePoint = map.previousPoint;
14429
+ map.scale = map.mapScaleValue = map.previousScale;
14430
+ }
14431
+ else {
14432
+ this.applyTransform(map);
14401
14433
  }
14402
- newZoomFactor = parseFloat(Math.min(availSize.width / mapTotalWidth, availSize.height / mapTotalHeight).toFixed(2));
14403
- newZoomFactor = newZoomFactor > 1.05 ? 1 : newZoomFactor;
14404
- map.translatePoint = this.calculateInitalZoomTranslatePoint(newZoomFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map);
14405
- }
14406
- else {
14407
- var point = map.translatePoint;
14408
- translatePointX = point.x - (((availSize.width / scale) - (availSize.width / newZoomFactor)) / (availSize.width / position.x));
14409
- translatePointY = point.y - (((availSize.height / scale) - (availSize.height / newZoomFactor)) / (availSize.height / position.y));
14410
- var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * newZoomFactor;
14411
- translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
14412
- translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
14413
- map.translatePoint = new Point(translatePointX, translatePointY);
14414
- }
14415
- map.scale = newZoomFactor;
14416
- if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
14417
- map.translatePoint = map.previousPoint;
14418
- map.scale = map.mapScaleValue = map.previousScale;
14419
14434
  }
14420
- else {
14421
- this.applyTransform(map);
14422
- }
14423
- }
14424
- else if ((map.isTileMap) && (newZoomFactor >= minZoom && newZoomFactor <= maxZoom)) {
14425
- this.getTileTranslatePosition(prevLevel, newZoomFactor, position, type);
14426
- map.tileZoomLevel = newZoomFactor;
14427
- map.zoomSettings.zoomFactor = newZoomFactor;
14428
- map.scale = Math.pow(2, newZoomFactor - 1);
14429
- if (type === 'ZoomOut' && map.zoomSettings.resetToInitial && map.applyZoomReset && newZoomFactor <= map.initialZoomLevel) {
14430
- map.initialCheck = true;
14431
- map.zoomPersistence = false;
14432
- map.tileTranslatePoint.x = map.initialTileTranslate.x;
14433
- map.tileTranslatePoint.y = map.initialTileTranslate.y;
14434
- newZoomFactor = map.tileZoomLevel = map.mapScaleValue = map.initialZoomLevel;
14435
+ else if ((map.isTileMap) && (newZoomFactor >= minZoom && newZoomFactor <= maxZoom)) {
14436
+ this.getTileTranslatePosition(prevLevel, newZoomFactor, position, type);
14437
+ map.tileZoomLevel = newZoomFactor;
14438
+ map.zoomSettings.zoomFactor = newZoomFactor;
14435
14439
  map.scale = Math.pow(2, newZoomFactor - 1);
14436
- }
14437
- map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.mapScaleValue)) / map.scale;
14438
- map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.mapScaleValue)) / map.scale;
14439
- if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
14440
- map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
14441
- map.scale = map.previousScale;
14442
- map.tileZoomLevel = prevLevel;
14443
- map.zoomSettings.zoomFactor = map.previousScale;
14444
- }
14445
- else {
14446
- if (document.querySelector('.GroupElement')) {
14447
- document.querySelector('.GroupElement').style.display = 'none';
14448
- }
14449
- if (document.getElementById(this.maps.element.id + '_LayerIndex_1')) {
14450
- document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = 'none';
14451
- }
14452
- this.markerLineAnimation(map);
14453
- map.mapLayerPanel.generateTiles(newZoomFactor, map.tileTranslatePoint, type + 'wheel', null, position);
14454
- var element1 = document.getElementById(this.maps.element.id + '_tiles');
14455
- var animationDuration = this.maps.layersCollection[0].animationDuration;
14456
- setTimeout(function () {
14457
- // if (type === 'ZoomOut') {
14458
- // element1.removeChild(element1.children[element1.childElementCount - 1]);
14459
- // if (element1.childElementCount) {
14460
- // element1.removeChild(element1.children[element1.childElementCount - 1]);
14461
- // } else {
14462
- // element1 = element1;
14463
- // }
14464
- // }
14465
- _this.applyTransform(_this.maps);
14466
- if (document.getElementById(_this.maps.element.id + '_LayerIndex_1')) {
14467
- document.getElementById(_this.maps.element.id + '_LayerIndex_1').style.display = 'block';
14440
+ if (type === 'ZoomOut' && map.zoomSettings.resetToInitial && map.applyZoomReset && newZoomFactor <= map.initialZoomLevel) {
14441
+ map.initialCheck = true;
14442
+ map.zoomPersistence = false;
14443
+ map.tileTranslatePoint.x = map.initialTileTranslate.x;
14444
+ map.tileTranslatePoint.y = map.initialTileTranslate.y;
14445
+ newZoomFactor = map.tileZoomLevel = map.mapScaleValue = map.initialZoomLevel;
14446
+ map.scale = Math.pow(2, newZoomFactor - 1);
14447
+ }
14448
+ map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.mapScaleValue)) / map.scale;
14449
+ map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.mapScaleValue)) / map.scale;
14450
+ if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
14451
+ map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
14452
+ map.scale = map.previousScale;
14453
+ map.tileZoomLevel = prevLevel;
14454
+ map.zoomSettings.zoomFactor = map.previousScale;
14455
+ }
14456
+ else {
14457
+ if (document.querySelector('.GroupElement')) {
14458
+ document.querySelector('.GroupElement').style.display = 'none';
14468
14459
  }
14469
- }, animationDuration);
14460
+ if (document.getElementById(this.maps.element.id + '_LayerIndex_1')) {
14461
+ document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = 'none';
14462
+ }
14463
+ this.markerLineAnimation(map);
14464
+ map.mapLayerPanel.generateTiles(newZoomFactor, map.tileTranslatePoint, type + 'wheel', null, position);
14465
+ var element1 = document.getElementById(this.maps.element.id + '_tiles');
14466
+ var animationDuration = this.maps.layersCollection[0].animationDuration;
14467
+ setTimeout(function () {
14468
+ // if (type === 'ZoomOut') {
14469
+ // element1.removeChild(element1.children[element1.childElementCount - 1]);
14470
+ // if (element1.childElementCount) {
14471
+ // element1.removeChild(element1.children[element1.childElementCount - 1]);
14472
+ // } else {
14473
+ // element1 = element1;
14474
+ // }
14475
+ // }
14476
+ _this.applyTransform(_this.maps);
14477
+ if (document.getElementById(_this.maps.element.id + '_LayerIndex_1')) {
14478
+ document.getElementById(_this.maps.element.id + '_LayerIndex_1').style.display = 'block';
14479
+ }
14480
+ }, animationDuration);
14481
+ }
14470
14482
  }
14471
14483
  }
14472
14484
  this.maps.zoomNotApplied = false;
@@ -15632,11 +15644,23 @@ var Zoom = /** @__PURE__ @class */ (function () {
15632
15644
  e.stopImmediatePropagation();
15633
15645
  var isTouch = e.pointerType === 'touch' || e.pointerType === '2' || (e.type.indexOf('touch') > -1);
15634
15646
  var toolbar = target.id.split('_Zooming_ToolBar_')[1].split('_')[0];
15635
- if (isTouch) {
15647
+ var isToolbarPerform = true;
15648
+ switch (toolbar.toLowerCase()) {
15649
+ case 'zoomin':
15650
+ isToolbarPerform = (this.maps.isTileMap ? this.maps.tileZoomLevel : this.maps.scale) + 1 <= this.maps.zoomSettings.maxZoom;
15651
+ break;
15652
+ case 'zoomout':
15653
+ isToolbarPerform = (this.maps.isTileMap ? this.maps.tileZoomLevel : this.maps.scale) - 1 >= this.maps.zoomSettings.minZoom;
15654
+ break;
15655
+ case 'reset':
15656
+ isToolbarPerform = Math.round(this.maps.isTileMap ? this.maps.tileZoomLevel : this.maps.scale) != this.maps.zoomSettings.minZoom;
15657
+ break;
15658
+ }
15659
+ if (isTouch && isToolbarPerform) {
15636
15660
  this.handled = true;
15637
15661
  this.performZoomingByToolBar(toolbar);
15638
15662
  }
15639
- else if ((e.type === 'mousedown' || e.type === 'pointerdown') && !this.handled) {
15663
+ else if ((e.type === 'mousedown' || e.type === 'pointerdown') && !this.handled && isToolbarPerform) {
15640
15664
  this.handled = false;
15641
15665
  this.performZoomingByToolBar(toolbar);
15642
15666
  }