@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
package/dist/es6/ej2-maps.es5.js
CHANGED
|
@@ -2005,7 +2005,7 @@ function getTranslate(mapObject, layer, animate) {
|
|
|
2005
2005
|
center = mapObject.zoomSettings.shouldZoomInitially
|
|
2006
2006
|
&& mapObject.markerZoomedState && !mapObject.zoomPersistence ? mapObject.markerZoomCenterPoint :
|
|
2007
2007
|
mapObject.centerPosition;
|
|
2008
|
-
if ((!isNullOrUndefined(centerLongitude) && !isNullOrUndefined(centerLatitude)) || checkMethodeZoom) {
|
|
2008
|
+
if (((!isNullOrUndefined(centerLongitude) && centerLongitude !== 0) && (!isNullOrUndefined(centerLatitude) && centerLatitude !== 0)) || checkMethodeZoom) {
|
|
2009
2009
|
var leftPosition = (((mapWidth + Math.abs(mapObject.mapAreaRect.width - mapWidth)) / 2) + mapObject.mapAreaRect.x) / factor;
|
|
2010
2010
|
var topPosition = (((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) + mapObject.mapAreaRect.y) / factor;
|
|
2011
2011
|
var point = checkMethodeZoom ? calculateCenterFromPixel(mapObject, layer) :
|
|
@@ -2189,7 +2189,7 @@ function getZoomTranslate(mapObject, layer, animate) {
|
|
|
2189
2189
|
var factor = animate ? 1 : mapObject.mapScaleValue;
|
|
2190
2190
|
var mapWidth = Math.abs(max['x'] - min['x']);
|
|
2191
2191
|
var mapHeight = Math.abs(min['y'] - max['y']);
|
|
2192
|
-
if ((!isNullOrUndefined(longitude) && !isNullOrUndefined(latitude)) || checkZoomMethod) {
|
|
2192
|
+
if (((!isNullOrUndefined(longitude) && longitude !== 0) && (!isNullOrUndefined(latitude) && latitude !== 0)) || checkZoomMethod) {
|
|
2193
2193
|
var topPosition = ((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) / factor;
|
|
2194
2194
|
var leftPosition = ((mapWidth + Math.abs(mapObject.mapAreaRect.width - mapWidth)) / 2) / factor;
|
|
2195
2195
|
var point = checkZoomMethod ? calculateCenterFromPixel(mapObject, layer) :
|
|
@@ -3241,7 +3241,7 @@ function compareZoomFactor(scaleFactor, maps) {
|
|
|
3241
3241
|
* @param {Maps} maps - Specifies the instance of the maps
|
|
3242
3242
|
* @returns {number} - Returns the scale factor
|
|
3243
3243
|
*/
|
|
3244
|
-
function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, maps) {
|
|
3244
|
+
function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, maps, isZoomToCoordinates) {
|
|
3245
3245
|
var scaleFactor;
|
|
3246
3246
|
var maxZoomFact = maps.zoomSettings.maxZoom;
|
|
3247
3247
|
var applyMethodeZoom;
|
|
@@ -3254,9 +3254,7 @@ function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeigh
|
|
|
3254
3254
|
if (maps.zoomNotApplied && !maps.isTileMap) {
|
|
3255
3255
|
var latiRatio = Math.abs((maps.baseMapBounds.latitude.max - maps.baseMapBounds.latitude.min) / (maxLat - minLat));
|
|
3256
3256
|
var longiRatio = Math.abs((maps.baseMapBounds.longitude.max - maps.baseMapBounds.longitude.min) / (maxLong - minLong));
|
|
3257
|
-
applyMethodeZoom = Math.min(latiRatio, longiRatio);
|
|
3258
|
-
var minLocation = convertGeoToPoint(minLat, minLong, 1, maps.layersCollection[0], maps);
|
|
3259
|
-
var maxLocation = convertGeoToPoint(maxLat, maxLong, 1, maps.layersCollection[0], maps);
|
|
3257
|
+
applyMethodeZoom = isZoomToCoordinates ? (latiRatio + longiRatio) / 2 : Math.min(latiRatio, longiRatio);
|
|
3260
3258
|
}
|
|
3261
3259
|
var latRatio = (maxLatValue - minLatValue) / Math.PI;
|
|
3262
3260
|
var lngDiff = maxLong - minLong;
|
|
@@ -3265,7 +3263,8 @@ function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeigh
|
|
|
3265
3263
|
var WORLD_PX_WIDTH = 256;
|
|
3266
3264
|
var latZoom = (Math.log(mapHeight / WORLD_PX_HEIGHT / latRatio) / Math.LN2);
|
|
3267
3265
|
var lngZoom = (Math.log(mapWidth / WORLD_PX_WIDTH / lngRatio) / Math.LN2);
|
|
3268
|
-
var result = (maps.zoomNotApplied && !maps.isTileMap) ? applyMethodeZoom :
|
|
3266
|
+
var result = (maps.zoomNotApplied && !maps.isTileMap) ? applyMethodeZoom :
|
|
3267
|
+
isZoomToCoordinates && !maps.isTileMap ? (latZoom + lngZoom) / 2 : Math.min(latZoom, lngZoom);
|
|
3269
3268
|
scaleFactor = Math.min(result, maxZoomFact);
|
|
3270
3269
|
scaleFactor = maps.isTileMap || !maps.zoomNotApplied ? Math.floor(scaleFactor) : scaleFactor;
|
|
3271
3270
|
if (!maps.isTileMap) {
|
|
@@ -5091,7 +5090,7 @@ var Marker = /** @__PURE__ @class */ (function () {
|
|
|
5091
5090
|
}
|
|
5092
5091
|
var markerFactor = void 0;
|
|
5093
5092
|
if (this.maps.isTileMap || this.maps.baseMapRectBounds['min']['x'] === 0) {
|
|
5094
|
-
zoomLevel = calculateZoomLevel(minLat_1, maxLat_1, minLong_1, maxLong_1, mapWidth, mapHeight, this.maps);
|
|
5093
|
+
zoomLevel = calculateZoomLevel(minLat_1, maxLat_1, minLong_1, maxLong_1, mapWidth, mapHeight, this.maps, false);
|
|
5095
5094
|
if (this.maps.isTileMap) {
|
|
5096
5095
|
markerFactor = isNullOrUndefined(this.maps.markerZoomFactor) ?
|
|
5097
5096
|
zoomLevel : isNullOrUndefined(this.maps.mapScaleValue) ?
|
|
@@ -7770,7 +7769,6 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
7770
7769
|
}
|
|
7771
7770
|
if (!isNullOrUndefined(this.dataLabelModule)) {
|
|
7772
7771
|
this.dataLabelModule.dataLabelCollections = [];
|
|
7773
|
-
this.dataLabelShape = [];
|
|
7774
7772
|
}
|
|
7775
7773
|
this.mapLayerPanel.measureLayerPanel();
|
|
7776
7774
|
if (!isNullOrUndefined(this.svgObject)) {
|
|
@@ -7820,33 +7818,33 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
7820
7818
|
var bottom = void 0;
|
|
7821
7819
|
var top_1;
|
|
7822
7820
|
var left = void 0;
|
|
7823
|
-
left = parseFloat(tileElement.style.left)
|
|
7821
|
+
left = parseFloat(tileElement.style.left);
|
|
7824
7822
|
var titleTextSize = measureText(this.titleSettings.text, this.titleSettings.textStyle);
|
|
7825
7823
|
var subTitleTextSize = measureText(this.titleSettings.subtitleSettings.text, this.titleSettings.subtitleSettings.textStyle);
|
|
7826
7824
|
if (this.isTileMap && this.isTileMapSubLayer && this.legendSettings.position === 'Bottom' && this.legendSettings.visible) {
|
|
7827
7825
|
if (this.legendSettings.mode !== 'Default') {
|
|
7828
7826
|
if (titleTextSize.width !== 0 && titleTextSize.height !== 0) {
|
|
7829
|
-
top_1 = parseFloat(tileElement.style.top) +
|
|
7827
|
+
top_1 = parseFloat(tileElement.style.top) + (subTitleTextSize.height / 2)
|
|
7830
7828
|
- (this.legendModule.legendBorderRect.height / 2);
|
|
7831
7829
|
}
|
|
7832
7830
|
else {
|
|
7833
|
-
top_1 = parseFloat(tileElement.style.top)
|
|
7831
|
+
top_1 = parseFloat(tileElement.style.top) - this.mapAreaRect.y;
|
|
7834
7832
|
}
|
|
7835
7833
|
}
|
|
7836
7834
|
else {
|
|
7837
7835
|
left = this.legendModule.legendBorderRect.x;
|
|
7838
7836
|
if (titleTextSize.width !== 0 && titleTextSize.height !== 0) {
|
|
7839
|
-
top_1 = parseFloat(tileElement.style.top) +
|
|
7837
|
+
top_1 = parseFloat(tileElement.style.top) + (subTitleTextSize['height'] / 2)
|
|
7840
7838
|
- this.legendModule.legendBorderRect.y;
|
|
7841
7839
|
}
|
|
7842
7840
|
else {
|
|
7843
|
-
top_1 = parseFloat(tileElement.style.top) +
|
|
7841
|
+
top_1 = parseFloat(tileElement.style.top) + (subTitleTextSize['height'] / 2);
|
|
7844
7842
|
}
|
|
7845
7843
|
}
|
|
7846
7844
|
}
|
|
7847
7845
|
else {
|
|
7848
7846
|
bottom = svg.bottom - tile.bottom - element.offsetTop;
|
|
7849
|
-
top_1 = parseFloat(tileElement.style.top)
|
|
7847
|
+
top_1 = parseFloat(tileElement.style.top);
|
|
7850
7848
|
}
|
|
7851
7849
|
top_1 = (bottom <= 11) ? top_1 : (!isNullOrUndefined(this.legendModule) && this.legendSettings.position === 'Bottom') ? this.mapAreaRect.y : (top_1 * 2);
|
|
7852
7850
|
left = (bottom <= 11) ? left : !isNullOrUndefined(this.legendModule) ? left : (left * 2);
|
|
@@ -7866,6 +7864,7 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
7866
7864
|
}
|
|
7867
7865
|
}
|
|
7868
7866
|
this.element.style.outline = 'none';
|
|
7867
|
+
this.element.style.position = 'relative';
|
|
7869
7868
|
for (var i = 0; i < document.getElementsByTagName('path').length - 1; i++) {
|
|
7870
7869
|
if (document.getElementsByTagName('path')[i].id.indexOf('shapeIndex') > -1) {
|
|
7871
7870
|
document.getElementsByTagName('path')[i].style.outline = 'none';
|
|
@@ -8043,7 +8042,7 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
8043
8042
|
var secondaryElement = createElement('div', {
|
|
8044
8043
|
id: this.element.id + '_Secondary_Element'
|
|
8045
8044
|
});
|
|
8046
|
-
secondaryElement.style.cssText = 'position:
|
|
8045
|
+
secondaryElement.style.cssText = 'position: relative;z-index:2;';
|
|
8047
8046
|
this.element.appendChild(secondaryElement);
|
|
8048
8047
|
}
|
|
8049
8048
|
};
|
|
@@ -8267,7 +8266,7 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
8267
8266
|
Maps.prototype.wireEVents = function () {
|
|
8268
8267
|
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
8269
8268
|
EventHandler.add(this.element, 'click', this.mapsOnClick, this);
|
|
8270
|
-
|
|
8269
|
+
EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
|
|
8271
8270
|
EventHandler.add(this.element, 'dblclick', this.mapsOnDoubleClick, this);
|
|
8272
8271
|
EventHandler.add(this.element, Browser.touchStartEvent, this.mouseDownOnMap, this);
|
|
8273
8272
|
EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap, this);
|
|
@@ -8287,7 +8286,7 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
8287
8286
|
Maps.prototype.unWireEVents = function () {
|
|
8288
8287
|
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
8289
8288
|
EventHandler.remove(this.element, 'click', this.mapsOnClick);
|
|
8290
|
-
|
|
8289
|
+
EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
|
|
8291
8290
|
EventHandler.remove(this.element, 'dblclick', this.mapsOnDoubleClick);
|
|
8292
8291
|
EventHandler.remove(this.element, Browser.touchStartEvent, this.mouseDownOnMap);
|
|
8293
8292
|
EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap);
|
|
@@ -8647,6 +8646,31 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
8647
8646
|
this.markerModule.sameMarkerData = [];
|
|
8648
8647
|
}
|
|
8649
8648
|
};
|
|
8649
|
+
/**
|
|
8650
|
+
* @param {PointerEvent} e - Specifies the pointer event.
|
|
8651
|
+
* @returns {void}
|
|
8652
|
+
* @private
|
|
8653
|
+
*/
|
|
8654
|
+
Maps.prototype.mapsOnRightClick = function (e) {
|
|
8655
|
+
var targetEle = e.target;
|
|
8656
|
+
var targetId = targetEle.id;
|
|
8657
|
+
var latitude = null;
|
|
8658
|
+
var longitude = null;
|
|
8659
|
+
this.mouseClickEvent = this.mouseDownEvent = { x: e.x, y: e.y };
|
|
8660
|
+
if (targetEle.id.indexOf('_ToolBar') === -1) {
|
|
8661
|
+
var latLongValue = this.getClickLocation(targetId, e.pageX, e.pageY, targetEle, e['layerX'], e['layerY']);
|
|
8662
|
+
if (!isNullOrUndefined(latLongValue)) {
|
|
8663
|
+
latitude = latLongValue.latitude;
|
|
8664
|
+
longitude = latLongValue.longitude;
|
|
8665
|
+
}
|
|
8666
|
+
var eventArgs = {
|
|
8667
|
+
cancel: false, name: rightClick, target: targetId, x: e.clientX, y: e.clientY,
|
|
8668
|
+
latitude: latitude, longitude: longitude,
|
|
8669
|
+
isShapeSelected: false
|
|
8670
|
+
};
|
|
8671
|
+
this.trigger('rightClick', eventArgs);
|
|
8672
|
+
}
|
|
8673
|
+
};
|
|
8650
8674
|
/**
|
|
8651
8675
|
* This method is used to perform operations when performing the double click operation on maps.
|
|
8652
8676
|
*
|
|
@@ -9076,7 +9100,7 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
9076
9100
|
this.maxLatOfGivenLocation = maxLatitude;
|
|
9077
9101
|
this.maxLongOfGivenLocation = maxLongitude;
|
|
9078
9102
|
this.zoomNotApplied = true;
|
|
9079
|
-
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this);
|
|
9103
|
+
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this, true);
|
|
9080
9104
|
var zoomArgs = {
|
|
9081
9105
|
cancel: false, name: 'zoom', type: zoomIn, maps: this,
|
|
9082
9106
|
tileTranslatePoint: {}, translatePoint: {},
|
|
@@ -10287,6 +10311,9 @@ var DataLabel = /** @__PURE__ @class */ (function () {
|
|
|
10287
10311
|
if (isNullOrUndefined(text) && (layer.dataLabelSettings.template !== '' && layer.dataSource['length'] === 0)) {
|
|
10288
10312
|
text = shapeData['properties'][layer.shapePropertyPath];
|
|
10289
10313
|
}
|
|
10314
|
+
if (isNullOrUndefined(text) && layer.dataSource['length'] > 0) {
|
|
10315
|
+
text = '';
|
|
10316
|
+
}
|
|
10290
10317
|
var dataLabelText = text;
|
|
10291
10318
|
var projectionType = this.maps.projectionType;
|
|
10292
10319
|
if (isPoint) {
|
|
@@ -10339,9 +10366,9 @@ var DataLabel = /** @__PURE__ @class */ (function () {
|
|
|
10339
10366
|
}
|
|
10340
10367
|
var position = [];
|
|
10341
10368
|
var width = zoomLabelsPosition && scaleZoomValue > 1 && !_this.maps.zoomNotApplied
|
|
10342
|
-
&& _this.maps.zoomShapeCollection.length > index ? _this.maps.
|
|
10369
|
+
&& _this.maps.zoomShapeCollection.length > index ? (_this.maps.dataLabelShape[index]) * scale :
|
|
10343
10370
|
(location['rightMax']['x'] - location['leftMax']['x']) * scale;
|
|
10344
|
-
if (!isNullOrUndefined(_this.maps.dataLabelShape)) {
|
|
10371
|
+
if (!isNullOrUndefined(_this.maps.dataLabelShape) && !_this.maps.isReset) {
|
|
10345
10372
|
shapeWidth = firstLevelMapLocation['rightMax']['x'] - firstLevelMapLocation['leftMax']['x'];
|
|
10346
10373
|
_this.maps.dataLabelShape.push(shapeWidth);
|
|
10347
10374
|
}
|
|
@@ -10367,8 +10394,9 @@ var DataLabel = /** @__PURE__ @class */ (function () {
|
|
|
10367
10394
|
locationX = location1['x'];
|
|
10368
10395
|
location['x'] = location1['x'];
|
|
10369
10396
|
width = zoomLabelsPosition && scaleZoomValue > 1 && !_this.maps.zoomNotApplied
|
|
10370
|
-
&& _this.maps.zoomShapeCollection.length > index ? _this.maps.
|
|
10371
|
-
(location1['rightMax']['x'] - location1['leftMax']['x']) * scale
|
|
10397
|
+
&& _this.maps.zoomShapeCollection.length > index ? (_this.maps.dataLabelShape[index]) * scale :
|
|
10398
|
+
((location1['rightMax']['x'] - location1['leftMax']['x']) * scale) > 0 ?
|
|
10399
|
+
((location1['rightMax']['x'] - location1['leftMax']['x']) * scale) : width;
|
|
10372
10400
|
}
|
|
10373
10401
|
var xpositionEnds = ((location['x'] + transPoint['x']) * scale) + textSize['width'] / 2;
|
|
10374
10402
|
var xpositionStart = ((location['x'] + transPoint['x']) * scale) - textSize['width'] / 2;
|
|
@@ -14526,6 +14554,7 @@ var Zoom = /** @__PURE__ @class */ (function () {
|
|
|
14526
14554
|
var datalabelTemplateElemement = getElementByID(maps.element.id + '_LayerIndex_'
|
|
14527
14555
|
+ i + '_Label_Template_Group');
|
|
14528
14556
|
if ((!isNullOrUndefined(markerTemplateElement)) && markerTemplateElement.childElementCount > 0) {
|
|
14557
|
+
markerTemplateElement.style.visibility = "visible";
|
|
14529
14558
|
for (var k = 0; k < markerTemplateElement.childElementCount; k++) {
|
|
14530
14559
|
this.markerTranslate(markerTemplateElement.childNodes[k], factor, x, y, scale, 'Template');
|
|
14531
14560
|
}
|