@syncfusion/ej2-maps 20.4.48 → 20.4.54
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 +23 -0
- 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 +52 -23
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +52 -23
- 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 +8 -8
- package/src/maps/layers/data-label.js +8 -4
- package/src/maps/layers/marker.js +1 -1
- package/src/maps/maps.d.ts +6 -0
- package/src/maps/maps.js +37 -12
- package/src/maps/user-interaction/zoom.js +1 -0
- package/src/maps/utils/helper.d.ts +1 -1
- package/src/maps/utils/helper.js +6 -7
|
@@ -1949,7 +1949,7 @@ function getTranslate(mapObject, layer, animate) {
|
|
|
1949
1949
|
center = mapObject.zoomSettings.shouldZoomInitially
|
|
1950
1950
|
&& mapObject.markerZoomedState && !mapObject.zoomPersistence ? mapObject.markerZoomCenterPoint :
|
|
1951
1951
|
mapObject.centerPosition;
|
|
1952
|
-
if ((!isNullOrUndefined(centerLongitude) && !isNullOrUndefined(centerLatitude)) || checkMethodeZoom) {
|
|
1952
|
+
if (((!isNullOrUndefined(centerLongitude) && centerLongitude !== 0) && (!isNullOrUndefined(centerLatitude) && centerLatitude !== 0)) || checkMethodeZoom) {
|
|
1953
1953
|
const leftPosition = (((mapWidth + Math.abs(mapObject.mapAreaRect.width - mapWidth)) / 2) + mapObject.mapAreaRect.x) / factor;
|
|
1954
1954
|
const topPosition = (((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) + mapObject.mapAreaRect.y) / factor;
|
|
1955
1955
|
const point = checkMethodeZoom ? calculateCenterFromPixel(mapObject, layer) :
|
|
@@ -2133,7 +2133,7 @@ function getZoomTranslate(mapObject, layer, animate) {
|
|
|
2133
2133
|
const factor = animate ? 1 : mapObject.mapScaleValue;
|
|
2134
2134
|
const mapWidth = Math.abs(max['x'] - min['x']);
|
|
2135
2135
|
const mapHeight = Math.abs(min['y'] - max['y']);
|
|
2136
|
-
if ((!isNullOrUndefined(longitude) && !isNullOrUndefined(latitude)) || checkZoomMethod) {
|
|
2136
|
+
if (((!isNullOrUndefined(longitude) && longitude !== 0) && (!isNullOrUndefined(latitude) && latitude !== 0)) || checkZoomMethod) {
|
|
2137
2137
|
const topPosition = ((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) / factor;
|
|
2138
2138
|
const leftPosition = ((mapWidth + Math.abs(mapObject.mapAreaRect.width - mapWidth)) / 2) / factor;
|
|
2139
2139
|
const point = checkZoomMethod ? calculateCenterFromPixel(mapObject, layer) :
|
|
@@ -3182,7 +3182,7 @@ function compareZoomFactor(scaleFactor, maps) {
|
|
|
3182
3182
|
* @param {Maps} maps - Specifies the instance of the maps
|
|
3183
3183
|
* @returns {number} - Returns the scale factor
|
|
3184
3184
|
*/
|
|
3185
|
-
function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, maps) {
|
|
3185
|
+
function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, maps, isZoomToCoordinates) {
|
|
3186
3186
|
let scaleFactor;
|
|
3187
3187
|
const maxZoomFact = maps.zoomSettings.maxZoom;
|
|
3188
3188
|
let applyMethodeZoom;
|
|
@@ -3195,9 +3195,7 @@ function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeigh
|
|
|
3195
3195
|
if (maps.zoomNotApplied && !maps.isTileMap) {
|
|
3196
3196
|
const latiRatio = Math.abs((maps.baseMapBounds.latitude.max - maps.baseMapBounds.latitude.min) / (maxLat - minLat));
|
|
3197
3197
|
const longiRatio = Math.abs((maps.baseMapBounds.longitude.max - maps.baseMapBounds.longitude.min) / (maxLong - minLong));
|
|
3198
|
-
applyMethodeZoom = Math.min(latiRatio, longiRatio);
|
|
3199
|
-
const minLocation = convertGeoToPoint(minLat, minLong, 1, maps.layersCollection[0], maps);
|
|
3200
|
-
const maxLocation = convertGeoToPoint(maxLat, maxLong, 1, maps.layersCollection[0], maps);
|
|
3198
|
+
applyMethodeZoom = isZoomToCoordinates ? (latiRatio + longiRatio) / 2 : Math.min(latiRatio, longiRatio);
|
|
3201
3199
|
}
|
|
3202
3200
|
const latRatio = (maxLatValue - minLatValue) / Math.PI;
|
|
3203
3201
|
const lngDiff = maxLong - minLong;
|
|
@@ -3206,7 +3204,8 @@ function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeigh
|
|
|
3206
3204
|
const WORLD_PX_WIDTH = 256;
|
|
3207
3205
|
const latZoom = (Math.log(mapHeight / WORLD_PX_HEIGHT / latRatio) / Math.LN2);
|
|
3208
3206
|
const lngZoom = (Math.log(mapWidth / WORLD_PX_WIDTH / lngRatio) / Math.LN2);
|
|
3209
|
-
const result = (maps.zoomNotApplied && !maps.isTileMap) ? applyMethodeZoom :
|
|
3207
|
+
const result = (maps.zoomNotApplied && !maps.isTileMap) ? applyMethodeZoom :
|
|
3208
|
+
isZoomToCoordinates && !maps.isTileMap ? (latZoom + lngZoom) / 2 : Math.min(latZoom, lngZoom);
|
|
3210
3209
|
scaleFactor = Math.min(result, maxZoomFact);
|
|
3211
3210
|
scaleFactor = maps.isTileMap || !maps.zoomNotApplied ? Math.floor(scaleFactor) : scaleFactor;
|
|
3212
3211
|
if (!maps.isTileMap) {
|
|
@@ -4872,7 +4871,7 @@ class Marker {
|
|
|
4872
4871
|
}
|
|
4873
4872
|
let markerFactor;
|
|
4874
4873
|
if (this.maps.isTileMap || this.maps.baseMapRectBounds['min']['x'] === 0) {
|
|
4875
|
-
zoomLevel = calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, this.maps);
|
|
4874
|
+
zoomLevel = calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, this.maps, false);
|
|
4876
4875
|
if (this.maps.isTileMap) {
|
|
4877
4876
|
markerFactor = isNullOrUndefined(this.maps.markerZoomFactor) ?
|
|
4878
4877
|
zoomLevel : isNullOrUndefined(this.maps.mapScaleValue) ?
|
|
@@ -7495,7 +7494,6 @@ let Maps = class Maps extends Component {
|
|
|
7495
7494
|
}
|
|
7496
7495
|
if (!isNullOrUndefined(this.dataLabelModule)) {
|
|
7497
7496
|
this.dataLabelModule.dataLabelCollections = [];
|
|
7498
|
-
this.dataLabelShape = [];
|
|
7499
7497
|
}
|
|
7500
7498
|
this.mapLayerPanel.measureLayerPanel();
|
|
7501
7499
|
if (!isNullOrUndefined(this.svgObject)) {
|
|
@@ -7545,33 +7543,33 @@ let Maps = class Maps extends Component {
|
|
|
7545
7543
|
let bottom;
|
|
7546
7544
|
let top;
|
|
7547
7545
|
let left;
|
|
7548
|
-
left = parseFloat(tileElement.style.left)
|
|
7546
|
+
left = parseFloat(tileElement.style.left);
|
|
7549
7547
|
const titleTextSize = measureText(this.titleSettings.text, this.titleSettings.textStyle);
|
|
7550
7548
|
const subTitleTextSize = measureText(this.titleSettings.subtitleSettings.text, this.titleSettings.subtitleSettings.textStyle);
|
|
7551
7549
|
if (this.isTileMap && this.isTileMapSubLayer && this.legendSettings.position === 'Bottom' && this.legendSettings.visible) {
|
|
7552
7550
|
if (this.legendSettings.mode !== 'Default') {
|
|
7553
7551
|
if (titleTextSize.width !== 0 && titleTextSize.height !== 0) {
|
|
7554
|
-
top = parseFloat(tileElement.style.top) +
|
|
7552
|
+
top = parseFloat(tileElement.style.top) + (subTitleTextSize.height / 2)
|
|
7555
7553
|
- (this.legendModule.legendBorderRect.height / 2);
|
|
7556
7554
|
}
|
|
7557
7555
|
else {
|
|
7558
|
-
top = parseFloat(tileElement.style.top)
|
|
7556
|
+
top = parseFloat(tileElement.style.top) - this.mapAreaRect.y;
|
|
7559
7557
|
}
|
|
7560
7558
|
}
|
|
7561
7559
|
else {
|
|
7562
7560
|
left = this.legendModule.legendBorderRect.x;
|
|
7563
7561
|
if (titleTextSize.width !== 0 && titleTextSize.height !== 0) {
|
|
7564
|
-
top = parseFloat(tileElement.style.top) +
|
|
7562
|
+
top = parseFloat(tileElement.style.top) + (subTitleTextSize['height'] / 2)
|
|
7565
7563
|
- this.legendModule.legendBorderRect.y;
|
|
7566
7564
|
}
|
|
7567
7565
|
else {
|
|
7568
|
-
top = parseFloat(tileElement.style.top) +
|
|
7566
|
+
top = parseFloat(tileElement.style.top) + (subTitleTextSize['height'] / 2);
|
|
7569
7567
|
}
|
|
7570
7568
|
}
|
|
7571
7569
|
}
|
|
7572
7570
|
else {
|
|
7573
7571
|
bottom = svg.bottom - tile.bottom - element.offsetTop;
|
|
7574
|
-
top = parseFloat(tileElement.style.top)
|
|
7572
|
+
top = parseFloat(tileElement.style.top);
|
|
7575
7573
|
}
|
|
7576
7574
|
top = (bottom <= 11) ? top : (!isNullOrUndefined(this.legendModule) && this.legendSettings.position === 'Bottom') ? this.mapAreaRect.y : (top * 2);
|
|
7577
7575
|
left = (bottom <= 11) ? left : !isNullOrUndefined(this.legendModule) ? left : (left * 2);
|
|
@@ -7591,6 +7589,7 @@ let Maps = class Maps extends Component {
|
|
|
7591
7589
|
}
|
|
7592
7590
|
}
|
|
7593
7591
|
this.element.style.outline = 'none';
|
|
7592
|
+
this.element.style.position = 'relative';
|
|
7594
7593
|
for (let i = 0; i < document.getElementsByTagName('path').length - 1; i++) {
|
|
7595
7594
|
if (document.getElementsByTagName('path')[i].id.indexOf('shapeIndex') > -1) {
|
|
7596
7595
|
document.getElementsByTagName('path')[i].style.outline = 'none';
|
|
@@ -7768,7 +7767,7 @@ let Maps = class Maps extends Component {
|
|
|
7768
7767
|
const secondaryElement = createElement('div', {
|
|
7769
7768
|
id: this.element.id + '_Secondary_Element'
|
|
7770
7769
|
});
|
|
7771
|
-
secondaryElement.style.cssText = 'position:
|
|
7770
|
+
secondaryElement.style.cssText = 'position: relative;z-index:2;';
|
|
7772
7771
|
this.element.appendChild(secondaryElement);
|
|
7773
7772
|
}
|
|
7774
7773
|
}
|
|
@@ -7991,7 +7990,7 @@ let Maps = class Maps extends Component {
|
|
|
7991
7990
|
wireEVents() {
|
|
7992
7991
|
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
7993
7992
|
EventHandler.add(this.element, 'click', this.mapsOnClick, this);
|
|
7994
|
-
|
|
7993
|
+
EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
|
|
7995
7994
|
EventHandler.add(this.element, 'dblclick', this.mapsOnDoubleClick, this);
|
|
7996
7995
|
EventHandler.add(this.element, Browser.touchStartEvent, this.mouseDownOnMap, this);
|
|
7997
7996
|
EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap, this);
|
|
@@ -8011,7 +8010,7 @@ let Maps = class Maps extends Component {
|
|
|
8011
8010
|
unWireEVents() {
|
|
8012
8011
|
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
8013
8012
|
EventHandler.remove(this.element, 'click', this.mapsOnClick);
|
|
8014
|
-
|
|
8013
|
+
EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
|
|
8015
8014
|
EventHandler.remove(this.element, 'dblclick', this.mapsOnDoubleClick);
|
|
8016
8015
|
EventHandler.remove(this.element, Browser.touchStartEvent, this.mouseDownOnMap);
|
|
8017
8016
|
EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap);
|
|
@@ -8370,6 +8369,31 @@ let Maps = class Maps extends Component {
|
|
|
8370
8369
|
this.markerModule.sameMarkerData = [];
|
|
8371
8370
|
}
|
|
8372
8371
|
}
|
|
8372
|
+
/**
|
|
8373
|
+
* @param {PointerEvent} e - Specifies the pointer event.
|
|
8374
|
+
* @returns {void}
|
|
8375
|
+
* @private
|
|
8376
|
+
*/
|
|
8377
|
+
mapsOnRightClick(e) {
|
|
8378
|
+
const targetEle = e.target;
|
|
8379
|
+
const targetId = targetEle.id;
|
|
8380
|
+
let latitude = null;
|
|
8381
|
+
let longitude = null;
|
|
8382
|
+
this.mouseClickEvent = this.mouseDownEvent = { x: e.x, y: e.y };
|
|
8383
|
+
if (targetEle.id.indexOf('_ToolBar') === -1) {
|
|
8384
|
+
const latLongValue = this.getClickLocation(targetId, e.pageX, e.pageY, targetEle, e['layerX'], e['layerY']);
|
|
8385
|
+
if (!isNullOrUndefined(latLongValue)) {
|
|
8386
|
+
latitude = latLongValue.latitude;
|
|
8387
|
+
longitude = latLongValue.longitude;
|
|
8388
|
+
}
|
|
8389
|
+
const eventArgs = {
|
|
8390
|
+
cancel: false, name: rightClick, target: targetId, x: e.clientX, y: e.clientY,
|
|
8391
|
+
latitude: latitude, longitude: longitude,
|
|
8392
|
+
isShapeSelected: false
|
|
8393
|
+
};
|
|
8394
|
+
this.trigger('rightClick', eventArgs);
|
|
8395
|
+
}
|
|
8396
|
+
}
|
|
8373
8397
|
/**
|
|
8374
8398
|
* This method is used to perform operations when performing the double click operation on maps.
|
|
8375
8399
|
*
|
|
@@ -8796,7 +8820,7 @@ let Maps = class Maps extends Component {
|
|
|
8796
8820
|
this.maxLatOfGivenLocation = maxLatitude;
|
|
8797
8821
|
this.maxLongOfGivenLocation = maxLongitude;
|
|
8798
8822
|
this.zoomNotApplied = true;
|
|
8799
|
-
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this);
|
|
8823
|
+
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this, true);
|
|
8800
8824
|
const zoomArgs = {
|
|
8801
8825
|
cancel: false, name: 'zoom', type: zoomIn, maps: this,
|
|
8802
8826
|
tileTranslatePoint: {}, translatePoint: {},
|
|
@@ -9989,6 +10013,9 @@ class DataLabel {
|
|
|
9989
10013
|
if (isNullOrUndefined(text) && (layer.dataLabelSettings.template !== '' && layer.dataSource['length'] === 0)) {
|
|
9990
10014
|
text = shapeData['properties'][layer.shapePropertyPath];
|
|
9991
10015
|
}
|
|
10016
|
+
if (isNullOrUndefined(text) && layer.dataSource['length'] > 0) {
|
|
10017
|
+
text = '';
|
|
10018
|
+
}
|
|
9992
10019
|
const dataLabelText = text;
|
|
9993
10020
|
const projectionType = this.maps.projectionType;
|
|
9994
10021
|
if (isPoint) {
|
|
@@ -10041,9 +10068,9 @@ class DataLabel {
|
|
|
10041
10068
|
}
|
|
10042
10069
|
let position = [];
|
|
10043
10070
|
let width = zoomLabelsPosition && scaleZoomValue > 1 && !this.maps.zoomNotApplied
|
|
10044
|
-
&& this.maps.zoomShapeCollection.length > index ? this.maps.
|
|
10071
|
+
&& this.maps.zoomShapeCollection.length > index ? (this.maps.dataLabelShape[index]) * scale :
|
|
10045
10072
|
(location['rightMax']['x'] - location['leftMax']['x']) * scale;
|
|
10046
|
-
if (!isNullOrUndefined(this.maps.dataLabelShape)) {
|
|
10073
|
+
if (!isNullOrUndefined(this.maps.dataLabelShape) && !this.maps.isReset) {
|
|
10047
10074
|
shapeWidth = firstLevelMapLocation['rightMax']['x'] - firstLevelMapLocation['leftMax']['x'];
|
|
10048
10075
|
this.maps.dataLabelShape.push(shapeWidth);
|
|
10049
10076
|
}
|
|
@@ -10069,8 +10096,9 @@ class DataLabel {
|
|
|
10069
10096
|
locationX = location1['x'];
|
|
10070
10097
|
location['x'] = location1['x'];
|
|
10071
10098
|
width = zoomLabelsPosition && scaleZoomValue > 1 && !this.maps.zoomNotApplied
|
|
10072
|
-
&& this.maps.zoomShapeCollection.length > index ? this.maps.
|
|
10073
|
-
(location1['rightMax']['x'] - location1['leftMax']['x']) * scale
|
|
10099
|
+
&& this.maps.zoomShapeCollection.length > index ? (this.maps.dataLabelShape[index]) * scale :
|
|
10100
|
+
((location1['rightMax']['x'] - location1['leftMax']['x']) * scale) > 0 ?
|
|
10101
|
+
((location1['rightMax']['x'] - location1['leftMax']['x']) * scale) : width;
|
|
10074
10102
|
}
|
|
10075
10103
|
const xpositionEnds = ((location['x'] + transPoint['x']) * scale) + textSize['width'] / 2;
|
|
10076
10104
|
const xpositionStart = ((location['x'] + transPoint['x']) * scale) - textSize['width'] / 2;
|
|
@@ -14197,6 +14225,7 @@ class Zoom {
|
|
|
14197
14225
|
const datalabelTemplateElemement = getElementByID(maps.element.id + '_LayerIndex_'
|
|
14198
14226
|
+ i + '_Label_Template_Group');
|
|
14199
14227
|
if ((!isNullOrUndefined(markerTemplateElement)) && markerTemplateElement.childElementCount > 0) {
|
|
14228
|
+
markerTemplateElement.style.visibility = "visible";
|
|
14200
14229
|
for (let k = 0; k < markerTemplateElement.childElementCount; k++) {
|
|
14201
14230
|
this.markerTranslate(markerTemplateElement.childNodes[k], factor, x, y, scale, 'Template');
|
|
14202
14231
|
}
|