@syncfusion/ej2-maps 20.1.59 → 20.2.43
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 +17 -39
- 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 +657 -292
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +651 -286
- 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 +12 -12
- package/src/maps/layers/bing-map.js +9 -3
- package/src/maps/layers/bubble.js +3 -7
- package/src/maps/layers/data-label.js +18 -19
- package/src/maps/layers/layer-panel.d.ts +13 -1
- package/src/maps/layers/layer-panel.js +199 -68
- package/src/maps/layers/legend.d.ts +4 -0
- package/src/maps/layers/legend.js +143 -55
- package/src/maps/layers/marker.js +4 -3
- package/src/maps/maps-model.d.ts +10 -2
- package/src/maps/maps.d.ts +22 -1
- package/src/maps/maps.js +106 -61
- package/src/maps/model/base-model.d.ts +5 -1
- package/src/maps/model/base.d.ts +5 -1
- package/src/maps/model/base.js +5 -5
- package/src/maps/model/constants.d.ts +6 -0
- package/src/maps/model/constants.js +6 -0
- package/src/maps/model/theme.js +3 -0
- package/src/maps/user-interaction/highlight.js +8 -5
- package/src/maps/user-interaction/selection.js +39 -14
- package/src/maps/user-interaction/tooltip.js +3 -3
- package/src/maps/user-interaction/zoom.d.ts +1 -1
- package/src/maps/user-interaction/zoom.js +88 -38
- package/src/maps/utils/helper.js +20 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { click, itemSelection } from '../index';
|
|
2
2
|
import { getElement, createStyle, customizeStyle, removeClass, getTargetElement, getElementByID } from '../utils/helper';
|
|
3
|
-
import { isNullOrUndefined
|
|
3
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
4
4
|
/**
|
|
5
5
|
* Selection module class
|
|
6
6
|
*/
|
|
@@ -17,7 +17,6 @@ var Selection = /** @class */ (function () {
|
|
|
17
17
|
Selection.prototype.addEventListener = function () {
|
|
18
18
|
if (!this.maps.isDestroyed) {
|
|
19
19
|
this.maps.on(click, this.mouseClick, this);
|
|
20
|
-
this.maps.on(Browser.touchEndEvent, this.mouseClick, this);
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
22
|
/**
|
|
@@ -30,7 +29,6 @@ var Selection = /** @class */ (function () {
|
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
31
|
this.maps.off(click, this.mouseClick);
|
|
33
|
-
this.maps.off(Browser.touchEndEvent, this.mouseClick);
|
|
34
32
|
};
|
|
35
33
|
Selection.prototype.mouseClick = function (targetElement) {
|
|
36
34
|
if (!isNullOrUndefined(targetElement['type']) && targetElement['type'].indexOf('touch') !== -1 &&
|
|
@@ -48,8 +46,12 @@ var Selection = /** @class */ (function () {
|
|
|
48
46
|
var layerIndex = parseInt(targetElement.id.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
49
47
|
if (targetElement.id.indexOf('shapeIndex') > -1) {
|
|
50
48
|
shapeIndex = parseInt(targetElement.id.split('_shapeIndex_')[1].split('_')[0], 10);
|
|
51
|
-
shapeData = this.maps.layers[layerIndex].shapeData['features']
|
|
52
|
-
this.maps.layers[layerIndex].shapeData['features'][
|
|
49
|
+
shapeData = !isNullOrUndefined(this.maps.layers[layerIndex].shapeData['features'])
|
|
50
|
+
&& this.maps.layers[layerIndex].shapeData['features']['length'] > shapeIndex ?
|
|
51
|
+
this.maps.layers[layerIndex].shapeData['features'][shapeIndex]['properties'] :
|
|
52
|
+
!isNullOrUndefined(this.maps.layers[layerIndex].shapeData['geometries'])
|
|
53
|
+
&& this.maps.layers[layerIndex].shapeData['geometries']['length'] > shapeIndex ?
|
|
54
|
+
this.maps.layers[layerIndex].shapeData['geometries'][shapeIndex]['properties'] : null;
|
|
53
55
|
dataIndex = parseInt(targetElement.id.split('_dataIndex_')[1].split('_')[0], 10);
|
|
54
56
|
data = isNullOrUndefined(dataIndex) ? null : this.maps.layers[layerIndex].dataSource[dataIndex];
|
|
55
57
|
this.selectionsettings = this.maps.layers[layerIndex].selectionSettings;
|
|
@@ -133,15 +135,17 @@ var Selection = /** @class */ (function () {
|
|
|
133
135
|
var parentElement;
|
|
134
136
|
var children;
|
|
135
137
|
var selectionClass;
|
|
138
|
+
var isLineStringShape = targetElement.parentElement.id.indexOf('LineString') > -1;
|
|
136
139
|
var selectionsettings = this.selectionsettings;
|
|
137
140
|
var border = {
|
|
138
|
-
color: (
|
|
139
|
-
width:
|
|
141
|
+
color: isLineStringShape ? (this.selectionsettings.fill || this.selectionsettings.border.color) : this.selectionsettings.border.color,
|
|
142
|
+
width: isLineStringShape ? (this.selectionsettings.border.width / this.maps.scale) :
|
|
143
|
+
(this.selectionsettings.border.width / (this.selectionType === 'Marker' ? 1 : this.maps.scale)),
|
|
140
144
|
opacity: this.selectionsettings.border.opacity
|
|
141
145
|
};
|
|
142
146
|
var eventArgs = {
|
|
143
147
|
opacity: this.selectionsettings.opacity,
|
|
144
|
-
fill:
|
|
148
|
+
fill: isLineStringShape ? 'transparent' : (this.selectionType !== 'navigationline' ? this.selectionsettings.fill : 'none'),
|
|
145
149
|
border: border,
|
|
146
150
|
name: itemSelection,
|
|
147
151
|
target: targetElement.id,
|
|
@@ -153,7 +157,8 @@ var Selection = /** @class */ (function () {
|
|
|
153
157
|
this.maps.trigger('itemSelection', eventArgs, function (observedArgs) {
|
|
154
158
|
eventArgs.border.opacity = isNullOrUndefined(_this.selectionsettings.border.opacity) ? _this.selectionsettings.opacity : _this.selectionsettings.border.opacity;
|
|
155
159
|
if (!eventArgs.cancel) {
|
|
156
|
-
if (targetElement.getAttribute('class') === _this.selectionType + 'selectionMapStyle'
|
|
160
|
+
if (targetElement.getAttribute('class') === _this.selectionType + 'selectionMapStyle'
|
|
161
|
+
|| targetElement.getAttribute('class') === 'LineselectionMapStyle') {
|
|
157
162
|
removeClass(targetElement);
|
|
158
163
|
_this.removedSelectionList(targetElement);
|
|
159
164
|
for (var m = 0; m < _this.maps.shapeSelectionItem.length; m++) {
|
|
@@ -172,7 +177,8 @@ var Selection = /** @class */ (function () {
|
|
|
172
177
|
else {
|
|
173
178
|
var layetElement = getElementByID(_this.maps.element.id + '_Layer_Collections');
|
|
174
179
|
if (!_this.selectionsettings.enableMultiSelect &&
|
|
175
|
-
layetElement.getElementsByClassName(_this.selectionType + 'selectionMapStyle').length > 0
|
|
180
|
+
(layetElement.getElementsByClassName(_this.selectionType + 'selectionMapStyle').length > 0 ||
|
|
181
|
+
layetElement.getElementsByClassName('LineselectionMapStyle').length > 0)) {
|
|
176
182
|
var eleCount = layetElement.getElementsByClassName(_this.selectionType + 'selectionMapStyle').length;
|
|
177
183
|
var ele = void 0;
|
|
178
184
|
for (var k = 0; k < eleCount; k++) {
|
|
@@ -180,6 +186,14 @@ var Selection = /** @class */ (function () {
|
|
|
180
186
|
removeClass(ele);
|
|
181
187
|
_this.removedSelectionList(ele);
|
|
182
188
|
}
|
|
189
|
+
if (layetElement.getElementsByClassName('LineselectionMapStyle').length > 0) {
|
|
190
|
+
eleCount = layetElement.getElementsByClassName('LineselectionMapStyle').length;
|
|
191
|
+
for (var k = 0; k < eleCount; k++) {
|
|
192
|
+
ele = layetElement.getElementsByClassName('LineselectionMapStyle')[0];
|
|
193
|
+
removeClass(ele);
|
|
194
|
+
_this.removedSelectionList(ele);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
183
197
|
if (_this.selectionType === 'Shape') {
|
|
184
198
|
_this.maps.shapeSelectionItem = [];
|
|
185
199
|
var selectionLength = _this.maps.selectedElementId.length;
|
|
@@ -197,13 +211,24 @@ var Selection = /** @class */ (function () {
|
|
|
197
211
|
ele.setAttribute('stroke', _this.maps.layers[layerIndex_2].navigationLineSettings[index].color);
|
|
198
212
|
}
|
|
199
213
|
}
|
|
200
|
-
if (!
|
|
201
|
-
|
|
214
|
+
if (!isLineStringShape) {
|
|
215
|
+
if (!getElement(_this.selectionType + 'selectionMap')) {
|
|
216
|
+
document.body.appendChild(createStyle(_this.selectionType + 'selectionMap', _this.selectionType + 'selectionMapStyle', eventArgs));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
customizeStyle(_this.selectionType + 'selectionMap', _this.selectionType + 'selectionMapStyle', eventArgs);
|
|
220
|
+
}
|
|
221
|
+
targetElement.setAttribute('class', _this.selectionType + 'selectionMapStyle');
|
|
202
222
|
}
|
|
203
223
|
else {
|
|
204
|
-
|
|
224
|
+
if (!getElement('LineselectionMap')) {
|
|
225
|
+
document.body.appendChild(createStyle('LineselectionMap', 'LineselectionMapStyle', eventArgs));
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
customizeStyle('LineselectionMap', 'LineselectionMapStyle', eventArgs);
|
|
229
|
+
}
|
|
230
|
+
targetElement.setAttribute('class', 'LineselectionMapStyle');
|
|
205
231
|
}
|
|
206
|
-
targetElement.setAttribute('class', _this.selectionType + 'selectionMapStyle');
|
|
207
232
|
if (targetElement.getAttribute('class') === 'ShapeselectionMapStyle') {
|
|
208
233
|
_this.maps.shapeSelectionClass = getElement(_this.selectionType + 'selectionMap');
|
|
209
234
|
_this.maps.selectedElementId.push(targetElement.getAttribute('id'));
|
|
@@ -184,7 +184,7 @@ var MapsTooltip = /** @class */ (function () {
|
|
|
184
184
|
options: tooltipOption,
|
|
185
185
|
fill: option.fill,
|
|
186
186
|
maps: this.maps,
|
|
187
|
-
element: target, eventArgs: e
|
|
187
|
+
element: target, eventArgs: e, content: !isNullOrUndefined(currentData) ? currentData.toString() : ''
|
|
188
188
|
};
|
|
189
189
|
this.maps.trigger(tooltipRender, tooltipArgs, function (args) {
|
|
190
190
|
if (!tooltipArgs.cancel && option.visible && !isNullOrUndefined(currentData) &&
|
|
@@ -202,7 +202,7 @@ var MapsTooltip = /** @class */ (function () {
|
|
|
202
202
|
header: '',
|
|
203
203
|
data: option['data'],
|
|
204
204
|
template: option['template'],
|
|
205
|
-
content: [currentData.toString()],
|
|
205
|
+
content: tooltipArgs.content.toString() != currentData.toString() ? [tooltipArgs.content.toString()] : [currentData.toString()],
|
|
206
206
|
shapes: [],
|
|
207
207
|
location: option['location'],
|
|
208
208
|
palette: [markerFill],
|
|
@@ -218,7 +218,7 @@ var MapsTooltip = /** @class */ (function () {
|
|
|
218
218
|
header: '',
|
|
219
219
|
data: tooltipArgs.options['data'],
|
|
220
220
|
template: tooltipArgs.options['template'],
|
|
221
|
-
content: [currentData.toString()],
|
|
221
|
+
content: tooltipArgs.content.toString() != currentData.toString() ? [tooltipArgs.content.toString()] : [currentData.toString()],
|
|
222
222
|
shapes: [],
|
|
223
223
|
location: tooltipArgs.options['location'],
|
|
224
224
|
palette: [markerFill],
|
|
@@ -44,7 +44,6 @@ export declare class Zoom {
|
|
|
44
44
|
private lastScale;
|
|
45
45
|
private pinchFactor;
|
|
46
46
|
private startTouches;
|
|
47
|
-
private shapeZoomLocation;
|
|
48
47
|
private zoomshapewidth;
|
|
49
48
|
private index;
|
|
50
49
|
intersect: any[];
|
|
@@ -69,6 +68,7 @@ export declare class Zoom {
|
|
|
69
68
|
* @returns {void}
|
|
70
69
|
*/
|
|
71
70
|
performZooming(position: Point, newZoomFactor: number, type: string): void;
|
|
71
|
+
private calculateInitalZoomTranslatePoint;
|
|
72
72
|
private triggerZoomEvent;
|
|
73
73
|
private getTileTranslatePosition;
|
|
74
74
|
performRectZooming(): void;
|
|
@@ -25,8 +25,6 @@ var Zoom = /** @class */ (function () {
|
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
this.startTouches = [];
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
this.shapeZoomLocation = [];
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
28
|
this.intersect = [];
|
|
31
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
30
|
this.mouseDownLatLong = { x: 0, y: 0 };
|
|
@@ -66,7 +64,8 @@ var Zoom = /** @class */ (function () {
|
|
|
66
64
|
var minZoom = map.zoomSettings.minZoom;
|
|
67
65
|
newZoomFactor = (minZoom > newZoomFactor && type === 'ZoomIn') ? minZoom + 1 : newZoomFactor;
|
|
68
66
|
var prevTilePoint = map.tileTranslatePoint;
|
|
69
|
-
if ((!map.isTileMap) && (type === 'ZoomIn' ? newZoomFactor >= minZoom && newZoomFactor <= maxZoom : newZoomFactor >= minZoom)
|
|
67
|
+
if ((!map.isTileMap) && ((type === 'ZoomIn' ? newZoomFactor >= minZoom && newZoomFactor <= maxZoom : newZoomFactor >= minZoom)
|
|
68
|
+
|| map.isReset)) {
|
|
70
69
|
var availSize = map.mapAreaRect;
|
|
71
70
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
71
|
var minBounds = map.baseMapRectBounds['min'];
|
|
@@ -74,17 +73,29 @@ var Zoom = /** @class */ (function () {
|
|
|
74
73
|
var maxBounds = map.baseMapRectBounds['max'];
|
|
75
74
|
var mapTotalWidth = Math.abs(minBounds['x'] - maxBounds['x']);
|
|
76
75
|
var mapTotalHeight = Math.abs(minBounds['y'] - maxBounds['y']);
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
var translatePointX = void 0;
|
|
77
|
+
var translatePointY = void 0;
|
|
78
|
+
if (newZoomFactor < 1.2 && map.projectionType !== 'Eckert5') {
|
|
79
|
+
if (mapTotalWidth === 0 || mapTotalHeight === 0 || mapTotalWidth === mapTotalHeight) {
|
|
80
|
+
mapTotalWidth = availSize.width / 2;
|
|
81
|
+
mapTotalHeight = availSize.height;
|
|
82
|
+
}
|
|
83
|
+
newZoomFactor = parseFloat(Math.min(availSize.width / mapTotalWidth, availSize.height / mapTotalHeight).toFixed(2));
|
|
84
|
+
map.translatePoint = this.calculateInitalZoomTranslatePoint(newZoomFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
var point = map.translatePoint;
|
|
88
|
+
translatePointX = point.x - (((availSize.width / scale) - (availSize.width / newZoomFactor)) / (availSize.width / position.x));
|
|
89
|
+
translatePointY = point.y - (((availSize.height / scale) - (availSize.height / newZoomFactor)) / (availSize.height / position.y));
|
|
90
|
+
var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * newZoomFactor;
|
|
91
|
+
translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
|
|
92
|
+
translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
|
|
93
|
+
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
94
|
+
}
|
|
84
95
|
map.scale = newZoomFactor;
|
|
85
96
|
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
86
97
|
map.translatePoint = map.previousPoint;
|
|
87
|
-
map.scale = map.previousScale;
|
|
98
|
+
map.scale = map.mapScaleValue = map.previousScale;
|
|
88
99
|
}
|
|
89
100
|
else {
|
|
90
101
|
this.applyTransform();
|
|
@@ -140,6 +151,14 @@ var Zoom = /** @class */ (function () {
|
|
|
140
151
|
}
|
|
141
152
|
this.maps.zoomNotApplied = false;
|
|
142
153
|
};
|
|
154
|
+
Zoom.prototype.calculateInitalZoomTranslatePoint = function (newZoomFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map) {
|
|
155
|
+
mapTotalWidth *= newZoomFactor;
|
|
156
|
+
mapTotalHeight *= newZoomFactor;
|
|
157
|
+
var widthDiff = minBounds['x'] !== 0 && map.translateType === 'layers' ? map.availableSize.width - availSize.width : 0;
|
|
158
|
+
var translatePointX = availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2))) - widthDiff;
|
|
159
|
+
var translatePointY = availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)));
|
|
160
|
+
return new Point(translatePointX, translatePointY);
|
|
161
|
+
};
|
|
143
162
|
Zoom.prototype.triggerZoomEvent = function (prevTilePoint, prevLevel, type) {
|
|
144
163
|
var map = this.maps;
|
|
145
164
|
var zoomArgs;
|
|
@@ -267,12 +286,24 @@ var Zoom = /** @class */ (function () {
|
|
|
267
286
|
var mapTotalHeight = Math.abs(minBounds['y'] - maxBounds['y']);
|
|
268
287
|
var mapTotalWidth = Math.abs(minBounds['x'] - maxBounds['x']);
|
|
269
288
|
var translatePoint = map.translatePoint;
|
|
270
|
-
var
|
|
271
|
-
var
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
289
|
+
var translatePointX = void 0;
|
|
290
|
+
var translatePointY = void 0;
|
|
291
|
+
if (zoomCalculationFactor < 1.2 && map.projectionType !== 'Eckert5') {
|
|
292
|
+
if (mapTotalWidth === 0 || mapTotalHeight === 0 || mapTotalWidth === mapTotalHeight) {
|
|
293
|
+
mapTotalWidth = availSize.width / 2;
|
|
294
|
+
mapTotalHeight = availSize.height;
|
|
295
|
+
}
|
|
296
|
+
zoomCalculationFactor = parseFloat(Math.min(availSize.width / mapTotalWidth, availSize.height / mapTotalHeight).toFixed(2));
|
|
297
|
+
map.translatePoint = this.calculateInitalZoomTranslatePoint(zoomCalculationFactor, mapTotalWidth, mapTotalHeight, availSize, minBounds, map);
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * zoomCalculationFactor;
|
|
301
|
+
translatePointX = translatePoint.x - (((availSize.width / map.scale) - (availSize.width / zoomCalculationFactor)) / (availSize.width / touchCenter.x));
|
|
302
|
+
translatePointY = translatePoint.y - (((availSize.height / map.scale) - (availSize.height / zoomCalculationFactor)) / (availSize.height / touchCenter.y));
|
|
303
|
+
translatePointX = (currentHeight < map.mapAreaRect.height) ? (availSize.x + ((-(minBounds['x'])) + ((availSize.width / 2) - (mapTotalWidth / 2)))) : translatePointX;
|
|
304
|
+
translatePointY = (currentHeight < map.mapAreaRect.height) ? (availSize.y + ((-(minBounds['y'])) + ((availSize.height / 2) - (mapTotalHeight / 2)))) : translatePointY;
|
|
305
|
+
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
306
|
+
}
|
|
276
307
|
map.scale = zoomCalculationFactor;
|
|
277
308
|
isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
278
309
|
if (isZoomCancelled) {
|
|
@@ -380,17 +411,16 @@ var Zoom = /** @class */ (function () {
|
|
|
380
411
|
if (this.maps.isTileMap && (currentEle.id.indexOf('_line_Group') > -1)) {
|
|
381
412
|
currentEle.remove();
|
|
382
413
|
if (layerElement.children.length > 0 && layerElement.children[0]) {
|
|
383
|
-
layerElement.insertBefore(this.maps.navigationLineModule.renderNavigation(this.currentLayer, this.maps.tileZoomLevel, this.index), layerElement.children[
|
|
414
|
+
layerElement.insertBefore(this.maps.navigationLineModule.renderNavigation(this.currentLayer, this.maps.tileZoomLevel, this.index), layerElement.children[1]);
|
|
384
415
|
}
|
|
385
416
|
else {
|
|
386
417
|
layerElement.appendChild(this.maps.navigationLineModule.renderNavigation(this.currentLayer, this.maps.tileZoomLevel, this.index));
|
|
387
418
|
}
|
|
388
419
|
}
|
|
389
|
-
else {
|
|
420
|
+
else if (currentEle.id.indexOf('Legend') == -1) {
|
|
390
421
|
changeBorderWidth(currentEle, this.index, scale, this.maps);
|
|
391
422
|
this.maps.zoomTranslatePoint = this.maps.translatePoint;
|
|
392
423
|
this.animateTransform(currentEle, animate, x, y, scale);
|
|
393
|
-
this.shapeZoomLocation = currentEle.childNodes;
|
|
394
424
|
}
|
|
395
425
|
}
|
|
396
426
|
else if (currentEle.id.indexOf('_Markers_Group') > -1) {
|
|
@@ -490,16 +520,17 @@ var Zoom = /** @class */ (function () {
|
|
|
490
520
|
}
|
|
491
521
|
}
|
|
492
522
|
}
|
|
493
|
-
else if (currentEle.id.indexOf('_dataLableIndex_Group') > -1) {
|
|
523
|
+
else if (currentEle.id.indexOf('_dataLableIndex_Group') > -1 && !isNullOrUndefined(this.maps.layers[this.index])) {
|
|
494
524
|
this.intersect = [];
|
|
495
525
|
this.maps.zoomLabelPositions = [];
|
|
496
526
|
this.maps.zoomLabelPositions = this.maps.dataLabelModule.dataLabelCollections;
|
|
527
|
+
var labelAnimate = !this.maps.isTileMap && animate;
|
|
497
528
|
for (var k = 0; k < currentEle.childElementCount; k++) {
|
|
498
529
|
if (currentEle.childNodes[k]['id'].indexOf('_LabelIndex_') > -1) {
|
|
499
530
|
var labelIndex = parseFloat(currentEle.childNodes[k]['id'].split('_LabelIndex_')[1].split('_')[0]);
|
|
500
|
-
this.zoomshapewidth =
|
|
531
|
+
this.zoomshapewidth = currentEle.childNodes[k].getBoundingClientRect();
|
|
501
532
|
this.maps.zoomShapeCollection.push(this.zoomshapewidth);
|
|
502
|
-
this.dataLabelTranslate(currentEle.childNodes[k], factor, x, y, scale, 'DataLabel',
|
|
533
|
+
this.dataLabelTranslate(currentEle.childNodes[k], factor, x, y, scale, 'DataLabel', labelAnimate);
|
|
503
534
|
var dataLabel = this.maps.layers[this.index].dataLabelSettings;
|
|
504
535
|
var border = dataLabel.border;
|
|
505
536
|
if (k > 0 && border['width'] > 1) {
|
|
@@ -716,7 +747,7 @@ var Zoom = /** @class */ (function () {
|
|
|
716
747
|
}
|
|
717
748
|
if (this.maps.layers[this.index].dataLabelSettings.smartLabelMode === 'Hide') {
|
|
718
749
|
if (scale > 1) {
|
|
719
|
-
text = (this.
|
|
750
|
+
text = ((this.maps.dataLabelShape[l] * scale) >= zoomtextSize['width']) ? zoomtext : '';
|
|
720
751
|
element.innerHTML = text;
|
|
721
752
|
}
|
|
722
753
|
else {
|
|
@@ -726,7 +757,7 @@ var Zoom = /** @class */ (function () {
|
|
|
726
757
|
}
|
|
727
758
|
if (this.maps.layers[this.index].dataLabelSettings.smartLabelMode === 'Trim') {
|
|
728
759
|
if (scale > 1) {
|
|
729
|
-
zoomtrimLabel = textTrim(this.
|
|
760
|
+
zoomtrimLabel = textTrim((this.maps.dataLabelShape[l] * scale), zoomtext, style);
|
|
730
761
|
text = zoomtrimLabel;
|
|
731
762
|
element.innerHTML = text;
|
|
732
763
|
}
|
|
@@ -764,7 +795,7 @@ var Zoom = /** @class */ (function () {
|
|
|
764
795
|
|| textLocations['heightTop'] > this.intersect[j]['heightBottom']) {
|
|
765
796
|
trimmedLable = !isNullOrUndefined(text) ? text : zoomtext;
|
|
766
797
|
if (scale > 1) {
|
|
767
|
-
trimmedLable = textTrim(this.
|
|
798
|
+
trimmedLable = textTrim((this.maps.dataLabelShape[l] * scale), trimmedLable, style);
|
|
768
799
|
}
|
|
769
800
|
element.innerHTML = trimmedLable;
|
|
770
801
|
}
|
|
@@ -790,11 +821,11 @@ var Zoom = /** @class */ (function () {
|
|
|
790
821
|
}
|
|
791
822
|
this.intersect.push(textLocations);
|
|
792
823
|
if (isNullOrUndefined(trimmedLable)) {
|
|
793
|
-
trimmedLable = textTrim(this.
|
|
824
|
+
trimmedLable = textTrim((this.maps.dataLabelShape[l] * scale), zoomtext, style);
|
|
794
825
|
element.innerHTML = trimmedLable;
|
|
795
826
|
}
|
|
796
827
|
}
|
|
797
|
-
|
|
828
|
+
if (animate || duration > 0) {
|
|
798
829
|
smoothTranslate(element, 0, duration, new MapLocation(labelX, labelY));
|
|
799
830
|
}
|
|
800
831
|
}
|
|
@@ -916,7 +947,7 @@ var Zoom = /** @class */ (function () {
|
|
|
916
947
|
var layerRect = getElementByID(map.element.id + '_Layer_Collections').getBoundingClientRect();
|
|
917
948
|
var elementRect = getElementByID(map.element.id + '_svg').getBoundingClientRect();
|
|
918
949
|
var panningXDirection = ((xDifference < 0 ? layerRect.left <= (elementRect.left + map.mapAreaRect.x) :
|
|
919
|
-
((layerRect.left + layerRect.width
|
|
950
|
+
((layerRect.left + layerRect.width + map.mapAreaRect.x) >= (elementRect.width))));
|
|
920
951
|
var panningYDirection = ((yDifference < 0 ? layerRect.top <= (elementRect.top + map.mapAreaRect.y) :
|
|
921
952
|
((layerRect.top + layerRect.height + legendHeight + map.margin.top) >= (elementRect.top + elementRect.height))));
|
|
922
953
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1009,14 +1040,26 @@ var Zoom = /** @class */ (function () {
|
|
|
1009
1040
|
var max = map.baseMapRectBounds['max'];
|
|
1010
1041
|
var mapWidth = Math.abs(max['x'] - min['x']);
|
|
1011
1042
|
var mapHeight = Math.abs(min['y'] - max['y']);
|
|
1012
|
-
var translatePointX =
|
|
1013
|
-
var translatePointY =
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1043
|
+
var translatePointX = void 0;
|
|
1044
|
+
var translatePointY = void 0;
|
|
1045
|
+
if (zoomFactor < 1.2 && map.projectionType !== 'Eckert5') {
|
|
1046
|
+
if (mapHeight === 0 || mapWidth === 0 || mapHeight === mapWidth) {
|
|
1047
|
+
mapWidth = size.width / 2;
|
|
1048
|
+
mapHeight = size.height;
|
|
1049
|
+
}
|
|
1050
|
+
zoomFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));
|
|
1051
|
+
map.translatePoint = this.calculateInitalZoomTranslatePoint(zoomFactor, mapWidth, mapHeight, size, min, map);
|
|
1052
|
+
}
|
|
1053
|
+
else {
|
|
1054
|
+
translatePointX = translatePoint.x - (((size.width / scale) - (size.width / zoomFactor)) / 2);
|
|
1055
|
+
translatePointY = translatePoint.y - (((size.height / scale) - (size.height / zoomFactor)) / 2);
|
|
1056
|
+
var currentHeight = Math.abs(map.baseMapRectBounds['max']['y'] - map.baseMapRectBounds['min']['y']) * zoomFactor;
|
|
1057
|
+
translatePointX = (currentHeight < map.mapAreaRect.height) ? (size.x + ((-(min['x'])) + ((size.width / 2) - (mapWidth / 2))))
|
|
1058
|
+
: translatePointX;
|
|
1059
|
+
translatePointY = (currentHeight < map.mapAreaRect.height) ? (size.y + ((-(min['y'])) + ((size.height / 2) - (mapHeight / 2))))
|
|
1060
|
+
: translatePointY;
|
|
1061
|
+
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
1062
|
+
}
|
|
1020
1063
|
map.zoomTranslatePoint = map.translatePoint;
|
|
1021
1064
|
map.scale = zoomFactor;
|
|
1022
1065
|
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
@@ -1070,6 +1113,7 @@ var Zoom = /** @class */ (function () {
|
|
|
1070
1113
|
if (document.getElementById(_this.maps.element.id + '_LayerIndex_1')) {
|
|
1071
1114
|
document.getElementById(_this.maps.element.id + '_LayerIndex_1').style.display = 'block';
|
|
1072
1115
|
}
|
|
1116
|
+
_this.maps.isAddLayer = false;
|
|
1073
1117
|
}, animationDuration);
|
|
1074
1118
|
}
|
|
1075
1119
|
}
|
|
@@ -1340,7 +1384,12 @@ var Zoom = /** @class */ (function () {
|
|
|
1340
1384
|
x = (size.width / 2) - (toolBarSize.width / 2);
|
|
1341
1385
|
break;
|
|
1342
1386
|
case 'Far':
|
|
1343
|
-
|
|
1387
|
+
if (!isNullOrUndefined(map.legendModule) && map.legendSettings.position === 'Left') {
|
|
1388
|
+
x = size.width + size.x - toolBarSize.width - padding;
|
|
1389
|
+
}
|
|
1390
|
+
else {
|
|
1391
|
+
x = (size.width - toolBarSize.width) - padding;
|
|
1392
|
+
}
|
|
1344
1393
|
break;
|
|
1345
1394
|
}
|
|
1346
1395
|
var extraPosition = map.getExtraPosition();
|
|
@@ -1396,6 +1445,7 @@ var Zoom = /** @class */ (function () {
|
|
|
1396
1445
|
}
|
|
1397
1446
|
else {
|
|
1398
1447
|
map.mapScaleValue = value - delta;
|
|
1448
|
+
map.isReset = (map.mapScaleValue < 1) ? true : false;
|
|
1399
1449
|
map.staticMapZoom = map.tileZoomLevel;
|
|
1400
1450
|
if (map.mapScaleValue === 1) {
|
|
1401
1451
|
map.markerCenterLatitude = null;
|
package/src/maps/utils/helper.js
CHANGED
|
@@ -807,6 +807,8 @@ export function drawSymbols(shape, imageUrl, location, markerID, shapeCustom, ma
|
|
|
807
807
|
var padding = 5;
|
|
808
808
|
var rectOptions;
|
|
809
809
|
var pathOptions = new PathOption(markerID, fill, borderWidth, borderColor, opacity, borderOpacity, dashArray, '');
|
|
810
|
+
size.width = typeof (size.width) === 'string' ? parseInt(size.width, 10) : size.width;
|
|
811
|
+
size.height = typeof (size.height) === 'string' ? parseInt(size.height, 10) : size.height;
|
|
810
812
|
if (shape === 'Circle') {
|
|
811
813
|
var radius = (size.width + size.height) / 4;
|
|
812
814
|
var circleOptions = new CircleOption(markerID, fill, border, opacity, location.x, location.y, radius, dashArray);
|
|
@@ -1024,8 +1026,8 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
|
|
|
1024
1026
|
shapeCustom['borderWidth'] = eventArg.border.width;
|
|
1025
1027
|
shapeCustom['borderOpacity'] = isNullOrUndefined(eventArg.border.opacity) ? clusters_1.opacity : eventArg.border.opacity;
|
|
1026
1028
|
}
|
|
1027
|
-
tempX = (maps.isTileMap) ? tempX : (markerTemplate.id.indexOf('_Markers_Group') > -1) ? tempX :
|
|
1028
|
-
tempY = (maps.isTileMap) ? tempY : (markerTemplate.id.indexOf('_Markers_Group') > -1) ? tempY :
|
|
1029
|
+
tempX = (maps.isTileMap) ? tempX : (markerTemplate.id.indexOf('_Markers_Group') > -1) ? tempX : tempX + postionY - (eventArg.width / 2);
|
|
1030
|
+
tempY = (maps.isTileMap) ? tempY : (markerTemplate.id.indexOf('_Markers_Group') > -1) ? tempY : tempY - (eventArg.height / 2);
|
|
1029
1031
|
if (maps.isTileMap && !maps.zoomSettings.enable) {
|
|
1030
1032
|
tempX = location_1.x;
|
|
1031
1033
|
tempY = location_1.y;
|
|
@@ -1104,7 +1106,7 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
|
|
|
1104
1106
|
getElementByID(maps.element.id + '_Secondary_Element').appendChild(markerCollection);
|
|
1105
1107
|
layerElement.appendChild(markerCollection);
|
|
1106
1108
|
}
|
|
1107
|
-
var markerCluster = document.getElementById(maps.element.id + '
|
|
1109
|
+
var markerCluster = document.getElementById(maps.element.id + '_LayerIndex_' + layerIndex + '_markerCluster');
|
|
1108
1110
|
if (!isNullOrUndefined(markerCluster)) {
|
|
1109
1111
|
markerCluster.remove();
|
|
1110
1112
|
}
|
|
@@ -2042,6 +2044,10 @@ export function getTranslate(mapObject, layer, animate) {
|
|
|
2042
2044
|
}
|
|
2043
2045
|
else {
|
|
2044
2046
|
if (isNullOrUndefined(mapObject.previousProjection) || mapObject.previousProjection !== mapObject.projectionType) {
|
|
2047
|
+
if (mapHeight === 0 || mapWidth === 0 || mapHeight === mapWidth) {
|
|
2048
|
+
mapWidth = size.width / 2;
|
|
2049
|
+
mapHeight = size.height;
|
|
2050
|
+
}
|
|
2045
2051
|
scaleFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));
|
|
2046
2052
|
mapWidth *= scaleFactor;
|
|
2047
2053
|
mapHeight *= scaleFactor;
|
|
@@ -2091,7 +2097,7 @@ export function getTranslate(mapObject, layer, animate) {
|
|
|
2091
2097
|
mapObject.zoomTranslatePoint.y = y;
|
|
2092
2098
|
}
|
|
2093
2099
|
else {
|
|
2094
|
-
if (!isNullOrUndefined(mapObject.previousProjection) && mapObject.mapScaleValue === 1 && !mapObject.zoomModule.isDragZoom) {
|
|
2100
|
+
if (!isNullOrUndefined(mapObject.previousProjection) && (mapObject.mapScaleValue === 1 || mapObject.mapScaleValue <= 1.05) && !mapObject.zoomModule.isDragZoom) {
|
|
2095
2101
|
scaleFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));
|
|
2096
2102
|
mapWidth *= scaleFactor;
|
|
2097
2103
|
x = size.x + ((-(min['x'])) + ((size.width / 2) - (mapWidth / 2)));
|
|
@@ -2249,6 +2255,8 @@ export function getZoomTranslate(mapObject, layer, animate) {
|
|
|
2249
2255
|
}
|
|
2250
2256
|
}
|
|
2251
2257
|
scaleFactor = (mapObject.enablePersistence) ? (mapObject.mapScaleValue === 0 ? 1 : mapObject.mapScaleValue) : scaleFactor;
|
|
2258
|
+
mapObject.widthBeforeRefresh = mapObject.availableSize.width;
|
|
2259
|
+
mapObject.heightBeforeRefresh = mapObject.availableSize.height;
|
|
2252
2260
|
return { scale: animate ? 1 : scaleFactor, location: new Point(x, y) };
|
|
2253
2261
|
}
|
|
2254
2262
|
/**
|
|
@@ -2918,6 +2926,7 @@ export function changeBorderWidth(element, index, scale, maps) {
|
|
|
2918
2926
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2919
2927
|
var borderWidthValue = maps.layersCollection[index].shapeSettings.borderWidthValuePath;
|
|
2920
2928
|
var borderWidth = maps.layersCollection[index].shapeSettings.border.width;
|
|
2929
|
+
var circleRadius = maps.layersCollection[index].shapeSettings.circleRadius;
|
|
2921
2930
|
if (maps.layersCollection[index].shapeSettings.borderWidthValuePath) {
|
|
2922
2931
|
value = checkShapeDataFields(
|
|
2923
2932
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2938,8 +2947,8 @@ export function changeBorderWidth(element, index, scale, maps) {
|
|
|
2938
2947
|
currentStroke = (isNullOrUndefined(borderWidth) ? 0 : borderWidth);
|
|
2939
2948
|
}
|
|
2940
2949
|
childNode.setAttribute('stroke-width', (currentStroke / scale).toString());
|
|
2941
|
-
if (element.id.indexOf('
|
|
2942
|
-
childNode.setAttribute('
|
|
2950
|
+
if (element.id.indexOf('_Point') > -1 || element.id.indexOf('_MultiPoint') > -1) {
|
|
2951
|
+
childNode.setAttribute('r', (circleRadius / scale).toString());
|
|
2943
2952
|
}
|
|
2944
2953
|
}
|
|
2945
2954
|
}
|
|
@@ -3133,7 +3142,11 @@ export function animate(element, delay, duration, process, end) {
|
|
|
3133
3142
|
else {
|
|
3134
3143
|
window.cancelAnimationFrame(clearAnimation);
|
|
3135
3144
|
end.call(_this, { element: element });
|
|
3136
|
-
element.
|
|
3145
|
+
if (element.id.indexOf('Marker') > -1) {
|
|
3146
|
+
console.log(element);
|
|
3147
|
+
var markerElement = getElementByID(element.id.split('_')[0] + '_Markers_Group');
|
|
3148
|
+
markerElement.setAttribute('style', markerStyle);
|
|
3149
|
+
}
|
|
3137
3150
|
}
|
|
3138
3151
|
};
|
|
3139
3152
|
clearAnimation = window.requestAnimationFrame(startAnimation);
|