@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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 20.4.49
3
+ * version : 20.4.54
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-maps@*",
3
- "_id": "@syncfusion/ej2-maps@20.4.48",
3
+ "_id": "@syncfusion/ej2-maps@20.4.49",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-223OUDfEl+Z1a+jXhD9ie4XYVHmPPJU3B4LjBpdq5ZcCDtEZmU6nEp/iDBUzj6bx2a4m4wfJ/XrfbgpeB/Ypxw==",
5
+ "_integrity": "sha512-mDTTSc12RWppsfjXlF9qEA7MK7jvYKRM5sGrgLLq9Cww4zk45QTUmcWxU3rKvDgzp9DtVRVYmGBKaCu3t88UzQ==",
6
6
  "_location": "/@syncfusion/ej2-maps",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-maps",
24
24
  "/@syncfusion/ej2-vue-maps"
25
25
  ],
26
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-maps/-/ej2-maps-20.4.48.tgz",
27
- "_shasum": "4867f7d8ef1de1f2739c0af3a0a08dc4573b7012",
26
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-maps/-/ej2-maps-20.4.49.tgz",
27
+ "_shasum": "55ff71b4c167a3be8af6a298f611c794e2b026c8",
28
28
  "_spec": "@syncfusion/ej2-maps@*",
29
29
  "_where": "/jenkins/workspace/ease-automation_release_19.1.0.1/packages/included",
30
30
  "author": {
@@ -35,13 +35,13 @@
35
35
  },
36
36
  "bundleDependencies": false,
37
37
  "dependencies": {
38
- "@syncfusion/ej2-base": "~20.4.48",
39
- "@syncfusion/ej2-buttons": "~20.4.49",
38
+ "@syncfusion/ej2-base": "~20.4.51",
39
+ "@syncfusion/ej2-buttons": "~20.4.53",
40
40
  "@syncfusion/ej2-compression": "~20.4.48",
41
41
  "@syncfusion/ej2-data": "~20.4.48",
42
42
  "@syncfusion/ej2-file-utils": "~20.4.48",
43
43
  "@syncfusion/ej2-pdf-export": "~20.4.48",
44
- "@syncfusion/ej2-svg-base": "~20.4.48"
44
+ "@syncfusion/ej2-svg-base": "~20.4.53"
45
45
  },
46
46
  "deprecated": false,
47
47
  "description": "The Maps component is used to visualize the geographical data and represent the statistical data of a particular geographical area on earth with user interactivity, and provides various customizing options",
@@ -93,6 +93,6 @@
93
93
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
94
94
  },
95
95
  "typings": "index.d.ts",
96
- "version": "20.4.49",
96
+ "version": "20.4.54",
97
97
  "sideEffects": false
98
98
  }
