@syncfusion/ej2-maps 20.4.54 → 21.1.37
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 +5 -27
- 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 +952 -222
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +967 -222
- 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 +13 -13
- package/src/maps/layers/bubble.d.ts +2 -0
- package/src/maps/layers/bubble.js +2 -1
- package/src/maps/layers/color-mapping.d.ts +1 -0
- package/src/maps/layers/color-mapping.js +1 -0
- package/src/maps/layers/data-label.d.ts +1 -0
- package/src/maps/layers/data-label.js +1 -0
- package/src/maps/layers/layer-panel.js +1 -0
- package/src/maps/layers/legend.d.ts +2 -0
- package/src/maps/layers/legend.js +2 -0
- package/src/maps/layers/marker.d.ts +5 -0
- package/src/maps/layers/marker.js +41 -2
- package/src/maps/layers/navigation-selected-line.d.ts +1 -0
- package/src/maps/layers/navigation-selected-line.js +1 -0
- package/src/maps/maps-model.d.ts +47 -33
- package/src/maps/maps.d.ts +138 -88
- package/src/maps/maps.js +188 -56
- package/src/maps/model/base-model.d.ts +535 -230
- package/src/maps/model/base.d.ts +540 -263
- package/src/maps/model/base.js +168 -28
- package/src/maps/model/constants.d.ts +12 -0
- package/src/maps/model/constants.js +12 -0
- package/src/maps/model/export-image.d.ts +1 -1
- package/src/maps/model/export-image.js +1 -1
- package/src/maps/model/export-pdf.d.ts +2 -2
- package/src/maps/model/export-pdf.js +2 -2
- package/src/maps/model/interface.d.ts +137 -108
- package/src/maps/model/theme.d.ts +1 -0
- package/src/maps/model/theme.js +1 -0
- package/src/maps/user-interaction/annotation.d.ts +2 -0
- package/src/maps/user-interaction/annotation.js +2 -0
- package/src/maps/user-interaction/highlight.d.ts +1 -0
- package/src/maps/user-interaction/highlight.js +1 -0
- package/src/maps/user-interaction/selection.d.ts +1 -0
- package/src/maps/user-interaction/selection.js +1 -0
- package/src/maps/user-interaction/tooltip.d.ts +16 -0
- package/src/maps/user-interaction/tooltip.js +23 -6
- package/src/maps/user-interaction/zoom.d.ts +99 -3
- package/src/maps/user-interaction/zoom.js +405 -100
- package/src/maps/utils/enum.d.ts +105 -91
- package/src/maps/utils/helper.d.ts +75 -15
- package/src/maps/utils/helper.js +118 -32
package/src/maps/maps.js
CHANGED
|
@@ -24,7 +24,7 @@ import { Component, NotifyPropertyChanges, Property, Ajax } from '@syncfusion/ej
|
|
|
24
24
|
import { EventHandler, Browser, isNullOrUndefined, createElement, setValue, extend } from '@syncfusion/ej2-base';
|
|
25
25
|
import { Event, remove, L10n, Collection, Internationalization, Complex } from '@syncfusion/ej2-base';
|
|
26
26
|
import { SvgRenderer } from '@syncfusion/ej2-svg-base';
|
|
27
|
-
import { Size, createSvg, Point, removeElement, triggerShapeEvent, showTooltip, checkShapeDataFields, getMousePosition, calculateSize } from './utils/helper';
|
|
27
|
+
import { Size, createSvg, Point, removeElement, triggerShapeEvent, showTooltip, checkShapeDataFields, MapLocation, getMousePosition, calculateSize } from './utils/helper';
|
|
28
28
|
import { getElement, removeClass, getTranslate, triggerItemSelectionEvent, mergeSeparateCluster, customizeStyle, querySelector } from './utils/helper';
|
|
29
29
|
import { createStyle } from './utils/helper';
|
|
30
30
|
import { ZoomSettings, LegendSettings } from './model/base';
|
|
@@ -34,13 +34,14 @@ import { load, click, onclick, rightClick, loaded, doubleClick, resize, shapeSel
|
|
|
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';
|
|
37
|
-
import { findPosition, textTrim, TextOption, renderTextElement, calculateZoomLevel } from '../maps/utils/helper';
|
|
37
|
+
import { findPosition, textTrim, TextOption, renderTextElement, calculateZoomLevel, convertTileLatLongToPoint, convertGeoToPoint } from '../maps/utils/helper';
|
|
38
38
|
import { Annotations } from '../maps/user-interaction/annotation';
|
|
39
39
|
import { MarkerSettings } from './index';
|
|
40
40
|
import { changeBorderWidth } from './index';
|
|
41
41
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
42
42
|
/**
|
|
43
|
-
* Represents the
|
|
43
|
+
* Represents the maps control. It is ideal for rendering maps from GeoJSON data or other map providers like OpenStreetMap, Google Maps, Bing Maps, etc that
|
|
44
|
+
* has rich feature set that includes markers, labels, bubbles and much more.
|
|
44
45
|
* ```html
|
|
45
46
|
* <div id="maps"/>
|
|
46
47
|
* <script>
|
|
@@ -136,6 +137,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
136
137
|
/** @private */
|
|
137
138
|
_this.initialTileTranslate = new Point(0, 0);
|
|
138
139
|
/** @private */
|
|
140
|
+
_this.markerDragId = '';
|
|
141
|
+
/** @private */
|
|
139
142
|
_this.initialCheck = true;
|
|
140
143
|
/** @private */
|
|
141
144
|
_this.applyZoomReset = false;
|
|
@@ -144,8 +147,13 @@ var Maps = /** @class */ (function (_super) {
|
|
|
144
147
|
/** @private */
|
|
145
148
|
_this.markerClusterExpand = false;
|
|
146
149
|
/** @private */
|
|
150
|
+
_this.mouseMoveId = '';
|
|
151
|
+
/** @private */
|
|
147
152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
153
|
_this.shapeSelectionItem = [];
|
|
154
|
+
/** @private */
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
|
+
_this.markerDragArgument = null;
|
|
149
157
|
setValue('mergePersistData', _this.mergePersistMapsData, _this);
|
|
150
158
|
return _this;
|
|
151
159
|
}
|
|
@@ -154,7 +162,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
154
162
|
*
|
|
155
163
|
* Specifies whether the shape is selected in the maps or not.
|
|
156
164
|
*
|
|
157
|
-
* @returns {boolean} - Returns
|
|
165
|
+
* @returns {boolean} - Returns a boolean value to specify whether the shape is selected in the maps or not.
|
|
158
166
|
*/
|
|
159
167
|
get: function () {
|
|
160
168
|
return this.mapSelect;
|
|
@@ -201,6 +209,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
201
209
|
*
|
|
202
210
|
* @param {string} key - Specifies the key
|
|
203
211
|
* @returns {string} - Returns the string value
|
|
212
|
+
* @private
|
|
204
213
|
*/
|
|
205
214
|
Maps.prototype.getLocalizedLabel = function (key) {
|
|
206
215
|
return this.localeObject.getConstant(key);
|
|
@@ -343,6 +352,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
343
352
|
* @param {LayerSettings} layer - Specifies the layer for the maps.
|
|
344
353
|
* @param {string} dataType - Specifies the data type for maps.
|
|
345
354
|
* @returns {void}
|
|
355
|
+
* @private
|
|
346
356
|
*/
|
|
347
357
|
Maps.prototype.processResponseJsonData = function (processType, data, layer, dataType) {
|
|
348
358
|
this.serverProcess['response']++;
|
|
@@ -485,6 +495,9 @@ var Maps = /** @class */ (function (_super) {
|
|
|
485
495
|
}
|
|
486
496
|
}
|
|
487
497
|
this.zoomingChange();
|
|
498
|
+
if (this.zoomModule && this.isDevice) {
|
|
499
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.mapScaleValue, this.element.id + '_Zooming_');
|
|
500
|
+
}
|
|
488
501
|
if (!this.isZoomByPosition && !this.zoomNotApplied) {
|
|
489
502
|
this.trigger(loaded, { maps: this, isResized: this.isResize });
|
|
490
503
|
}
|
|
@@ -916,6 +929,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
916
929
|
*
|
|
917
930
|
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
918
931
|
* @returns {void}
|
|
932
|
+
* @private
|
|
919
933
|
*/
|
|
920
934
|
Maps.prototype.mouseLeaveOnMap = function (e) {
|
|
921
935
|
if (document.getElementsByClassName('highlightMapStyle').length > 0 && this.legendModule) {
|
|
@@ -961,6 +975,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
961
975
|
};
|
|
962
976
|
Maps.prototype.keyDownHandler = function (event) {
|
|
963
977
|
var zoom = this.zoomModule;
|
|
978
|
+
var id = event.target['id'];
|
|
964
979
|
if ((event.code === 'ArrowUp' || event.code === 'ArrowDown' || event.code === 'ArrowLeft'
|
|
965
980
|
|| event.code === 'ArrowRight') && zoom) {
|
|
966
981
|
var animatedTiles = document.getElementById(this.element.id + '_animated_tiles');
|
|
@@ -968,16 +983,18 @@ var Maps = /** @class */ (function (_super) {
|
|
|
968
983
|
this.currentTiles = animatedTiles.cloneNode(true);
|
|
969
984
|
}
|
|
970
985
|
}
|
|
971
|
-
if ((event.key === '+' || event.code === 'Equal')
|
|
986
|
+
if (this.zoomSettings.enable && zoom && (event.key === '+' || event.code === 'Equal')) {
|
|
972
987
|
zoom.performZoomingByToolBar('zoomin');
|
|
973
988
|
}
|
|
974
|
-
else if ((event.key === '-' || event.code === 'Minus')
|
|
989
|
+
else if (this.zoomSettings.enable && zoom && (event.key === '-' || event.code === 'Minus')) {
|
|
975
990
|
zoom.performZoomingByToolBar('zoomout');
|
|
976
991
|
}
|
|
977
|
-
else if (event['keyCode'] === 82
|
|
992
|
+
else if (this.zoomSettings.enable && zoom && event['keyCode'] === 82) {
|
|
978
993
|
zoom.performZoomingByToolBar('reset');
|
|
994
|
+
zoom.isPanning = false;
|
|
979
995
|
}
|
|
980
|
-
else if (
|
|
996
|
+
else if (this.zoomSettings.enable && this.zoomSettings.enablePanning && zoom
|
|
997
|
+
&& (event.code === 'ArrowUp' || event.code === 'ArrowDown')) {
|
|
981
998
|
event.preventDefault();
|
|
982
999
|
zoom.mouseDownLatLong['x'] = 0;
|
|
983
1000
|
zoom.mouseMoveLatLong['y'] = this.mapAreaRect.height / 7;
|
|
@@ -985,7 +1002,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
985
1002
|
zoom.mouseMoveLatLong['y'], event);
|
|
986
1003
|
zoom.mouseDownLatLong['y'] = zoom.mouseMoveLatLong['y'];
|
|
987
1004
|
}
|
|
988
|
-
else if (
|
|
1005
|
+
else if (this.zoomSettings.enable && this.zoomSettings.enablePanning && zoom
|
|
1006
|
+
&& (event.code === 'ArrowLeft' || event.code === 'ArrowRight')) {
|
|
989
1007
|
event.preventDefault();
|
|
990
1008
|
zoom.mouseDownLatLong['y'] = 0;
|
|
991
1009
|
zoom.mouseMoveLatLong['x'] = this.mapAreaRect.width / 7;
|
|
@@ -993,7 +1011,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
993
1011
|
zoom.mouseDownLatLong['x'] = zoom.mouseMoveLatLong['x'];
|
|
994
1012
|
}
|
|
995
1013
|
else if (event.code === 'Enter') {
|
|
996
|
-
|
|
1014
|
+
id = event.target['id'];
|
|
997
1015
|
event.preventDefault();
|
|
998
1016
|
if (this.legendModule && (id.indexOf('_Left_Page_Rect') > -1 || id.indexOf('_Right_Page_Rect') > -1)) {
|
|
999
1017
|
this.mapAreaRect = this.legendModule.initialMapAreaRect;
|
|
@@ -1023,6 +1041,9 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1023
1041
|
this.keyboardHighlightSelection(id, event.type);
|
|
1024
1042
|
}
|
|
1025
1043
|
}
|
|
1044
|
+
if (this.zoomModule) {
|
|
1045
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.mapScaleValue, this.mouseMoveId);
|
|
1046
|
+
}
|
|
1026
1047
|
};
|
|
1027
1048
|
/**
|
|
1028
1049
|
* Gets the selected element to be maintained or not.
|
|
@@ -1043,6 +1064,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1043
1064
|
*
|
|
1044
1065
|
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
1045
1066
|
* @returns {void}
|
|
1067
|
+
* @private
|
|
1046
1068
|
*/
|
|
1047
1069
|
Maps.prototype.mapsOnClick = function (e) {
|
|
1048
1070
|
var _this = this;
|
|
@@ -1074,6 +1096,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1074
1096
|
});
|
|
1075
1097
|
}
|
|
1076
1098
|
}
|
|
1099
|
+
if (this.zoomModule) {
|
|
1100
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.mapScaleValue, targetId);
|
|
1101
|
+
if (this.isDevice) {
|
|
1102
|
+
this.zoomModule.removeToolbarClass('', '', '', '', '');
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1077
1105
|
};
|
|
1078
1106
|
Maps.prototype.clickHandler = function (e, eventArgs, targetEle) {
|
|
1079
1107
|
if (targetEle.id.indexOf('shapeIndex') > -1) {
|
|
@@ -1105,6 +1133,27 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1105
1133
|
this.selectionModule.removedSelectionList(targetEle);
|
|
1106
1134
|
}
|
|
1107
1135
|
};
|
|
1136
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1137
|
+
Maps.prototype.getMarkerClickLocation = function (pageX, pageY, x, y, marker, isDragEnd) {
|
|
1138
|
+
document.getElementById(this.element.id + "_svg").style.cursor = 'grabbing';
|
|
1139
|
+
var targetElement = getElement(marker.targetId);
|
|
1140
|
+
var latLongValue = this.getClickLocation(marker.targetId, pageX, pageY, targetElement, x, y);
|
|
1141
|
+
var location = (this.isTileMap) ? convertTileLatLongToPoint(new MapLocation(latLongValue.longitude, latLongValue.latitude), this.scale, this.tileTranslatePoint, true) : convertGeoToPoint(latLongValue.latitude, latLongValue.longitude, this.mapLayerPanel.currentFactor, this.layersCollection[marker.layerIndex], this);
|
|
1142
|
+
var transPoint = this.translatePoint;
|
|
1143
|
+
var translateX = (this.isTileMap ? location.x : (location.x + transPoint.x) * this.scale);
|
|
1144
|
+
var translateY = (this.isTileMap ? location.y : (location.y + transPoint.y) * this.scale);
|
|
1145
|
+
if (this.markerDragArgument.shape !== 'Balloon') {
|
|
1146
|
+
targetElement.setAttribute('transform', 'translate( ' + translateX + ' ' + translateY + ' )');
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
targetElement.parentElement.setAttribute('transform', 'translate( ' + translateX + ' ' + translateY + ' )');
|
|
1150
|
+
}
|
|
1151
|
+
if (isDragEnd) {
|
|
1152
|
+
var markerSettings = this.layers[marker.layerIndex].markerSettings[marker.markerIndex];
|
|
1153
|
+
latLongValue = this.getClickLocation(marker.targetId, (pageX - markerSettings.offset.x), (pageY - markerSettings.offset.y), targetElement, (x - markerSettings.offset.x), (y - markerSettings.offset.y));
|
|
1154
|
+
}
|
|
1155
|
+
return latLongValue;
|
|
1156
|
+
};
|
|
1108
1157
|
Maps.prototype.getClickLocation = function (targetId, pageX, pageY, targetElement, x, y) {
|
|
1109
1158
|
var layerIndex = 0;
|
|
1110
1159
|
var latLongValue;
|
|
@@ -1167,6 +1216,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1167
1216
|
*
|
|
1168
1217
|
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
1169
1218
|
* @returns {boolean} - Returns the boolean value
|
|
1219
|
+
* @private
|
|
1170
1220
|
*/
|
|
1171
1221
|
Maps.prototype.mouseEndOnMap = function (e) {
|
|
1172
1222
|
var targetEle = e.target;
|
|
@@ -1177,13 +1227,16 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1177
1227
|
var pageY;
|
|
1178
1228
|
var target;
|
|
1179
1229
|
var touchArg;
|
|
1230
|
+
var layerX = 0;
|
|
1231
|
+
var layerY = 0;
|
|
1180
1232
|
var rect = this.element.getBoundingClientRect();
|
|
1181
1233
|
var element = e.target;
|
|
1182
1234
|
if (e.type.indexOf('touch') !== -1) {
|
|
1183
1235
|
this.isTouch = true;
|
|
1184
1236
|
touchArg = e;
|
|
1185
|
-
pageX = touchArg.changedTouches[0].pageX;
|
|
1237
|
+
layerX = pageX = touchArg.changedTouches[0].pageX;
|
|
1186
1238
|
pageY = touchArg.changedTouches[0].pageY;
|
|
1239
|
+
layerY = pageY - (this.isTileMap ? 10 : 0);
|
|
1187
1240
|
target = touchArg.target;
|
|
1188
1241
|
this.mouseClickEvent = { x: pageX, y: pageY };
|
|
1189
1242
|
}
|
|
@@ -1191,6 +1244,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1191
1244
|
this.isTouch = e.pointerType === 'touch';
|
|
1192
1245
|
pageX = e.pageX;
|
|
1193
1246
|
pageY = e.pageY;
|
|
1247
|
+
layerX = e['layerX'];
|
|
1248
|
+
layerY = e['layerY'] - (this.isTileMap ? 10 : 0);
|
|
1194
1249
|
target = e.target;
|
|
1195
1250
|
}
|
|
1196
1251
|
if (this.isTileMap) {
|
|
@@ -1213,6 +1268,45 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1213
1268
|
if (e.cancelable && !this.isTouch) {
|
|
1214
1269
|
e.preventDefault();
|
|
1215
1270
|
}
|
|
1271
|
+
if (!isNullOrUndefined(this.markerDragArgument)) {
|
|
1272
|
+
var marker = this.markerDragArgument;
|
|
1273
|
+
this.mouseClickEvent['x'] = this.mouseDownEvent['x'];
|
|
1274
|
+
this.mouseClickEvent['y'] = this.mouseDownEvent['y'];
|
|
1275
|
+
var latLongValue = this.getMarkerClickLocation(pageX, pageY, layerX, layerY, this.markerDragArgument, true);
|
|
1276
|
+
var markerObject = this.layers[marker.layerIndex].markerSettings[marker.markerIndex];
|
|
1277
|
+
document.getElementById(this.element.id + "_svg").style.cursor = markerObject.enableDrag ? 'pointer' : 'grabbing';
|
|
1278
|
+
var dragEventArgs = {
|
|
1279
|
+
name: 'markerDragEnd', x: pageX, y: pageY,
|
|
1280
|
+
latitude: latLongValue.latitude, longitude: latLongValue.longitude,
|
|
1281
|
+
layerIndex: marker.layerIndex, markerIndex: marker.markerIndex,
|
|
1282
|
+
dataIndex: marker.dataIndex
|
|
1283
|
+
};
|
|
1284
|
+
if (isNullOrUndefined(markerObject.latitudeValuePath) && isNullOrUndefined(markerObject.longitudeValuePath)) {
|
|
1285
|
+
var data = markerObject.dataSource[marker.dataIndex];
|
|
1286
|
+
if (!isNullOrUndefined(data['Longitude']) && !isNullOrUndefined(data['Latitude'])) {
|
|
1287
|
+
markerObject.dataSource[marker.dataIndex].Latitude = dragEventArgs.latitude;
|
|
1288
|
+
markerObject.dataSource[marker.dataIndex].Longitude = dragEventArgs.longitude;
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
markerObject.dataSource[marker.dataIndex].latitude = dragEventArgs.latitude;
|
|
1292
|
+
markerObject.dataSource[marker.dataIndex].longitude = dragEventArgs.longitude;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
else {
|
|
1296
|
+
markerObject.dataSource[marker.dataIndex][markerObject.latitudeValuePath] = dragEventArgs.latitude;
|
|
1297
|
+
markerObject.dataSource[marker.dataIndex][markerObject.longitudeValuePath] = dragEventArgs.longitude;
|
|
1298
|
+
}
|
|
1299
|
+
this.markerDragId = '';
|
|
1300
|
+
this.markerDragArgument = null;
|
|
1301
|
+
this.trigger('markerDragEnd', dragEventArgs);
|
|
1302
|
+
}
|
|
1303
|
+
else {
|
|
1304
|
+
document.getElementById(this.element.id + "_svg").style.cursor = 'auto';
|
|
1305
|
+
}
|
|
1306
|
+
if (this.zoomModule && this.isDevice) {
|
|
1307
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.scale, this.element.id + '_Zooming_');
|
|
1308
|
+
this.zoomModule.removeToolbarClass('', '', '', '', '');
|
|
1309
|
+
}
|
|
1216
1310
|
return false;
|
|
1217
1311
|
};
|
|
1218
1312
|
/**
|
|
@@ -1220,6 +1314,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1220
1314
|
*
|
|
1221
1315
|
* @param {PointerEvent} e - Specifies the pointer event on maps
|
|
1222
1316
|
* @returns {void}
|
|
1317
|
+
* @private
|
|
1223
1318
|
*/
|
|
1224
1319
|
Maps.prototype.mouseDownOnMap = function (e) {
|
|
1225
1320
|
var pageX;
|
|
@@ -1230,8 +1325,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1230
1325
|
if (e.type.indexOf('touch') !== -1 && e.changedTouches) {
|
|
1231
1326
|
this.mouseDownEvent = { x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY };
|
|
1232
1327
|
}
|
|
1328
|
+
if (this.isDevice) {
|
|
1329
|
+
this.mapsTooltipModule.renderTooltip(e);
|
|
1330
|
+
}
|
|
1233
1331
|
var rect = this.element.getBoundingClientRect();
|
|
1234
1332
|
var element = e.target;
|
|
1333
|
+
this.markerDragId = element.id;
|
|
1235
1334
|
var animatedTiles = document.getElementById(this.element.id + '_animated_tiles');
|
|
1236
1335
|
if (this.isTileMap && !isNullOrUndefined(animatedTiles)) {
|
|
1237
1336
|
this.currentTiles = animatedTiles.cloneNode(true);
|
|
@@ -1294,6 +1393,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1294
1393
|
*
|
|
1295
1394
|
* @param {PointerEvent} e - Specifies the pointer event.
|
|
1296
1395
|
* @returns {void}
|
|
1396
|
+
* @private
|
|
1297
1397
|
*/
|
|
1298
1398
|
Maps.prototype.mapsOnDoubleClick = function (e) {
|
|
1299
1399
|
this.notify('dblclick', e);
|
|
@@ -1329,6 +1429,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1329
1429
|
*
|
|
1330
1430
|
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
1331
1431
|
* @returns {void}
|
|
1432
|
+
* @private
|
|
1332
1433
|
*/
|
|
1333
1434
|
Maps.prototype.mouseMoveOnMap = function (e) {
|
|
1334
1435
|
var pageX;
|
|
@@ -1348,6 +1449,9 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1348
1449
|
if (this.bubbleModule) {
|
|
1349
1450
|
this.bubbleModule.bubbleMove(e);
|
|
1350
1451
|
}
|
|
1452
|
+
if (target.id.indexOf('MarkerIndex') == -1) {
|
|
1453
|
+
document.getElementById(this.element.id + "_svg").style.cursor = 'auto';
|
|
1454
|
+
}
|
|
1351
1455
|
this.onMouseMove(e);
|
|
1352
1456
|
this.notify(Browser.touchMoveEvent, e);
|
|
1353
1457
|
};
|
|
@@ -1356,19 +1460,42 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1356
1460
|
*
|
|
1357
1461
|
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
1358
1462
|
* @returns {void}
|
|
1463
|
+
* @private
|
|
1359
1464
|
*/
|
|
1360
1465
|
Maps.prototype.onMouseMove = function (e) {
|
|
1361
1466
|
var element = e.target;
|
|
1467
|
+
this.mouseMoveId = element['id'];
|
|
1362
1468
|
var pageX;
|
|
1363
1469
|
var pageY;
|
|
1364
1470
|
var target;
|
|
1365
1471
|
var touchArg;
|
|
1366
|
-
|
|
1472
|
+
var touches = null;
|
|
1473
|
+
var layerX = 0;
|
|
1474
|
+
var layerY = 0;
|
|
1475
|
+
if (e.type.indexOf('touch') == -1) {
|
|
1476
|
+
pageX = e.pageX;
|
|
1477
|
+
pageY = e.pageY;
|
|
1478
|
+
layerX = e['layerX'];
|
|
1479
|
+
layerY = e['layerY'] - (this.isTileMap ? 10 : 0);
|
|
1367
1480
|
this.titleTooltip(e, e.pageX, e.pageY);
|
|
1368
1481
|
if (!isNullOrUndefined(this.legendModule)) {
|
|
1369
1482
|
this.legendTooltip(e, e.pageX, e.pageY, true);
|
|
1370
1483
|
}
|
|
1371
1484
|
}
|
|
1485
|
+
else {
|
|
1486
|
+
touches = e.touches;
|
|
1487
|
+
layerX = pageX = touches[0].clientX;
|
|
1488
|
+
layerY = pageY = touches[0].clientY - (this.isTileMap ? 10 : 0);
|
|
1489
|
+
}
|
|
1490
|
+
if (!isNullOrUndefined(this.markerDragArgument)) {
|
|
1491
|
+
var marker = this.markerDragArgument;
|
|
1492
|
+
this.mouseClickEvent['x'] = this.mouseDownEvent['x'];
|
|
1493
|
+
this.mouseClickEvent['y'] = this.mouseDownEvent['y'];
|
|
1494
|
+
this.getMarkerClickLocation(pageX, pageY, layerX, layerY, marker, false);
|
|
1495
|
+
}
|
|
1496
|
+
if (this.zoomModule) {
|
|
1497
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.scale, e.target.id);
|
|
1498
|
+
}
|
|
1372
1499
|
return false;
|
|
1373
1500
|
};
|
|
1374
1501
|
Maps.prototype.legendTooltip = function (event, x, y, isTouch) {
|
|
@@ -1451,10 +1578,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1451
1578
|
/**
|
|
1452
1579
|
* This method is used to zoom the map by specifying the center position.
|
|
1453
1580
|
*
|
|
1454
|
-
* @param {number} centerPosition - Specifies the
|
|
1455
|
-
* @param {number}
|
|
1456
|
-
* @param {number} centerPosition.longitude - Specifies the longitude value for the center position
|
|
1457
|
-
* @param {number} zoomFactor - Specifies the zoom factor for maps.
|
|
1581
|
+
* @param {number} centerPosition - Specifies the location of the maps to be zoomed as geographical coordinates.
|
|
1582
|
+
* @param {number} zoomFactor - Specifies the zoom factor for the maps.
|
|
1458
1583
|
* @returns {void}
|
|
1459
1584
|
*/
|
|
1460
1585
|
Maps.prototype.zoomByPosition = function (centerPosition, zoomFactor) {
|
|
@@ -1491,8 +1616,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1491
1616
|
/**
|
|
1492
1617
|
* This method is used to perform panning by specifying the direction.
|
|
1493
1618
|
*
|
|
1494
|
-
* @param {PanDirection} direction - Specifies the direction in which the panning
|
|
1495
|
-
* @param {PointerEvent | TouchEvent} mouseLocation - Specifies the location of the mouse pointer in maps.
|
|
1619
|
+
* @param {PanDirection} direction - Specifies the direction in which the panning must be performed.
|
|
1620
|
+
* @param {PointerEvent | TouchEvent} mouseLocation - Specifies the location of the mouse pointer in maps in pixels.
|
|
1496
1621
|
* @returns {void}
|
|
1497
1622
|
*/
|
|
1498
1623
|
Maps.prototype.panByDirection = function (direction, mouseLocation) {
|
|
@@ -1521,7 +1646,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1521
1646
|
/**
|
|
1522
1647
|
* This method is used to add the layers dynamically to the maps.
|
|
1523
1648
|
*
|
|
1524
|
-
* @param {Object} layer - Specifies the layer
|
|
1649
|
+
* @param {Object} layer - Specifies the layer to be added in the maps.
|
|
1525
1650
|
* @returns {void}
|
|
1526
1651
|
*/
|
|
1527
1652
|
Maps.prototype.addLayer = function (layer) {
|
|
@@ -1533,7 +1658,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1533
1658
|
}
|
|
1534
1659
|
};
|
|
1535
1660
|
/**
|
|
1536
|
-
* This method is used to remove a layer from
|
|
1661
|
+
* This method is used to remove a layer from the maps.
|
|
1537
1662
|
*
|
|
1538
1663
|
* @param {number} index - Specifies the index number of the layer to be removed.
|
|
1539
1664
|
* @returns {void}
|
|
@@ -1547,7 +1672,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1547
1672
|
};
|
|
1548
1673
|
/**
|
|
1549
1674
|
* This method is used to add markers dynamically in the maps.
|
|
1550
|
-
* If we provide the index value of the layer in which the marker to be added and the
|
|
1675
|
+
* If we provide the index value of the layer in which the marker to be added and the settings
|
|
1551
1676
|
* of the marker as parameters, the marker will be added in the location.
|
|
1552
1677
|
*
|
|
1553
1678
|
* @param {number} layerIndex - Specifies the index number of the layer.
|
|
@@ -1569,12 +1694,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1569
1694
|
}
|
|
1570
1695
|
};
|
|
1571
1696
|
/**
|
|
1572
|
-
* This method is used to select the geometric shape element in the maps
|
|
1697
|
+
* This method is used to select the geometric shape element in the maps.
|
|
1573
1698
|
*
|
|
1574
1699
|
* @param {number} layerIndex - Specifies the index of the layer in maps.
|
|
1575
1700
|
* @param {string | string[]} propertyName - Specifies the property name from the data source.
|
|
1576
|
-
* @param {string} name - Specifies the name of the shape that is selected.
|
|
1577
|
-
* @param {boolean} enable - Specifies the shape selection
|
|
1701
|
+
* @param {string} name - Specifies the name of the shape, which is mapped from the data source, that is selected.
|
|
1702
|
+
* @param {boolean} enable - Specifies whether the shape should be selected or the selection should be removed.
|
|
1578
1703
|
* @returns {void}
|
|
1579
1704
|
*/
|
|
1580
1705
|
Maps.prototype.shapeSelection = function (layerIndex, propertyName, name, enable) {
|
|
@@ -1678,12 +1803,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1678
1803
|
}
|
|
1679
1804
|
};
|
|
1680
1805
|
/**
|
|
1681
|
-
* This method is used to zoom the maps
|
|
1806
|
+
* This method is used to zoom the maps based on the provided coordinates.
|
|
1682
1807
|
*
|
|
1683
|
-
* @param {number} minLatitude - Specifies the minimum latitude to be zoomed.
|
|
1684
|
-
* @param {number} minLongitude - Specifies the minimum latitude to be zoomed.
|
|
1685
|
-
* @param {number} maxLatitude - Specifies the maximum latitude to be zoomed.
|
|
1686
|
-
* @param {number} maxLongitude - Specifies the maximum longitude to be zoomed.
|
|
1808
|
+
* @param {number} minLatitude - Specifies the minimum latitude of the location to be zoomed.
|
|
1809
|
+
* @param {number} minLongitude - Specifies the minimum latitude of the location to be zoomed.
|
|
1810
|
+
* @param {number} maxLatitude - Specifies the maximum latitude of the location to be zoomed.
|
|
1811
|
+
* @param {number} maxLongitude - Specifies the maximum longitude of the location to be zoomed.
|
|
1687
1812
|
* @returns {void}
|
|
1688
1813
|
*/
|
|
1689
1814
|
Maps.prototype.zoomToCoordinates = function (minLatitude, minLongitude, maxLatitude, maxLongitude) {
|
|
@@ -1760,7 +1885,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1760
1885
|
this.legendSelectionCollection = [];
|
|
1761
1886
|
};
|
|
1762
1887
|
/**
|
|
1763
|
-
* This method is used to set culture for maps
|
|
1888
|
+
* This method is used to set culture for maps.
|
|
1764
1889
|
*
|
|
1765
1890
|
* @returns {void}
|
|
1766
1891
|
*/
|
|
@@ -1770,7 +1895,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1770
1895
|
this.localeObject = new L10n(this.getModuleName(), this.defaultLocalConstants, this.locale);
|
|
1771
1896
|
};
|
|
1772
1897
|
/**
|
|
1773
|
-
* This method to set locale constants to the maps
|
|
1898
|
+
* This method to set locale constants to the maps.
|
|
1774
1899
|
*
|
|
1775
1900
|
* @returns {void}
|
|
1776
1901
|
*/
|
|
@@ -1786,7 +1911,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1786
1911
|
};
|
|
1787
1912
|
};
|
|
1788
1913
|
/**
|
|
1789
|
-
* This method disposes the maps
|
|
1914
|
+
* This method destroys the maps. This method removes the events associated with the maps and disposes the objects created for rendering and updating the maps.
|
|
1790
1915
|
*
|
|
1791
1916
|
* @returns {void}
|
|
1792
1917
|
*/
|
|
@@ -1823,6 +1948,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1823
1948
|
* Gets component name
|
|
1824
1949
|
*
|
|
1825
1950
|
* @returns {string} - Returns the string value
|
|
1951
|
+
* @private
|
|
1826
1952
|
*/
|
|
1827
1953
|
Maps.prototype.getModuleName = function () {
|
|
1828
1954
|
return 'maps';
|
|
@@ -2137,7 +2263,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2137
2263
|
return isVisible;
|
|
2138
2264
|
};
|
|
2139
2265
|
/**
|
|
2140
|
-
* This method handles the printing functionality for the maps
|
|
2266
|
+
* This method handles the printing functionality for the maps.
|
|
2141
2267
|
*
|
|
2142
2268
|
* @param {string[] | string | Element} id - Specifies the element to be printed.
|
|
2143
2269
|
* @returns {void}
|
|
@@ -2148,13 +2274,13 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2148
2274
|
}
|
|
2149
2275
|
};
|
|
2150
2276
|
/**
|
|
2151
|
-
* This method handles the export functionality for the maps
|
|
2277
|
+
* This method handles the export functionality for the maps.
|
|
2152
2278
|
*
|
|
2153
2279
|
* @param {ExportType} type - Specifies the type of the exported file.
|
|
2154
2280
|
* @param {string} fileName - Specifies the name of the file with which the rendered maps need to be exported.
|
|
2155
|
-
* @param {PdfPageOrientation} orientation - Specifies the orientation of the
|
|
2156
|
-
* @param {boolean} allowDownload - Specifies whether to download as a file or get as base64 string for the file
|
|
2157
|
-
* @returns {Promise<string>} -
|
|
2281
|
+
* @param {PdfPageOrientation} orientation - Specifies the orientation of the PDF document while exporting.
|
|
2282
|
+
* @param {boolean} allowDownload - Specifies whether to download as a file or get as base64 string for the file.
|
|
2283
|
+
* @returns {Promise<string>} - Specifies the base64 string of the exported image which is returned when the `allowDownload` is set to false.
|
|
2158
2284
|
*/
|
|
2159
2285
|
Maps.prototype.export = function (type, fileName, orientation, allowDownload) {
|
|
2160
2286
|
var _this = this;
|
|
@@ -2178,8 +2304,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2178
2304
|
/**
|
|
2179
2305
|
* This method is used to get the Bing maps URL.
|
|
2180
2306
|
*
|
|
2181
|
-
* @param {string} url - Specifies the URL of the maps.
|
|
2182
|
-
* @returns {Promise<string>} - Returns the processed Bing URL as Promise
|
|
2307
|
+
* @param {string} url - Specifies the URL of the Bing maps along with the API key.
|
|
2308
|
+
* @returns {Promise<string>} - Returns the processed Bing URL as `Promise`.
|
|
2183
2309
|
*/
|
|
2184
2310
|
Maps.prototype.getBingUrlTemplate = function (url) {
|
|
2185
2311
|
var promise;
|
|
@@ -2270,20 +2396,20 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2270
2396
|
};
|
|
2271
2397
|
};
|
|
2272
2398
|
/**
|
|
2273
|
-
* This method is used to get the
|
|
2399
|
+
* This method is used to get the geographical coordinates for location points in pixels when shape maps are rendered in the maps.
|
|
2274
2400
|
*
|
|
2275
|
-
* @param {number} layerIndex - Specifies the index number of the layer of the
|
|
2276
|
-
* @param {number} x - Specifies the x value.
|
|
2277
|
-
* @param {number} y - Specifies the y value.
|
|
2278
|
-
* @returns {GeoPosition}- Returns the
|
|
2401
|
+
* @param {number} layerIndex - Specifies the index number of the layer of the maps.
|
|
2402
|
+
* @param {number} x - Specifies the x value in pixel.
|
|
2403
|
+
* @param {number} y - Specifies the y value in pixel.
|
|
2404
|
+
* @returns {GeoPosition}- Returns the geographical coordinates.
|
|
2279
2405
|
*/
|
|
2280
2406
|
Maps.prototype.getGeoLocation = function (layerIndex, x, y) {
|
|
2281
2407
|
var latitude = 0;
|
|
2282
2408
|
var longitude = 0;
|
|
2283
2409
|
if (!this.isDestroyed) {
|
|
2284
2410
|
var container = document.getElementById(this.element.id);
|
|
2285
|
-
var pageX = x - container.offsetLeft;
|
|
2286
|
-
var pageY = y - container.offsetTop;
|
|
2411
|
+
var pageX = x - (isNullOrUndefined(this.markerDragArgument) ? container.offsetLeft : 0);
|
|
2412
|
+
var pageY = y - (isNullOrUndefined(this.markerDragArgument) ? container.offsetTop : 0);
|
|
2287
2413
|
var currentLayer = this.layersCollection[layerIndex];
|
|
2288
2414
|
var translate = getTranslate(this, currentLayer, false);
|
|
2289
2415
|
var translatePoint = translate['location'];
|
|
@@ -2302,11 +2428,11 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2302
2428
|
return Math.min(Math.max(value, minVal), maxVal);
|
|
2303
2429
|
};
|
|
2304
2430
|
/**
|
|
2305
|
-
* This method is used to get the
|
|
2431
|
+
* This method is used to get the geographical coordinates for location points in pixels when an online map provider is rendered in the maps.
|
|
2306
2432
|
*
|
|
2307
|
-
* @param {number} x - Specifies the x value
|
|
2308
|
-
* @param {number} y - Specifies the y value
|
|
2309
|
-
* @returns {GeoPosition} - Returns the
|
|
2433
|
+
* @param {number} x - Specifies the x value in pixel.
|
|
2434
|
+
* @param {number} y - Specifies the y value in pixel.
|
|
2435
|
+
* @returns {GeoPosition} - Returns the geographical coordinates.
|
|
2310
2436
|
*/
|
|
2311
2437
|
Maps.prototype.getTileGeoLocation = function (x, y) {
|
|
2312
2438
|
var latitude = 0;
|
|
@@ -2314,25 +2440,25 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2314
2440
|
if (!this.isDestroyed) {
|
|
2315
2441
|
var container = document.getElementById(this.element.id);
|
|
2316
2442
|
var ele = document.getElementById(this.element.id + '_tile_parent');
|
|
2317
|
-
var latLong = this.pointToLatLong(x + this.mapAreaRect.x - (ele.offsetLeft - container.offsetLeft), y + this.mapAreaRect.y - (ele.offsetTop - container.offsetTop));
|
|
2443
|
+
var latLong = this.pointToLatLong(x + this.mapAreaRect.x - (ele.offsetLeft - (isNullOrUndefined(this.markerDragArgument) ? container.offsetLeft : 0)), y + this.mapAreaRect.y - (ele.offsetTop - (isNullOrUndefined(this.markerDragArgument) ? container.offsetTop : 0)));
|
|
2318
2444
|
latitude = latLong['latitude'];
|
|
2319
2445
|
longitude = latLong['longitude'];
|
|
2320
2446
|
}
|
|
2321
2447
|
return { latitude: latitude, longitude: longitude };
|
|
2322
2448
|
};
|
|
2323
2449
|
/**
|
|
2324
|
-
* This method is used to convert the point to latitude and longitude in maps.
|
|
2450
|
+
* This method is used to convert the point in pixels to latitude and longitude in maps.
|
|
2325
2451
|
*
|
|
2326
|
-
* @param {number} pageX - Specifies the x value
|
|
2327
|
-
* @param {number} pageY - Specifies the y value
|
|
2328
|
-
* @returns {Object} - Returns the
|
|
2452
|
+
* @param {number} pageX - Specifies the x position value in pixels.
|
|
2453
|
+
* @param {number} pageY - Specifies the y position value in pixels.
|
|
2454
|
+
* @returns {Object} - Returns the latitude and longitude values.
|
|
2329
2455
|
*/
|
|
2330
2456
|
Maps.prototype.pointToLatLong = function (pageX, pageY) {
|
|
2331
2457
|
var latitude = 0;
|
|
2332
2458
|
var longitude = 0;
|
|
2333
2459
|
if (!this.isDestroyed) {
|
|
2334
2460
|
var padding = this.layers[this.layers.length - 1].layerType === 'GoogleStaticMap' ? 0 : 10;
|
|
2335
|
-
pageY =
|
|
2461
|
+
pageY = pageY + padding;
|
|
2336
2462
|
var mapSize = 256 * Math.pow(2, this.tileZoomLevel);
|
|
2337
2463
|
var x1 = (this.clip(pageX - (this.translatePoint.x * this.scale), 0, mapSize - 1) / mapSize) - 0.5;
|
|
2338
2464
|
var y1 = 0.5 - (this.clip(pageY - (this.translatePoint.y * this.scale), 0, mapSize - 1) / mapSize);
|
|
@@ -2470,6 +2596,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2470
2596
|
__decorate([
|
|
2471
2597
|
Event()
|
|
2472
2598
|
], Maps.prototype, "markerClick", void 0);
|
|
2599
|
+
__decorate([
|
|
2600
|
+
Event()
|
|
2601
|
+
], Maps.prototype, "markerDragStart", void 0);
|
|
2602
|
+
__decorate([
|
|
2603
|
+
Event()
|
|
2604
|
+
], Maps.prototype, "markerDragEnd", void 0);
|
|
2473
2605
|
__decorate([
|
|
2474
2606
|
Event()
|
|
2475
2607
|
], Maps.prototype, "markerClusterClick", void 0);
|