@syncfusion/ej2-maps 20.4.49 → 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 +8 -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 +41 -14
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +41 -14
- 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 +29 -5
- package/src/maps/utils/helper.d.ts +1 -1
- package/src/maps/utils/helper.js +4 -5
|
@@ -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)) {
|
|
@@ -7992,7 +7990,7 @@ let Maps = class Maps extends Component {
|
|
|
7992
7990
|
wireEVents() {
|
|
7993
7991
|
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
7994
7992
|
EventHandler.add(this.element, 'click', this.mapsOnClick, this);
|
|
7995
|
-
|
|
7993
|
+
EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
|
|
7996
7994
|
EventHandler.add(this.element, 'dblclick', this.mapsOnDoubleClick, this);
|
|
7997
7995
|
EventHandler.add(this.element, Browser.touchStartEvent, this.mouseDownOnMap, this);
|
|
7998
7996
|
EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap, this);
|
|
@@ -8012,7 +8010,7 @@ let Maps = class Maps extends Component {
|
|
|
8012
8010
|
unWireEVents() {
|
|
8013
8011
|
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
8014
8012
|
EventHandler.remove(this.element, 'click', this.mapsOnClick);
|
|
8015
|
-
|
|
8013
|
+
EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
|
|
8016
8014
|
EventHandler.remove(this.element, 'dblclick', this.mapsOnDoubleClick);
|
|
8017
8015
|
EventHandler.remove(this.element, Browser.touchStartEvent, this.mouseDownOnMap);
|
|
8018
8016
|
EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap);
|
|
@@ -8371,6 +8369,31 @@ let Maps = class Maps extends Component {
|
|
|
8371
8369
|
this.markerModule.sameMarkerData = [];
|
|
8372
8370
|
}
|
|
8373
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
|
+
}
|
|
8374
8397
|
/**
|
|
8375
8398
|
* This method is used to perform operations when performing the double click operation on maps.
|
|
8376
8399
|
*
|
|
@@ -8797,7 +8820,7 @@ let Maps = class Maps extends Component {
|
|
|
8797
8820
|
this.maxLatOfGivenLocation = maxLatitude;
|
|
8798
8821
|
this.maxLongOfGivenLocation = maxLongitude;
|
|
8799
8822
|
this.zoomNotApplied = true;
|
|
8800
|
-
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);
|
|
8801
8824
|
const zoomArgs = {
|
|
8802
8825
|
cancel: false, name: 'zoom', type: zoomIn, maps: this,
|
|
8803
8826
|
tileTranslatePoint: {}, translatePoint: {},
|
|
@@ -9990,6 +10013,9 @@ class DataLabel {
|
|
|
9990
10013
|
if (isNullOrUndefined(text) && (layer.dataLabelSettings.template !== '' && layer.dataSource['length'] === 0)) {
|
|
9991
10014
|
text = shapeData['properties'][layer.shapePropertyPath];
|
|
9992
10015
|
}
|
|
10016
|
+
if (isNullOrUndefined(text) && layer.dataSource['length'] > 0) {
|
|
10017
|
+
text = '';
|
|
10018
|
+
}
|
|
9993
10019
|
const dataLabelText = text;
|
|
9994
10020
|
const projectionType = this.maps.projectionType;
|
|
9995
10021
|
if (isPoint) {
|
|
@@ -10042,9 +10068,9 @@ class DataLabel {
|
|
|
10042
10068
|
}
|
|
10043
10069
|
let position = [];
|
|
10044
10070
|
let width = zoomLabelsPosition && scaleZoomValue > 1 && !this.maps.zoomNotApplied
|
|
10045
|
-
&& this.maps.zoomShapeCollection.length > index ? this.maps.
|
|
10071
|
+
&& this.maps.zoomShapeCollection.length > index ? (this.maps.dataLabelShape[index]) * scale :
|
|
10046
10072
|
(location['rightMax']['x'] - location['leftMax']['x']) * scale;
|
|
10047
|
-
if (!isNullOrUndefined(this.maps.dataLabelShape)) {
|
|
10073
|
+
if (!isNullOrUndefined(this.maps.dataLabelShape) && !this.maps.isReset) {
|
|
10048
10074
|
shapeWidth = firstLevelMapLocation['rightMax']['x'] - firstLevelMapLocation['leftMax']['x'];
|
|
10049
10075
|
this.maps.dataLabelShape.push(shapeWidth);
|
|
10050
10076
|
}
|
|
@@ -10070,8 +10096,9 @@ class DataLabel {
|
|
|
10070
10096
|
locationX = location1['x'];
|
|
10071
10097
|
location['x'] = location1['x'];
|
|
10072
10098
|
width = zoomLabelsPosition && scaleZoomValue > 1 && !this.maps.zoomNotApplied
|
|
10073
|
-
&& this.maps.zoomShapeCollection.length > index ? this.maps.
|
|
10074
|
-
(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;
|
|
10075
10102
|
}
|
|
10076
10103
|
const xpositionEnds = ((location['x'] + transPoint['x']) * scale) + textSize['width'] / 2;
|
|
10077
10104
|
const xpositionStart = ((location['x'] + transPoint['x']) * scale) - textSize['width'] / 2;
|