@syncfusion/ej2-maps 24.2.9 → 25.1.35
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.
- package/CHANGELOG.md +12 -2
- package/dist/ej2-maps.min.js +2 -2
- package/dist/ej2-maps.umd.min.js +2 -2
- package/dist/ej2-maps.umd.min.js.map +1 -1
- package/dist/es6/ej2-maps.es2015.js +646 -331
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +660 -346
- package/dist/es6/ej2-maps.es5.js.map +1 -1
- package/dist/global/ej2-maps.min.js +2 -2
- package/dist/global/ej2-maps.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/maps/layers/bubble.js +2 -3
- package/src/maps/layers/color-mapping.d.ts +0 -1
- package/src/maps/layers/color-mapping.js +0 -1
- package/src/maps/layers/data-label.js +19 -17
- package/src/maps/layers/layer-panel.js +13 -7
- package/src/maps/layers/legend.js +11 -3
- package/src/maps/layers/marker.d.ts +4 -0
- package/src/maps/layers/marker.js +16 -13
- package/src/maps/layers/polygon.d.ts +0 -1
- package/src/maps/layers/polygon.js +1 -4
- package/src/maps/maps-model.d.ts +14 -0
- package/src/maps/maps.d.ts +14 -2
- package/src/maps/maps.js +118 -46
- package/src/maps/model/base-model.d.ts +51 -0
- package/src/maps/model/base.d.ts +43 -1
- package/src/maps/model/base.js +32 -0
- package/src/maps/model/constants.d.ts +12 -0
- package/src/maps/model/constants.js +12 -0
- package/src/maps/model/interface.d.ts +8 -0
- package/src/maps/user-interaction/tooltip.js +151 -110
- package/src/maps/user-interaction/zoom.d.ts +3 -5
- package/src/maps/user-interaction/zoom.js +198 -106
- package/src/maps/utils/helper.d.ts +7 -1
- package/src/maps/utils/helper.js +89 -37
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -72
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -49
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
609
|
-
|
|
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
|
-
|
|
613
|
-
maps.zoomShapeCollection.push(
|
|
614
|
-
|
|
615
|
-
|
|
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[
|
|
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
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
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
|
-
|
|
860
|
-
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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 <
|
|
892
|
-
if (!isNullOrUndefined(
|
|
893
|
-
if (textLocations['leftWidth'] >
|
|
894
|
-
|| textLocations['rightWidth'] <
|
|
895
|
-
|| textLocations['heightTop'] >
|
|
896
|
-
|| textLocations['heightBottom'] <
|
|
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
|
-
|
|
944
|
+
intersect.push(textLocations);
|
|
908
945
|
}
|
|
909
946
|
if (this.maps.layers[this.index].dataLabelSettings.intersectionAction === 'Trim') {
|
|
910
|
-
for (var j = 0; j <
|
|
911
|
-
if (!isNullOrUndefined(
|
|
912
|
-
if (textLocations['rightWidth'] <
|
|
913
|
-
|| textLocations['leftWidth'] >
|
|
914
|
-
|| textLocations['heightBottom'] <
|
|
915
|
-
|| textLocations['heightTop'] >
|
|
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
|
-
|
|
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'] >
|
|
924
|
-
var width =
|
|
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
|
-
|
|
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'] <
|
|
932
|
-
var width = textLocations['rightWidth'] -
|
|
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
|
-
|
|
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
|
-
|
|
982
|
+
intersect.push(textLocations);
|
|
943
983
|
if (isNullOrUndefined(trimmedLable)) {
|
|
944
|
-
trimmedLable = textTrim((this.maps.dataLabelShape[
|
|
984
|
+
trimmedLable = textTrim((this.maps.dataLabelShape[index] * scale), zoomtext, style, zoomtextSize.width, true);
|
|
945
985
|
element.textContent = trimmedLable;
|
|
946
986
|
}
|
|
947
987
|
}
|
|
948
|
-
|
|
949
|
-
|
|
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;
|
|
@@ -1132,7 +1172,7 @@ 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);
|
|
1136
1176
|
}
|
|
1137
1177
|
map.zoomTranslatePoint = map.translatePoint;
|
|
1138
1178
|
this.mouseDownPoints = this.mouseMovePoints;
|
|
@@ -1257,6 +1297,7 @@ var Zoom = /** @class */ (function () {
|
|
|
1257
1297
|
}
|
|
1258
1298
|
this.maps.zoomNotApplied = false;
|
|
1259
1299
|
}
|
|
1300
|
+
this.triggerZoomComplete(map, prevLevel, type);
|
|
1260
1301
|
};
|
|
1261
1302
|
/**
|
|
1262
1303
|
* @private
|
|
@@ -1548,7 +1589,7 @@ var Zoom = /** @class */ (function () {
|
|
|
1548
1589
|
};
|
|
1549
1590
|
Zoom.prototype.panningStyle = function (toolbar) {
|
|
1550
1591
|
var svg = getElementByID(this.maps.element.id + '_svg');
|
|
1551
|
-
if (toolbar === 'pan' || (this.
|
|
1592
|
+
if (toolbar === 'pan' || (this.isPanModeEnabled && toolbar !== 'reset')) {
|
|
1552
1593
|
svg.setAttribute('class', 'e-maps-panning');
|
|
1553
1594
|
}
|
|
1554
1595
|
else {
|
|
@@ -1895,8 +1936,8 @@ var Zoom = /** @class */ (function () {
|
|
|
1895
1936
|
this.isTouch = true;
|
|
1896
1937
|
touches = e.touches;
|
|
1897
1938
|
target = e.target;
|
|
1898
|
-
pageX = touches[0].
|
|
1899
|
-
pageY = touches[0].
|
|
1939
|
+
pageX = touches[0].pageX;
|
|
1940
|
+
pageY = touches[0].pageY;
|
|
1900
1941
|
}
|
|
1901
1942
|
else {
|
|
1902
1943
|
pageX = e.pageX;
|
|
@@ -1904,11 +1945,11 @@ var Zoom = /** @class */ (function () {
|
|
|
1904
1945
|
target = e.target;
|
|
1905
1946
|
}
|
|
1906
1947
|
if (!this.maps.zoomSettings.enablePanning) {
|
|
1907
|
-
this.isPan = this.
|
|
1948
|
+
this.isPan = this.isPanModeEnabled = this.panColor !== this.selectionColor ? this.maps.zoomSettings.enablePanning
|
|
1908
1949
|
: this.zoomColor === this.selectionColor;
|
|
1909
1950
|
}
|
|
1910
1951
|
else {
|
|
1911
|
-
this.isPan = this.
|
|
1952
|
+
this.isPan = this.isPanModeEnabled = !this.isZoomSelection;
|
|
1912
1953
|
}
|
|
1913
1954
|
this.mouseDownLatLong = { x: pageX, y: pageY };
|
|
1914
1955
|
var scale = this.maps.isTileMap ? Math.round(this.maps.tileZoomLevel) : Math.round(this.maps.mapScaleValue);
|
|
@@ -1936,8 +1977,8 @@ var Zoom = /** @class */ (function () {
|
|
|
1936
1977
|
this.isTouch = true;
|
|
1937
1978
|
target = e.target;
|
|
1938
1979
|
touches = e.touches;
|
|
1939
|
-
pageX = touches[0].
|
|
1940
|
-
pageY = touches[0].
|
|
1980
|
+
pageX = touches[0].pageX;
|
|
1981
|
+
pageY = touches[0].pageY;
|
|
1941
1982
|
}
|
|
1942
1983
|
else {
|
|
1943
1984
|
pageX = e.pageX;
|
|
@@ -1971,7 +2012,7 @@ var Zoom = /** @class */ (function () {
|
|
|
1971
2012
|
this.mouseMovePoints = this.getMousePosition(pageX, pageY);
|
|
1972
2013
|
var targetId = e.target['id'];
|
|
1973
2014
|
var targetEle = e.target;
|
|
1974
|
-
if (zoom.enable && this.
|
|
2015
|
+
if (zoom.enable && this.isPanModeEnabled && this.maps.markerDragId.indexOf('_MarkerIndex_') == -1 && ((Browser.isDevice && touches.length >= 1) || !Browser.isDevice)) {
|
|
1975
2016
|
e.preventDefault();
|
|
1976
2017
|
this.maps.element.style.cursor = 'pointer';
|
|
1977
2018
|
this.mouseMoveLatLong = { x: pageX, y: pageY };
|
|
@@ -2002,13 +2043,66 @@ var Zoom = /** @class */ (function () {
|
|
|
2002
2043
|
var isDragZoom;
|
|
2003
2044
|
var map = this.maps;
|
|
2004
2045
|
this.rectZoomingStart = false;
|
|
2005
|
-
this.isPanning = false;
|
|
2006
2046
|
this.isSingleClick = this.isSingleClick ? true : false;
|
|
2007
2047
|
this.isTouch = false;
|
|
2008
2048
|
this.touchStartList = [];
|
|
2009
2049
|
this.touchMoveList = [];
|
|
2010
2050
|
this.lastScale = 1;
|
|
2011
2051
|
this.maps.element.style.cursor = 'auto';
|
|
2052
|
+
// eslint-disable-next-line max-len
|
|
2053
|
+
if (this.isPanModeEnabled && this.maps.zoomSettings.enablePanning && !isNullOrUndefined(this.maps.previousPoint) &&
|
|
2054
|
+
(this.maps.translatePoint.x !== this.maps.previousPoint.x && this.maps.translatePoint.y !== this.maps.previousPoint.y)) {
|
|
2055
|
+
var pageX = void 0;
|
|
2056
|
+
var pageY = void 0;
|
|
2057
|
+
var layerX = 0;
|
|
2058
|
+
var layerY = 0;
|
|
2059
|
+
var target = void 0;
|
|
2060
|
+
var rect = this.maps.element.getBoundingClientRect();
|
|
2061
|
+
var element = e.target;
|
|
2062
|
+
if (e.type.indexOf('touch') !== -1) {
|
|
2063
|
+
var touchArg = e;
|
|
2064
|
+
layerX = pageX = touchArg.changedTouches[0].pageX;
|
|
2065
|
+
pageY = touchArg.changedTouches[0].pageY;
|
|
2066
|
+
layerY = pageY - (this.maps.isTileMap ? 10 : 0);
|
|
2067
|
+
target = touchArg.target;
|
|
2068
|
+
this.maps.mouseClickEvent = { x: pageX, y: pageY };
|
|
2069
|
+
}
|
|
2070
|
+
else {
|
|
2071
|
+
pageX = e.pageX;
|
|
2072
|
+
pageY = e.pageY;
|
|
2073
|
+
layerX = e['layerX'];
|
|
2074
|
+
layerY = e['layerY'] - (this.maps.isTileMap ? 10 : 0);
|
|
2075
|
+
target = e.target;
|
|
2076
|
+
}
|
|
2077
|
+
var panCompleteEventArgs = void 0;
|
|
2078
|
+
var minMaxLatitudeLongitude = this.maps.getMinMaxLatitudeLongitude();
|
|
2079
|
+
if (!this.maps.isTileMap) {
|
|
2080
|
+
this.maps.mouseClickEvent['x'] = this.maps.mouseDownEvent['x'];
|
|
2081
|
+
this.maps.mouseClickEvent['y'] = this.maps.mouseDownEvent['y'];
|
|
2082
|
+
var location_5 = this.maps.getClickLocation(element.id, pageX, pageY, element, pageX, pageY);
|
|
2083
|
+
panCompleteEventArgs = {
|
|
2084
|
+
cancel: false, name: 'panComplete', maps: this.maps,
|
|
2085
|
+
tileTranslatePoint: {}, translatePoint: { previous: this.maps.previousPoint, current: this.maps.translatePoint },
|
|
2086
|
+
scale: this.maps.scale, tileZoomLevel: this.maps.tileZoomLevel, latitude: !isNullOrUndefined(location_5) ?
|
|
2087
|
+
location_5.latitude : 0, longitude: !isNullOrUndefined(location_5) ? location_5.longitude : 0,
|
|
2088
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
2089
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
2090
|
+
};
|
|
2091
|
+
}
|
|
2092
|
+
else {
|
|
2093
|
+
var location_6 = this.maps.getTileGeoLocation(layerX, layerY);
|
|
2094
|
+
panCompleteEventArgs = {
|
|
2095
|
+
cancel: false, name: 'panComplete', maps: this.maps,
|
|
2096
|
+
tileTranslatePoint: { previous: this.maps.tileTranslatePoint, current: this.maps.tileTranslatePoint },
|
|
2097
|
+
translatePoint: { previous: this.maps.previousPoint, current: this.maps.translatePoint }, scale: this.maps.scale,
|
|
2098
|
+
tileZoomLevel: this.maps.tileZoomLevel, latitude: location_6.latitude, longitude: location_6.longitude,
|
|
2099
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
2100
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
this.maps.trigger('panComplete', panCompleteEventArgs);
|
|
2104
|
+
}
|
|
2105
|
+
this.isPanModeEnabled = false;
|
|
2012
2106
|
if ((!isNullOrUndefined(this.distanceX) || !isNullOrUndefined(this.distanceY)) && (!isNullOrUndefined(this.currentLayer) && this.currentLayer.type === 'SubLayer')) {
|
|
2013
2107
|
this.toAlignSublayer();
|
|
2014
2108
|
this.distanceX = this.distanceY = null;
|
|
@@ -2026,7 +2120,7 @@ var Zoom = /** @class */ (function () {
|
|
|
2026
2120
|
* @private
|
|
2027
2121
|
*/
|
|
2028
2122
|
Zoom.prototype.mouseCancelHandler = function (e) {
|
|
2029
|
-
this.
|
|
2123
|
+
this.isPanModeEnabled = false;
|
|
2030
2124
|
this.isTouch = false;
|
|
2031
2125
|
this.rectZoomingStart = false;
|
|
2032
2126
|
var zoomRectElement = getElementByID(this.maps.element.id + '_Selection_Rect_Zooming');
|
|
@@ -2106,7 +2200,7 @@ var Zoom = /** @class */ (function () {
|
|
|
2106
2200
|
this.maps.off(Browser.touchMoveEvent, this.mouseMoveHandler);
|
|
2107
2201
|
this.maps.off(Browser.touchStartEvent, this.mouseDownHandler);
|
|
2108
2202
|
this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
|
|
2109
|
-
this.maps.
|
|
2203
|
+
EventHandler.remove(this.maps.element, this.cancelEvent, this.mouseCancelHandler);
|
|
2110
2204
|
};
|
|
2111
2205
|
/**
|
|
2112
2206
|
* Get module name.
|
|
@@ -2135,14 +2229,12 @@ var Zoom = /** @class */ (function () {
|
|
|
2135
2229
|
this.mouseDownPoints = null;
|
|
2136
2230
|
this.mouseMovePoints = null;
|
|
2137
2231
|
this.startTouches = [];
|
|
2138
|
-
this.zoomshapewidth = null;
|
|
2139
|
-
this.intersect = [];
|
|
2140
2232
|
this.mouseDownLatLong = null;
|
|
2141
2233
|
this.mouseMoveLatLong = null;
|
|
2142
2234
|
this.removeEventListener();
|
|
2143
|
-
|
|
2144
|
-
//this.maps = null;
|
|
2235
|
+
this.layerCollectionEle = null;
|
|
2145
2236
|
this.currentLayer = null;
|
|
2237
|
+
this.maps = null;
|
|
2146
2238
|
};
|
|
2147
2239
|
return Zoom;
|
|
2148
2240
|
}());
|
|
@@ -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
|
*
|