@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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 20.4.48
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.44",
3
+ "_id": "@syncfusion/ej2-maps@20.4.49",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-kIbapKUjj1tBztWAd7E/g7fomL2FOTSnoXV7duLRSUCVfZp7gwIQjIhc5eXch8+uElXzdAv4Fl7s56Yxym24mA==",
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.44.tgz",
27
- "_shasum": "b341ba1e5a519f4842ef787647fd632a6fb3035b",
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.48",
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.48",
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)) {
@@ -433,33 +432,33 @@ var Maps = /** @class */ (function (_super) {
433
432
  var bottom = void 0;
434
433
  var top_1;
435
434
  var left = void 0;
436
- left = parseFloat(tileElement.style.left) + element.offsetLeft;
435
+ left = parseFloat(tileElement.style.left);
437
436
  var titleTextSize = measureText(this.titleSettings.text, this.titleSettings.textStyle);
438
437
  var subTitleTextSize = measureText(this.titleSettings.subtitleSettings.text, this.titleSettings.subtitleSettings.textStyle);
439
438
  if (this.isTileMap && this.isTileMapSubLayer && this.legendSettings.position === 'Bottom' && this.legendSettings.visible) {
440
439
  if (this.legendSettings.mode !== 'Default') {
441
440
  if (titleTextSize.width !== 0 && titleTextSize.height !== 0) {
442
- top_1 = parseFloat(tileElement.style.top) + element.offsetTop + (subTitleTextSize.height / 2)
441
+ top_1 = parseFloat(tileElement.style.top) + (subTitleTextSize.height / 2)
443
442
  - (this.legendModule.legendBorderRect.height / 2);
444
443
  }
445
444
  else {
446
- top_1 = parseFloat(tileElement.style.top) + element.offsetTop - this.mapAreaRect.y;
445
+ top_1 = parseFloat(tileElement.style.top) - this.mapAreaRect.y;
447
446
  }
448
447
  }
449
448
  else {
450
449
  left = this.legendModule.legendBorderRect.x;
451
450
  if (titleTextSize.width !== 0 && titleTextSize.height !== 0) {
452
- top_1 = parseFloat(tileElement.style.top) + element.offsetTop + (subTitleTextSize['height'] / 2)
451
+ top_1 = parseFloat(tileElement.style.top) + (subTitleTextSize['height'] / 2)
453
452
  - this.legendModule.legendBorderRect.y;
454
453
  }
455
454
  else {
456
- top_1 = parseFloat(tileElement.style.top) + element.offsetTop + (subTitleTextSize['height'] / 2);
455
+ top_1 = parseFloat(tileElement.style.top) + (subTitleTextSize['height'] / 2);
457
456
  }
458
457
  }
459
458
  }
460
459
  else {
461
460
  bottom = svg.bottom - tile.bottom - element.offsetTop;
462
- top_1 = parseFloat(tileElement.style.top) + element.offsetTop;
461
+ top_1 = parseFloat(tileElement.style.top);
463
462
  }
464
463
  top_1 = (bottom <= 11) ? top_1 : (!isNullOrUndefined(this.legendModule) && this.legendSettings.position === 'Bottom') ? this.mapAreaRect.y : (top_1 * 2);
465
464
  left = (bottom <= 11) ? left : !isNullOrUndefined(this.legendModule) ? left : (left * 2);
@@ -479,6 +478,7 @@ var Maps = /** @class */ (function (_super) {
479
478
  }
480
479
  }
481
480
  this.element.style.outline = 'none';
481
+ this.element.style.position = 'relative';
482
482
  for (var i = 0; i < document.getElementsByTagName('path').length - 1; i++) {
483
483
  if (document.getElementsByTagName('path')[i].id.indexOf('shapeIndex') > -1) {
484
484
  document.getElementsByTagName('path')[i].style.outline = 'none';
@@ -656,7 +656,7 @@ var Maps = /** @class */ (function (_super) {
656
656
  var secondaryElement = createElement('div', {
657
657
  id: this.element.id + '_Secondary_Element'
658
658
  });
659
- secondaryElement.style.cssText = 'position: absolute;z-index:2;';
659
+ secondaryElement.style.cssText = 'position: relative;z-index:2;';
660
660
  this.element.appendChild(secondaryElement);
661
661
  }
662
662
  };
@@ -880,7 +880,7 @@ var Maps = /** @class */ (function (_super) {
880
880
  Maps.prototype.wireEVents = function () {
881
881
  //let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
882
882
  EventHandler.add(this.element, 'click', this.mapsOnClick, this);
883
- // EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
883
+ EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
884
884
  EventHandler.add(this.element, 'dblclick', this.mapsOnDoubleClick, this);
885
885
  EventHandler.add(this.element, Browser.touchStartEvent, this.mouseDownOnMap, this);
886
886
  EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap, this);
@@ -900,7 +900,7 @@ var Maps = /** @class */ (function (_super) {
900
900
  Maps.prototype.unWireEVents = function () {
901
901
  //let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
902
902
  EventHandler.remove(this.element, 'click', this.mapsOnClick);
903
- // EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
903
+ EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
904
904
  EventHandler.remove(this.element, 'dblclick', this.mapsOnDoubleClick);
905
905
  EventHandler.remove(this.element, Browser.touchStartEvent, this.mouseDownOnMap);
906
906
  EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap);
@@ -1264,6 +1264,31 @@ var Maps = /** @class */ (function (_super) {
1264
1264
  this.markerModule.sameMarkerData = [];
1265
1265
  }
1266
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
+ };
1267
1292
  /**
1268
1293
  * This method is used to perform operations when performing the double click operation on maps.
1269
1294
  *
@@ -1701,7 +1726,7 @@ var Maps = /** @class */ (function (_super) {
1701
1726
  this.maxLatOfGivenLocation = maxLatitude;
1702
1727
  this.maxLongOfGivenLocation = maxLongitude;
1703
1728
  this.zoomNotApplied = true;
1704
- 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);
1705
1730
  var zoomArgs = {
1706
1731
  cancel: false, name: 'zoom', type: zoomIn, maps: this,
1707
1732
  tileTranslatePoint: {}, translatePoint: {},
@@ -681,6 +681,7 @@ var Zoom = /** @class */ (function () {
681
681
  var datalabelTemplateElemement = getElementByID(maps.element.id + '_LayerIndex_'
682
682
  + i + '_Label_Template_Group');
683
683
  if ((!isNullOrUndefined(markerTemplateElement)) && markerTemplateElement.childElementCount > 0) {
684
+ markerTemplateElement.style.visibility = "visible";
684
685
  for (var k = 0; k < markerTemplateElement.childElementCount; k++) {
685
686
  this.markerTranslate(markerTemplateElement.childNodes[k], factor, x, y, scale, 'Template');
686
687
  }
@@ -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
  *
@@ -2023,7 +2023,7 @@ export function getTranslate(mapObject, layer, animate) {
2023
2023
  center = mapObject.zoomSettings.shouldZoomInitially
2024
2024
  && mapObject.markerZoomedState && !mapObject.zoomPersistence ? mapObject.markerZoomCenterPoint :
2025
2025
  mapObject.centerPosition;
2026
- if ((!isNullOrUndefined(centerLongitude) && !isNullOrUndefined(centerLatitude)) || checkMethodeZoom) {
2026
+ if (((!isNullOrUndefined(centerLongitude) && centerLongitude !== 0) && (!isNullOrUndefined(centerLatitude) && centerLatitude !== 0)) || checkMethodeZoom) {
2027
2027
  var leftPosition = (((mapWidth + Math.abs(mapObject.mapAreaRect.width - mapWidth)) / 2) + mapObject.mapAreaRect.x) / factor;
2028
2028
  var topPosition = (((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) + mapObject.mapAreaRect.y) / factor;
2029
2029
  var point = checkMethodeZoom ? calculateCenterFromPixel(mapObject, layer) :
@@ -2207,7 +2207,7 @@ export function getZoomTranslate(mapObject, layer, animate) {
2207
2207
  var factor = animate ? 1 : mapObject.mapScaleValue;
2208
2208
  var mapWidth = Math.abs(max['x'] - min['x']);
2209
2209
  var mapHeight = Math.abs(min['y'] - max['y']);
2210
- if ((!isNullOrUndefined(longitude) && !isNullOrUndefined(latitude)) || checkZoomMethod) {
2210
+ if (((!isNullOrUndefined(longitude) && longitude !== 0) && (!isNullOrUndefined(latitude) && latitude !== 0)) || checkZoomMethod) {
2211
2211
  var topPosition = ((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) / factor;
2212
2212
  var leftPosition = ((mapWidth + Math.abs(mapObject.mapAreaRect.width - mapWidth)) / 2) / factor;
2213
2213
  var point = checkZoomMethod ? calculateCenterFromPixel(mapObject, layer) :
@@ -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) {