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