@syncfusion/ej2-maps 20.1.47 → 20.1.59
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 +17 -1
- 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 +128 -62
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +130 -64
- 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 +12 -12
- package/src/maps/maps.js +9 -1
- package/src/maps/model/export-image.js +7 -4
- package/src/maps/model/export-pdf.js +6 -4
- package/src/maps/user-interaction/zoom.js +111 -58
|
@@ -6908,6 +6908,10 @@ let Maps = class Maps extends Component {
|
|
|
6908
6908
|
* Resize the map
|
|
6909
6909
|
*/
|
|
6910
6910
|
this.isResize = false;
|
|
6911
|
+
/**
|
|
6912
|
+
* @private
|
|
6913
|
+
*/
|
|
6914
|
+
this.isReset = false;
|
|
6911
6915
|
/** @private */
|
|
6912
6916
|
this.baseSize = new Size(0, 0);
|
|
6913
6917
|
/** @public */
|
|
@@ -8163,6 +8167,7 @@ let Maps = class Maps extends Component {
|
|
|
8163
8167
|
this.refreshing = true;
|
|
8164
8168
|
this.wireEVents();
|
|
8165
8169
|
this.render();
|
|
8170
|
+
this.refreshing = false;
|
|
8166
8171
|
}, 500);
|
|
8167
8172
|
}
|
|
8168
8173
|
}
|
|
@@ -8557,7 +8562,10 @@ let Maps = class Maps extends Component {
|
|
|
8557
8562
|
if (!isNullOrUndefined(newProp.layers[x])) {
|
|
8558
8563
|
const collection = Object.keys(newProp.layers[x]);
|
|
8559
8564
|
for (const collectionProp of collection) {
|
|
8560
|
-
if (collectionProp === '
|
|
8565
|
+
if (collectionProp === 'layerType' && newProp.layers[x].layerType === 'OSM') {
|
|
8566
|
+
this.isReset = true;
|
|
8567
|
+
}
|
|
8568
|
+
else if (collectionProp === 'markerSettings') {
|
|
8561
8569
|
isMarker = true;
|
|
8562
8570
|
}
|
|
8563
8571
|
else if (collectionProp === 'staticMapType') {
|
|
@@ -12952,8 +12960,13 @@ class Zoom {
|
|
|
12952
12960
|
translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
|
|
12953
12961
|
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
12954
12962
|
map.scale = newZoomFactor;
|
|
12955
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, type)
|
|
12956
|
-
|
|
12963
|
+
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
12964
|
+
map.translatePoint = map.previousPoint;
|
|
12965
|
+
map.scale = map.previousScale;
|
|
12966
|
+
}
|
|
12967
|
+
else {
|
|
12968
|
+
this.applyTransform();
|
|
12969
|
+
}
|
|
12957
12970
|
}
|
|
12958
12971
|
else if ((map.isTileMap) && (newZoomFactor >= minZoom && newZoomFactor <= maxZoom)) {
|
|
12959
12972
|
this.getTileTranslatePosition(prevLevel, newZoomFactor, position, type);
|
|
@@ -12970,31 +12983,38 @@ class Zoom {
|
|
|
12970
12983
|
}
|
|
12971
12984
|
map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.mapScaleValue)) / map.scale;
|
|
12972
12985
|
map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.mapScaleValue)) / map.scale;
|
|
12973
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, type)
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = 'none';
|
|
12986
|
+
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
12987
|
+
map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
|
|
12988
|
+
map.scale = map.previousScale;
|
|
12989
|
+
map.tileZoomLevel = prevLevel;
|
|
12990
|
+
map.zoomSettings.zoomFactor = map.previousScale;
|
|
12979
12991
|
}
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
|
|
12984
|
-
setTimeout(() => {
|
|
12985
|
-
// if (type === 'ZoomOut') {
|
|
12986
|
-
// element1.removeChild(element1.children[element1.childElementCount - 1]);
|
|
12987
|
-
// if (element1.childElementCount) {
|
|
12988
|
-
// element1.removeChild(element1.children[element1.childElementCount - 1]);
|
|
12989
|
-
// } else {
|
|
12990
|
-
// element1 = element1;
|
|
12991
|
-
// }
|
|
12992
|
-
// }
|
|
12993
|
-
this.applyTransform();
|
|
12992
|
+
else {
|
|
12993
|
+
if (document.querySelector('.GroupElement')) {
|
|
12994
|
+
document.querySelector('.GroupElement').style.display = 'none';
|
|
12995
|
+
}
|
|
12994
12996
|
if (document.getElementById(this.maps.element.id + '_LayerIndex_1')) {
|
|
12995
|
-
document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = '
|
|
12997
|
+
document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = 'none';
|
|
12996
12998
|
}
|
|
12997
|
-
|
|
12999
|
+
this.markerLineAnimation(map);
|
|
13000
|
+
map.mapLayerPanel.generateTiles(newZoomFactor, map.tileTranslatePoint, type + 'wheel', null, position);
|
|
13001
|
+
const element1 = document.getElementById(this.maps.element.id + '_tiles');
|
|
13002
|
+
const animationDuration = this.maps.layersCollection[0].animationDuration;
|
|
13003
|
+
setTimeout(() => {
|
|
13004
|
+
// if (type === 'ZoomOut') {
|
|
13005
|
+
// element1.removeChild(element1.children[element1.childElementCount - 1]);
|
|
13006
|
+
// if (element1.childElementCount) {
|
|
13007
|
+
// element1.removeChild(element1.children[element1.childElementCount - 1]);
|
|
13008
|
+
// } else {
|
|
13009
|
+
// element1 = element1;
|
|
13010
|
+
// }
|
|
13011
|
+
// }
|
|
13012
|
+
this.applyTransform();
|
|
13013
|
+
if (document.getElementById(this.maps.element.id + '_LayerIndex_1')) {
|
|
13014
|
+
document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = 'block';
|
|
13015
|
+
}
|
|
13016
|
+
}, animationDuration);
|
|
13017
|
+
}
|
|
12998
13018
|
}
|
|
12999
13019
|
this.maps.zoomNotApplied = false;
|
|
13000
13020
|
}
|
|
@@ -13016,6 +13036,7 @@ class Zoom {
|
|
|
13016
13036
|
};
|
|
13017
13037
|
}
|
|
13018
13038
|
map.trigger('zoom', zoomArgs);
|
|
13039
|
+
return zoomArgs.cancel;
|
|
13019
13040
|
}
|
|
13020
13041
|
getTileTranslatePosition(prevLevel, currentLevel, position, type) {
|
|
13021
13042
|
const map = this.maps;
|
|
@@ -13041,6 +13062,7 @@ class Zoom {
|
|
|
13041
13062
|
const zoomRect = this.zoomingRect;
|
|
13042
13063
|
const maxZoom = map.zoomSettings.maxZoom;
|
|
13043
13064
|
const minZoom = map.zoomSettings.minZoom;
|
|
13065
|
+
let isZoomCancelled;
|
|
13044
13066
|
if (zoomRect.height > 0 && zoomRect.width > 0) {
|
|
13045
13067
|
const x = this.zoomingRect.x + (this.zoomingRect.width / 2);
|
|
13046
13068
|
const y = this.zoomingRect.y + (this.zoomingRect.height / 2);
|
|
@@ -13053,7 +13075,11 @@ class Zoom {
|
|
|
13053
13075
|
const translatePointY = translatePoint.y - (((size.height / scale) - (size.height / zoomCalculationFactor)) / (size.height / y));
|
|
13054
13076
|
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
13055
13077
|
map.scale = zoomCalculationFactor;
|
|
13056
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13078
|
+
isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13079
|
+
if (isZoomCancelled) {
|
|
13080
|
+
map.translatePoint = map.previousPoint;
|
|
13081
|
+
map.scale = map.previousScale;
|
|
13082
|
+
}
|
|
13057
13083
|
}
|
|
13058
13084
|
else {
|
|
13059
13085
|
zoomCalculationFactor = prevLevel + (Math.round(prevLevel + (((size.width / zoomRect.width) + (size.height / zoomRect.height)) / 2)));
|
|
@@ -13066,13 +13092,21 @@ class Zoom {
|
|
|
13066
13092
|
map.translatePoint.y = (map.tileTranslatePoint.y - (0.5 * Math.pow(2, zoomCalculationFactor))) /
|
|
13067
13093
|
(Math.pow(2, zoomCalculationFactor));
|
|
13068
13094
|
map.scale = (Math.pow(2, zoomCalculationFactor));
|
|
13069
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13070
|
-
|
|
13095
|
+
isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13096
|
+
if (isZoomCancelled) {
|
|
13097
|
+
map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
|
|
13098
|
+
map.scale = map.tileZoomLevel = map.zoomSettings.zoomFactor = prevLevel;
|
|
13099
|
+
}
|
|
13100
|
+
else {
|
|
13101
|
+
map.mapLayerPanel.generateTiles(zoomCalculationFactor, map.tileTranslatePoint);
|
|
13102
|
+
}
|
|
13103
|
+
}
|
|
13104
|
+
if (!isZoomCancelled) {
|
|
13105
|
+
map.mapScaleValue = zoomCalculationFactor;
|
|
13106
|
+
this.applyTransform(true);
|
|
13107
|
+
this.maps.zoomNotApplied = false;
|
|
13108
|
+
this.zoomingRect = null;
|
|
13071
13109
|
}
|
|
13072
|
-
map.mapScaleValue = zoomCalculationFactor;
|
|
13073
|
-
this.applyTransform(true);
|
|
13074
|
-
this.maps.zoomNotApplied = false;
|
|
13075
|
-
this.zoomingRect = null;
|
|
13076
13110
|
}
|
|
13077
13111
|
}
|
|
13078
13112
|
setInteraction(newInteraction) {
|
|
@@ -13101,6 +13135,7 @@ class Zoom {
|
|
|
13101
13135
|
this.pinchFactor *= newScale;
|
|
13102
13136
|
this.pinchFactor = Math.min(this.maps.zoomSettings.maxZoom, Math.max(this.pinchFactor, this.maps.zoomSettings.minZoom));
|
|
13103
13137
|
const zoomCalculationFactor = this.pinchFactor;
|
|
13138
|
+
let isZoomCancelled;
|
|
13104
13139
|
if (!map.isTileMap) {
|
|
13105
13140
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13106
13141
|
const minBounds = map.baseMapRectBounds['min'];
|
|
@@ -13116,7 +13151,11 @@ class Zoom {
|
|
|
13116
13151
|
translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
|
|
13117
13152
|
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
13118
13153
|
map.scale = zoomCalculationFactor;
|
|
13119
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13154
|
+
isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13155
|
+
if (isZoomCancelled) {
|
|
13156
|
+
map.translatePoint = map.previousPoint;
|
|
13157
|
+
map.scale = map.previousScale;
|
|
13158
|
+
}
|
|
13120
13159
|
}
|
|
13121
13160
|
else {
|
|
13122
13161
|
const newTileFactor = zoomCalculationFactor;
|
|
@@ -13127,10 +13166,20 @@ class Zoom {
|
|
|
13127
13166
|
map.translatePoint.y = (map.tileTranslatePoint.y - (0.5 * Math.pow(2, newTileFactor))) /
|
|
13128
13167
|
(Math.pow(2, newTileFactor));
|
|
13129
13168
|
map.scale = (Math.pow(2, newTileFactor));
|
|
13130
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13131
|
-
|
|
13169
|
+
isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
13170
|
+
if (isZoomCancelled) {
|
|
13171
|
+
map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
|
|
13172
|
+
map.scale = map.previousScale;
|
|
13173
|
+
map.tileZoomLevel = prevLevel;
|
|
13174
|
+
map.zoomSettings.zoomFactor = map.previousScale;
|
|
13175
|
+
}
|
|
13176
|
+
else {
|
|
13177
|
+
map.mapLayerPanel.generateTiles(newTileFactor, map.tileTranslatePoint);
|
|
13178
|
+
}
|
|
13179
|
+
}
|
|
13180
|
+
if (!isZoomCancelled) {
|
|
13181
|
+
this.applyTransform();
|
|
13132
13182
|
}
|
|
13133
|
-
this.applyTransform();
|
|
13134
13183
|
}
|
|
13135
13184
|
drawZoomRectangle() {
|
|
13136
13185
|
const map = this.maps;
|
|
@@ -13836,8 +13885,13 @@ class Zoom {
|
|
|
13836
13885
|
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
13837
13886
|
map.zoomTranslatePoint = map.translatePoint;
|
|
13838
13887
|
map.scale = zoomFactor;
|
|
13839
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, type)
|
|
13840
|
-
|
|
13888
|
+
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
13889
|
+
map.translatePoint = map.zoomTranslatePoint = map.previousPoint;
|
|
13890
|
+
map.scale = map.previousScale;
|
|
13891
|
+
}
|
|
13892
|
+
else {
|
|
13893
|
+
this.applyTransform(true);
|
|
13894
|
+
}
|
|
13841
13895
|
}
|
|
13842
13896
|
else if ((map.isTileMap) && ((zoomFactor >= minZoom && zoomFactor <= maxZoom) || map.isReset)) {
|
|
13843
13897
|
let tileZoomFactor = prevLevel < minZoom && !map.isReset ? minZoom : zoomFactor;
|
|
@@ -13854,25 +13908,32 @@ class Zoom {
|
|
|
13854
13908
|
map.tileTranslatePoint.y = map.initialTileTranslate.y;
|
|
13855
13909
|
tileZoomFactor = map.tileZoomLevel = map.mapScaleValue = map.initialZoomLevel;
|
|
13856
13910
|
}
|
|
13857
|
-
this.triggerZoomEvent(prevTilePoint, prevLevel, type)
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
}
|
|
13863
|
-
if (document.querySelector('.GroupElement')) {
|
|
13864
|
-
document.querySelector('.GroupElement').style.display = 'none';
|
|
13911
|
+
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
13912
|
+
map.translatePoint = map.tileTranslatePoint = new Point(0, 0);
|
|
13913
|
+
map.scale = map.previousScale;
|
|
13914
|
+
map.tileZoomLevel = prevLevel;
|
|
13915
|
+
map.zoomSettings.zoomFactor = map.previousScale;
|
|
13865
13916
|
}
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
const animationDuration = this.maps.layersCollection[0].animationDuration;
|
|
13870
|
-
setTimeout(() => {
|
|
13871
|
-
this.applyTransform(true);
|
|
13917
|
+
else {
|
|
13918
|
+
map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.mapScaleValue)) / map.scale;
|
|
13919
|
+
map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.mapScaleValue)) / map.scale;
|
|
13872
13920
|
if (document.getElementById(this.maps.element.id + '_LayerIndex_1')) {
|
|
13873
|
-
document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = '
|
|
13921
|
+
document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = 'none';
|
|
13874
13922
|
}
|
|
13875
|
-
|
|
13923
|
+
if (document.querySelector('.GroupElement')) {
|
|
13924
|
+
document.querySelector('.GroupElement').style.display = 'none';
|
|
13925
|
+
}
|
|
13926
|
+
this.markerLineAnimation(map);
|
|
13927
|
+
map.mapLayerPanel.generateTiles(tileZoomFactor, map.tileTranslatePoint, type);
|
|
13928
|
+
const element1 = document.getElementById(this.maps.element.id + '_tiles');
|
|
13929
|
+
const animationDuration = this.maps.layersCollection[0].animationDuration;
|
|
13930
|
+
setTimeout(() => {
|
|
13931
|
+
this.applyTransform(true);
|
|
13932
|
+
if (document.getElementById(this.maps.element.id + '_LayerIndex_1')) {
|
|
13933
|
+
document.getElementById(this.maps.element.id + '_LayerIndex_1').style.display = 'block';
|
|
13934
|
+
}
|
|
13935
|
+
}, animationDuration);
|
|
13936
|
+
}
|
|
13876
13937
|
}
|
|
13877
13938
|
this.maps.zoomNotApplied = false;
|
|
13878
13939
|
}
|
|
@@ -14641,6 +14702,9 @@ class ImageExport {
|
|
|
14641
14702
|
image.src = url;
|
|
14642
14703
|
}
|
|
14643
14704
|
else {
|
|
14705
|
+
const svgParentElement = document.getElementById(this.control.element.id + '_MapAreaBorder');
|
|
14706
|
+
let top = parseFloat(svgParentElement.getAttribute('y'));
|
|
14707
|
+
let left = parseFloat(svgParentElement.getAttribute('x'));
|
|
14644
14708
|
const imgxHttp = new XMLHttpRequest();
|
|
14645
14709
|
const imgTileLength = this.control.mapLayerPanel.tiles.length;
|
|
14646
14710
|
for (let i = 0; i <= imgTileLength + 1; i++) {
|
|
@@ -14659,17 +14723,17 @@ class ImageExport {
|
|
|
14659
14723
|
if (i === 0 || i === imgTileLength + 1) {
|
|
14660
14724
|
if (i === 0) {
|
|
14661
14725
|
ctxt.setTransform(1, 0, 0, 1, 0, 0);
|
|
14662
|
-
ctxt.rect(0,
|
|
14726
|
+
ctxt.rect(0, top, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
|
|
14663
14727
|
ctxt.clip();
|
|
14664
14728
|
}
|
|
14665
14729
|
else {
|
|
14666
|
-
ctxt.setTransform(1, 0, 0, 1,
|
|
14730
|
+
ctxt.setTransform(1, 0, 0, 1, left, top);
|
|
14667
14731
|
}
|
|
14668
14732
|
}
|
|
14669
14733
|
else {
|
|
14670
14734
|
const tileParent = document.getElementById(this.control.element.id + '_tile_parent');
|
|
14671
|
-
ctxt.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) +
|
|
14672
|
-
|
|
14735
|
+
ctxt.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left, parseFloat(tile.style.top) +
|
|
14736
|
+
top);
|
|
14673
14737
|
}
|
|
14674
14738
|
ctxt.drawImage(exportTileImg, 0, 0);
|
|
14675
14739
|
if (i === imgTileLength + 1) {
|
|
@@ -14803,6 +14867,9 @@ class PdfExport {
|
|
|
14803
14867
|
image.src = url;
|
|
14804
14868
|
}
|
|
14805
14869
|
else {
|
|
14870
|
+
const svgParentElement = document.getElementById(this.control.element.id + '_MapAreaBorder');
|
|
14871
|
+
let top = parseFloat(svgParentElement.getAttribute('y'));
|
|
14872
|
+
let left = parseFloat(svgParentElement.getAttribute('x'));
|
|
14806
14873
|
const xHttp = new XMLHttpRequest();
|
|
14807
14874
|
const tileLength = this.control.mapLayerPanel.tiles.length;
|
|
14808
14875
|
for (let i = 0; i <= tileLength + 1; i++) {
|
|
@@ -14821,17 +14888,16 @@ class PdfExport {
|
|
|
14821
14888
|
if (i === 0 || i === tileLength + 1) {
|
|
14822
14889
|
if (i === 0) {
|
|
14823
14890
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
14824
|
-
ctx.rect(0,
|
|
14891
|
+
ctx.rect(0, top, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
|
|
14825
14892
|
ctx.clip();
|
|
14826
14893
|
}
|
|
14827
14894
|
else {
|
|
14828
|
-
ctx.setTransform(1, 0, 0, 1,
|
|
14895
|
+
ctx.setTransform(1, 0, 0, 1, left, top);
|
|
14829
14896
|
}
|
|
14830
14897
|
}
|
|
14831
14898
|
else {
|
|
14832
14899
|
const tileParent = document.getElementById(this.control.element.id + '_tile_parent');
|
|
14833
|
-
ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) +
|
|
14834
|
-
(parseFloat(tileParent.style.top)));
|
|
14900
|
+
ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left, parseFloat(tile.style.top) + top);
|
|
14835
14901
|
}
|
|
14836
14902
|
ctx.drawImage(tileImg, 0, 0);
|
|
14837
14903
|
if (i === tileLength + 1) {
|