@@ -150,6 +150,9 @@ var DataLabel = /** @class */ (function () {
150
150
  if (isNullOrUndefined(text) && (layer.dataLabelSettings.template !== '' && layer.dataSource['length'] === 0)) {
151
151
  text = shapeData['properties'][layer.shapePropertyPath];
152
152
  }
153
+ if (isNullOrUndefined(text) && layer.dataSource['length'] > 0) {
154
+ text = '';
155
+ }
153
156
  var dataLabelText = text;
154
157
  var projectionType = this.maps.projectionType;
155
158
  if (isPoint) {
@@ -202,9 +205,9 @@ var DataLabel = /** @class */ (function () {
202
205
  }
203
206
  var position = [];
204
207
  var width = zoomLabelsPosition && scaleZoomValue > 1 && !_this.maps.zoomNotApplied
205
- && _this.maps.zoomShapeCollection.length > index ? _this.maps.zoomShapeCollection[index]['width'] :
208
+ && _this.maps.zoomShapeCollection.length > index ? (_this.maps.dataLabelShape[index]) * scale :
206
209
  (location['rightMax']['x'] - location['leftMax']['x']) * scale;
207
- if (!isNullOrUndefined(_this.maps.dataLabelShape)) {
210
+ if (!isNullOrUndefined(_this.maps.dataLabelShape) && !_this.maps.isReset) {
208
211
  shapeWidth = firstLevelMapLocation['rightMax']['x'] - firstLevelMapLocation['leftMax']['x'];
209
212
  _this.maps.dataLabelShape.push(shapeWidth);
210
213
  }
@@ -230,8 +233,9 @@ var DataLabel = /** @class */ (function () {
230
233
  locationX = location1['x'];
231
234
  location['x'] = location1['x'];
232
235
  width = zoomLabelsPosition && scaleZoomValue > 1 && !_this.maps.zoomNotApplied
233
- && _this.maps.zoomShapeCollection.length > index ? _this.maps.zoomShapeCollection[index]['width'] :
234
- (location1['rightMax']['x'] - location1['leftMax']['x']) * scale;
236
+ && _this.maps.zoomShapeCollection.length > index ? (_this.maps.dataLabelShape[index]) * scale :
237
+ ((location1['rightMax']['x'] - location1['leftMax']['x']) * scale) > 0 ?
238
+ ((location1['rightMax']['x'] - location1['leftMax']['x']) * scale) : width;
235
239
  }
236
240
  var xpositionEnds = ((location['x'] + transPoint['x']) * scale) + textSize['width'] / 2;
237
241
  var xpositionStart = ((location['x'] + transPoint['x']) * scale) - textSize['width'] / 2;
@@ -218,7 +218,7 @@ var Marker = /** @class */ (function () {
218
218
  }
219
219
  var markerFactor = void 0;
220
220
  if (this.maps.isTileMap || this.maps.baseMapRectBounds['min']['x'] === 0) {
221
- zoomLevel = calculateZoomLevel(minLat_1, maxLat_1, minLong_1, maxLong_1, mapWidth, mapHeight, this.maps);
221
+ zoomLevel = calculateZoomLevel(minLat_1, maxLat_1, minLong_1, maxLong_1, mapWidth, mapHeight, this.maps, false);
222
222
  if (this.maps.isTileMap) {
223
223
  markerFactor = isNullOrUndefined(this.maps.markerZoomFactor) ?
224
224
  zoomLevel : isNullOrUndefined(this.maps.mapScaleValue) ?
@@ -862,6 +862,12 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
862
862
  * @private
863
863
  */
864
864
  mergeCluster(): void;
865
+ /**
866
+ * @param {PointerEvent} e - Specifies the pointer event.
867
+ * @returns {void}
868
+ * @private
869
+ */
870
+ mapsOnRightClick(e: PointerEvent): void;
865
871
  /**
866
872
  * This method is used to perform operations when performing the double click operation on maps.
867
873
  *
package/src/maps/maps.js CHANGED
@@ -30,7 +30,7 @@ import { createStyle } from './utils/helper';
30
30
  import { ZoomSettings, LegendSettings } from './model/base';
31
31
  import { LayerSettings, TitleSettings, Border, Margin, MapsAreaSettings, Annotation, CenterPosition } from './model/base';
32
32
  import { Marker } from './layers/marker';
33
- import { load, click, onclick, loaded, doubleClick, resize, shapeSelected, zoomIn } from './model/constants';
33
+ import { load, click, onclick, rightClick, loaded, doubleClick, resize, shapeSelected, zoomIn } from './model/constants';
34
34
  import { getThemeStyle, Theme } from './model/theme';
35
35
  import { LayerPanel } from './layers/layer-panel';
36
36
  import { Rect, RectOption, measureText, getElementByID, MapAjax, processResult, getElementsByClassName } from '../maps/utils/helper';
@@ -383,7 +383,6 @@ var Maps = /** @class */ (function (_super) {
383
383
  }
384
384
  if (!isNullOrUndefined(this.dataLabelModule)) {
385
385
  this.dataLabelModule.dataLabelCollections = [];
386
- this.dataLabelShape = [];
387
386
  }
388
387
  this.mapLayerPanel.measureLayerPanel();
389
388
  if (!isNullOrUndefined(this.svgObject)) {
@@ -881,7 +880,7 @@ var Maps = /** @class */ (function (_super) {
881
880
  Maps.prototype.wireEVents = function () {
882
881
  //let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
883
882
  EventHandler.add(this.element, 'click', this.mapsOnClick, this);
884
- // EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
883
+ EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
885
884
  EventHandler.add(this.element, 'dblclick', this.mapsOnDoubleClick, this);
886
885
  EventHandler.add(this.element, Browser.touchStartEvent, this.mouseDownOnMap, this);
887
886
  EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap, this);
@@ -901,7 +900,7 @@ var Maps = /** @class */ (function (_super) {
901
900
  Maps.prototype.unWireEVents = function () {
902
901
  //let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
903
902
  EventHandler.remove(this.element, 'click', this.mapsOnClick);
904
- // EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
903
+ EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
905
904
  EventHandler.remove(this.element, 'dblclick', this.mapsOnDoubleClick);
906
905
  EventHandler.remove(this.element, Browser.touchStartEvent, this.mouseDownOnMap);
907
906
  EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap);
@@ -1265,6 +1264,31 @@ var Maps = /** @class */ (function (_super) {
1265
1264
  this.markerModule.sameMarkerData = [];
1266
1265
  }
1267
1266
  };
1267
+ /**
1268
+ * @param {PointerEvent} e - Specifies the pointer event.
1269
+ * @returns {void}
1270
+ * @private
1271
+ */
1272
+ Maps.prototype.mapsOnRightClick = function (e) {
1273
+ var targetEle = e.target;
1274
+ var targetId = targetEle.id;
1275
+ var latitude = null;
1276
+ var longitude = null;
1277
+ this.mouseClickEvent = this.mouseDownEvent = { x: e.x, y: e.y };
1278
+ if (targetEle.id.indexOf('_ToolBar') === -1) {
1279
+ var latLongValue = this.getClickLocation(targetId, e.pageX, e.pageY, targetEle, e['layerX'], e['layerY']);
1280
+ if (!isNullOrUndefined(latLongValue)) {
1281
+ latitude = latLongValue.latitude;
1282
+ longitude = latLongValue.longitude;
1283
+ }
1284
+ var eventArgs = {
1285
+ cancel: false, name: rightClick, target: targetId, x: e.clientX, y: e.clientY,
1286
+ latitude: latitude, longitude: longitude,
1287
+ isShapeSelected: false
1288
+ };
1289
+ this.trigger('rightClick', eventArgs);
1290
+ }
1291
+ };
1268
1292
  /**
1269
1293
  * This method is used to perform operations when performing the double click operation on maps.
1270
1294
  *
@@ -1702,7 +1726,7 @@ var Maps = /** @class */ (function (_super) {
1702
1726
  this.maxLatOfGivenLocation = maxLatitude;
1703
1727
  this.maxLongOfGivenLocation = maxLongitude;
1704
1728
  this.zoomNotApplied = true;
1705
- this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this);
1729
+ this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this, true);
1706
1730
  var zoomArgs = {
1707
1731
  cancel: false, name: 'zoom', type: zoomIn, maps: this,
1708
1732
  tileTranslatePoint: {}, translatePoint: {},
@@ -1162,7 +1162,7 @@ export declare function compareZoomFactor(scaleFactor: number, maps: Maps): void
1162
1162
  * @param {Maps} maps - Specifies the instance of the maps
1163
1163
  * @returns {number} - Returns the scale factor
1164
1164
  */
1165
- export declare function calculateZoomLevel(minLat: number, maxLat: number, minLong: number, maxLong: number, mapWidth: number, mapHeight: number, maps: Maps): number;
1165
+ export declare function calculateZoomLevel(minLat: number, maxLat: number, minLong: number, maxLong: number, mapWidth: number, mapHeight: number, maps: Maps, isZoomToCoordinates: boolean): number;
1166
1166
  /**
1167
1167
  * Method to get the result
1168
1168
  *
@@ -3260,7 +3260,7 @@ export function compareZoomFactor(scaleFactor, maps) {
3260
3260
  * @param {Maps} maps - Specifies the instance of the maps
3261
3261
  * @returns {number} - Returns the scale factor
3262
3262
  */
3263
- export function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, maps) {
3263
+ export function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, maps, isZoomToCoordinates) {
3264
3264
  var scaleFactor;
3265
3265
  var maxZoomFact = maps.zoomSettings.maxZoom;
3266
3266
  var applyMethodeZoom;
@@ -3273,9 +3273,7 @@ export function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, m
3273
3273
  if (maps.zoomNotApplied && !maps.isTileMap) {
3274
3274
  var latiRatio = Math.abs((maps.baseMapBounds.latitude.max - maps.baseMapBounds.latitude.min) / (maxLat - minLat));
3275
3275
  var longiRatio = Math.abs((maps.baseMapBounds.longitude.max - maps.baseMapBounds.longitude.min) / (maxLong - minLong));
3276
- applyMethodeZoom = Math.min(latiRatio, longiRatio);
3277
- var minLocation = convertGeoToPoint(minLat, minLong, 1, maps.layersCollection[0], maps);
3278
- var maxLocation = convertGeoToPoint(maxLat, maxLong, 1, maps.layersCollection[0], maps);
3276
+ applyMethodeZoom = isZoomToCoordinates ? (latiRatio + longiRatio) / 2 : Math.min(latiRatio, longiRatio);
3279
3277
  }
3280
3278
  var latRatio = (maxLatValue - minLatValue) / Math.PI;
3281
3279
  var lngDiff = maxLong - minLong;
@@ -3284,7 +3282,8 @@ export function calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, m
3284
3282
  var WORLD_PX_WIDTH = 256;
3285
3283
  var latZoom = (Math.log(mapHeight / WORLD_PX_HEIGHT / latRatio) / Math.LN2);
3286
3284
  var lngZoom = (Math.log(mapWidth / WORLD_PX_WIDTH / lngRatio) / Math.LN2);
3287
- var result = (maps.zoomNotApplied && !maps.isTileMap) ? applyMethodeZoom : Math.min(latZoom, lngZoom);
3285
+ var result = (maps.zoomNotApplied && !maps.isTileMap) ? applyMethodeZoom :
3286
+ isZoomToCoordinates && !maps.isTileMap ? (latZoom + lngZoom) / 2 : Math.min(latZoom, lngZoom);
3288
3287
  scaleFactor = Math.min(result, maxZoomFact);
3289
3288
  scaleFactor = maps.isTileMap || !maps.zoomNotApplied ? Math.floor(scaleFactor) : scaleFactor;
3290
3289
  if (!maps.isTileMap) {