@syncfusion/ej2-maps 19.3.53 → 19.4.48
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/.github/PULL_REQUEST_TEMPLATE/Bug.md +72 -0
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +49 -0
- package/CHANGELOG.md +42 -1
- package/README.md +1 -1
- 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 +663 -293
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +659 -289
- 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/bubble.d.ts +6 -0
- package/src/maps/layers/bubble.js +7 -1
- package/src/maps/layers/data-label.js +1 -0
- package/src/maps/layers/layer-panel.d.ts +2 -1
- package/src/maps/layers/layer-panel.js +89 -52
- package/src/maps/layers/legend.d.ts +41 -2
- package/src/maps/layers/legend.js +90 -29
- package/src/maps/layers/marker.js +2 -8
- package/src/maps/maps-model.d.ts +1 -1
- package/src/maps/maps.d.ts +8 -0
- package/src/maps/maps.js +142 -19
- package/src/maps/model/base-model.d.ts +7 -0
- package/src/maps/model/base.d.ts +6 -0
- package/src/maps/model/base.js +5 -2
- package/src/maps/model/interface.d.ts +1 -3
- package/src/maps/model/theme.js +62 -5
- package/src/maps/user-interaction/highlight.d.ts +9 -1
- package/src/maps/user-interaction/highlight.js +22 -15
- package/src/maps/user-interaction/selection.d.ts +9 -1
- package/src/maps/user-interaction/selection.js +27 -19
- package/src/maps/user-interaction/tooltip.js +9 -3
- package/src/maps/user-interaction/zoom.d.ts +5 -1
- package/src/maps/user-interaction/zoom.js +82 -45
- package/src/maps/utils/enum.d.ts +3 -1
- package/src/maps/utils/helper.d.ts +4 -2
- package/src/maps/utils/helper.js +130 -98
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { click, legendRendering } from '../index';
|
|
2
|
-
import { Rect, measureText, PathOption, textTrim, removeClass, querySelector, getTemplateFunction, maintainStyleClass, getValueFromObject } from '../utils/helper';
|
|
2
|
+
import { Rect, measureText, PathOption, textTrim, drawBalloon, removeClass, querySelector, getTemplateFunction, maintainStyleClass, getValueFromObject } from '../utils/helper';
|
|
3
3
|
import { RectOption, Size, TextOption, Point, renderTextElement, drawSymbol, checkPropertyPath, getElement } from '../utils/helper';
|
|
4
4
|
import { isNullOrUndefined, Browser, EventHandler, remove, extend } from '@syncfusion/ej2-base';
|
|
5
5
|
/**
|
|
@@ -7,7 +7,14 @@ import { isNullOrUndefined, Browser, EventHandler, remove, extend } from '@syncf
|
|
|
7
7
|
*/
|
|
8
8
|
var Legend = /** @class */ (function () {
|
|
9
9
|
function Legend(maps) {
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
10
13
|
this.legendBorderRect = new Rect(0, 0, 0, 0);
|
|
14
|
+
/**
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
this.legendTotalRect = new Rect(0, 0, 0, 0);
|
|
11
18
|
/**
|
|
12
19
|
* @private
|
|
13
20
|
*/
|
|
@@ -24,12 +31,27 @@ var Legend = /** @class */ (function () {
|
|
|
24
31
|
this.textMaxWidth = 0;
|
|
25
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
33
|
this.shapeHighlightCollection = [];
|
|
34
|
+
/**
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
27
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
38
|
this.legendHighlightCollection = [];
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
29
42
|
this.shapePreviousColor = [];
|
|
43
|
+
/**
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
30
46
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
47
|
this.selectedNonLegendShapes = [];
|
|
48
|
+
/**
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
32
51
|
this.shapeToggled = true;
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
33
55
|
this.legendElement = null;
|
|
34
56
|
this.maps = maps;
|
|
35
57
|
this.addEventListener();
|
|
@@ -414,6 +436,11 @@ var Legend = /** @class */ (function () {
|
|
|
414
436
|
this.drawLegendItem(this.currentPage);
|
|
415
437
|
}
|
|
416
438
|
};
|
|
439
|
+
/**
|
|
440
|
+
* @param {string} page - Specifies the legend page.
|
|
441
|
+
* @returns {void}
|
|
442
|
+
* @private
|
|
443
|
+
*/
|
|
417
444
|
Legend.prototype.drawLegendItem = function (page) {
|
|
418
445
|
var map = this.maps;
|
|
419
446
|
var legend = map.legendSettings;
|
|
@@ -422,6 +449,7 @@ var Legend = /** @class */ (function () {
|
|
|
422
449
|
var textOptions;
|
|
423
450
|
var renderOptions;
|
|
424
451
|
var render = map.renderer;
|
|
452
|
+
var legendShape = legend.shape;
|
|
425
453
|
if (page >= 0 && page < this.totalPages.length) {
|
|
426
454
|
if (querySelector(this.legendGroup.id, this.maps.element.id)) {
|
|
427
455
|
remove(querySelector(this.legendGroup.id, this.maps.element.id));
|
|
@@ -433,6 +461,7 @@ var Legend = /** @class */ (function () {
|
|
|
433
461
|
var shapeBorder = collection['shapeBorder'];
|
|
434
462
|
var legendElement = render.createGroup({ id: map.element.id + '_Legend_Index_' + collection['idIndex'] });
|
|
435
463
|
var legendText = collection['DisplayText'];
|
|
464
|
+
var pagingArrowPadding = 4;
|
|
436
465
|
var shape = ((legend.type === 'Markers') ? ((isNullOrUndefined(collection['ImageSrc'])) ?
|
|
437
466
|
legend.shape : 'Image') : collection['legendShape']);
|
|
438
467
|
var strokeColor = (legend.shape === 'HorizontalLine' || legend.shape === 'VerticalLine'
|
|
@@ -442,25 +471,39 @@ var Legend = /** @class */ (function () {
|
|
|
442
471
|
1 : shapeBorder.width : shapeBorder.width;
|
|
443
472
|
var shapeId = map.element.id + '_Legend_Shape_Index_' + collection['idIndex'];
|
|
444
473
|
var textId = map.element.id + '_Legend_Text_Index_' + collection['idIndex'];
|
|
445
|
-
var shapeLocation = collection['Shape'];
|
|
446
|
-
var textLocation = collection['Text'];
|
|
474
|
+
var shapeLocation = new Point(collection['Shape']['x'], (collection['Shape']['y'] - pagingArrowPadding));
|
|
475
|
+
var textLocation = new Point(collection['Text']['x'], (collection['Text']['y'] - pagingArrowPadding));
|
|
447
476
|
var imageUrl = ((isNullOrUndefined(collection['ImageSrc'])) ? legend.shape : collection['ImageSrc']);
|
|
448
477
|
var renderOptions_1 = new PathOption(shapeId, collection['Fill'], strokeWidth, strokeColor, legend.opacity, isNullOrUndefined(shapeBorder.opacity) ? legend.opacity : shapeBorder.opacity, '');
|
|
449
|
-
|
|
478
|
+
var legendTextStyle = {
|
|
479
|
+
fontFamily: legend.textStyle.fontFamily, fontStyle: legend.textStyle.fontStyle,
|
|
480
|
+
fontWeight: legend.textStyle.fontWeight, size: legend.textStyle.size, color: legend.textStyle.color, opacity: legend.textStyle.opacity
|
|
481
|
+
};
|
|
482
|
+
legendTextStyle.color = (legendTextStyle.color !== null) ? legendTextStyle.color :
|
|
450
483
|
this.maps.themeStyle.legendTextColor;
|
|
451
|
-
|
|
452
|
-
|
|
484
|
+
legendTextStyle.fontFamily = map.themeStyle.fontFamily || legendTextStyle.fontFamily;
|
|
485
|
+
legendTextStyle.size = map.themeStyle.legendFontSize || legendTextStyle.size;
|
|
453
486
|
if (i === 0) {
|
|
454
487
|
this.renderLegendBorder();
|
|
455
488
|
}
|
|
456
|
-
|
|
489
|
+
if (legend.type === 'Markers' && legend.useMarkerShape) {
|
|
490
|
+
var legendShapeData = this.legendCollection[collection['idIndex']].data[0];
|
|
491
|
+
var marker = map.layers[legendShapeData['layerIndex']].markerSettings[legendShapeData['markerIndex']];
|
|
492
|
+
legendShape = !isNullOrUndefined(marker.dataSource[legendShapeData['dataIndex']][marker['shapeValuePath']]) && marker.dataSource[legendShapeData['dataIndex']][marker['shapeValuePath']] !== '' ? marker.dataSource[legendShapeData['dataIndex']][marker['shapeValuePath']] : marker.shape;
|
|
493
|
+
}
|
|
494
|
+
if (legendShape === "Balloon") {
|
|
495
|
+
legendElement.appendChild(drawBalloon(map, renderOptions_1, shapeSize, { x: shapeLocation.x, y: (shapeLocation.y + 5) }, 'Legend'));
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
legendElement.appendChild(drawSymbol(shapeLocation, legendShape, shapeSize, collection['ImageSrc'], renderOptions_1));
|
|
499
|
+
}
|
|
457
500
|
var legendRectSize = collection['Rect']['x'] + collection['Rect']['width'];
|
|
458
501
|
if (legendRectSize > this.legendBorderRect.width) {
|
|
459
|
-
var trimmedText = this.legendTextTrim(this.legendBorderRect.width, legendText,
|
|
502
|
+
var trimmedText = this.legendTextTrim(this.legendBorderRect.width, legendText, legendTextStyle, legendRectSize);
|
|
460
503
|
legendText = trimmedText;
|
|
461
504
|
}
|
|
462
505
|
textOptions = new TextOption(textId, textLocation.x, textLocation.y, 'start', legendText, '', '');
|
|
463
|
-
renderTextElement(textOptions,
|
|
506
|
+
renderTextElement(textOptions, legendTextStyle, legendTextStyle.color, legendElement);
|
|
464
507
|
this.legendGroup.appendChild(legendElement);
|
|
465
508
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
466
509
|
if (i === (this.totalPages[page]['Collection'].length - 1)) {
|
|
@@ -472,10 +515,10 @@ var Legend = /** @class */ (function () {
|
|
|
472
515
|
var pagingFont = legend.textStyle;
|
|
473
516
|
var pagingTextSize = measureText(pagingText, pagingFont);
|
|
474
517
|
var leftPageX = (this.legendItemRect.x + this.legendItemRect.width) - pagingTextSize.width -
|
|
475
|
-
(width * 2) - spacing;
|
|
518
|
+
(width * 2) - (spacing * 2) + (pagingArrowPadding / 2);
|
|
476
519
|
var rightPageX = (this.legendItemRect.x + this.legendItemRect.width);
|
|
520
|
+
var pageTextX = rightPageX - width - (pagingTextSize.width / 2) - (spacing / 2) - pagingArrowPadding;
|
|
477
521
|
var locY = (this.legendItemRect.y + this.legendItemRect.height) + (height / 2) + spacing;
|
|
478
|
-
var pageTextX = rightPageX - width - (pagingTextSize.width / 2) - (spacing / 2);
|
|
479
522
|
pagingGroup = render.createGroup({ id: map.element.id + '_Legend_Paging_Group' });
|
|
480
523
|
var leftPageElement = render.createGroup({ id: map.element.id + '_Legend_Left_Paging_Group' });
|
|
481
524
|
var rightPageElement = render.createGroup({ id: map.element.id + '_Legend_Right_Paging_Group' });
|
|
@@ -483,15 +526,19 @@ var Legend = /** @class */ (function () {
|
|
|
483
526
|
' L ' + (rightPageX - width) + ' ' + (locY + height) + ' z ';
|
|
484
527
|
var leftPath = ' M ' + leftPageX + ' ' + locY + ' L ' + (leftPageX + width) + ' ' + (locY - height) +
|
|
485
528
|
' L ' + (leftPageX + width) + ' ' + (locY + height) + ' z ';
|
|
486
|
-
var leftPageOptions = new PathOption(map.element.id + '_Left_Page', '#a6a6a6', 0, '#a6a6a6', 1, 1, '', leftPath);
|
|
529
|
+
var leftPageOptions = new PathOption(map.element.id + '_Left_Page', '#a6a6a6', 0, '#a6a6a6', ((page + 1) === 1 ? 0.5 : 1), 1, '', leftPath);
|
|
487
530
|
leftPageElement.appendChild(render.drawPath(leftPageOptions));
|
|
488
531
|
var leftRectPageOptions = new RectOption(map.element.id + '_Left_Page_Rect', 'transparent', {}, 1, new Rect(leftPageX - (width / 2), (locY - (height * 2)), width * 2, spacing * 2), null, null, '', '');
|
|
489
|
-
|
|
532
|
+
var pathEle = render.drawRectangle(leftRectPageOptions);
|
|
533
|
+
pathEle.setAttribute('tabindex', ((page + 1) === 1 ? -1 : map.tabIndex + 1).toString());
|
|
534
|
+
leftPageElement.appendChild(pathEle);
|
|
490
535
|
this.wireEvents(leftPageElement);
|
|
491
|
-
var rightPageOptions = new PathOption(map.element.id + '_Right_Page', '#a6a6a6', 0, '#a6a6a6', 1, 1, '', rightPath);
|
|
536
|
+
var rightPageOptions = new PathOption(map.element.id + '_Right_Page', '#a6a6a6', 0, '#a6a6a6', ((page + 1) === this.totalPages.length ? 0.5 : 1), 1, '', rightPath);
|
|
492
537
|
rightPageElement.appendChild(render.drawPath(rightPageOptions));
|
|
493
|
-
var rightRectPageOptions = new RectOption(map.element.id + '_Right_Page_Rect', 'transparent', {}, 1, new Rect(
|
|
494
|
-
|
|
538
|
+
var rightRectPageOptions = new RectOption(map.element.id + '_Right_Page_Rect', 'transparent', {}, 1, new Rect(rightPageX - spacing - (width / 2), (locY - (height * 2)), width * 2, spacing * 2), null, null, '', '');
|
|
539
|
+
pathEle = render.drawRectangle(rightRectPageOptions);
|
|
540
|
+
pathEle.setAttribute('tabindex', ((page + 1) === this.totalPages.length ? -1 : map.tabIndex + 2).toString());
|
|
541
|
+
rightPageElement.appendChild(pathEle);
|
|
495
542
|
this.wireEvents(rightPageElement);
|
|
496
543
|
pagingGroup.appendChild(leftPageElement);
|
|
497
544
|
pagingGroup.appendChild(rightPageElement);
|
|
@@ -1141,7 +1188,10 @@ var Legend = /** @class */ (function () {
|
|
|
1141
1188
|
var map = this.maps;
|
|
1142
1189
|
var legend = map.legendSettings;
|
|
1143
1190
|
var legendTitle = legend.title.text;
|
|
1144
|
-
var textStyle =
|
|
1191
|
+
var textStyle = {
|
|
1192
|
+
fontFamily: legend.titleStyle.fontFamily, fontStyle: legend.titleStyle.fontStyle,
|
|
1193
|
+
fontWeight: legend.titleStyle.fontWeight, size: legend.titleStyle.size, color: legend.titleStyle.color, opacity: legend.titleStyle.opacity
|
|
1194
|
+
};
|
|
1145
1195
|
var textOptions;
|
|
1146
1196
|
var spacing = 10;
|
|
1147
1197
|
var trimTitle = textTrim((this.legendItemRect.width + (spacing * 2)), legendTitle, textStyle);
|
|
@@ -1160,6 +1210,7 @@ var Legend = /** @class */ (function () {
|
|
|
1160
1210
|
map.svgObject.appendChild(this.legendGroup);
|
|
1161
1211
|
if (legendTitle) {
|
|
1162
1212
|
textStyle.color = (textStyle.color !== null) ? textStyle.color : this.maps.themeStyle.legendTitleFontColor;
|
|
1213
|
+
textStyle.fontFamily = !isNullOrUndefined(textStyle.fontFamily) ? textStyle.fontFamily : this.maps.themeStyle.fontFamily;
|
|
1163
1214
|
textOptions = new TextOption(map.element.id + '_LegendTitle', (this.legendItemRect.x) + (this.legendItemRect.width / 2), this.legendItemRect.y - (textSize.height / 2) - spacing / 2, 'middle', trimTitle, '');
|
|
1164
1215
|
renderTextElement(textOptions, textStyle, textStyle.color, this.legendGroup);
|
|
1165
1216
|
}
|
|
@@ -1225,13 +1276,13 @@ var Legend = /** @class */ (function () {
|
|
|
1225
1276
|
break;
|
|
1226
1277
|
}
|
|
1227
1278
|
if ((legend.height || legend.width) && legend.mode !== 'Interactive') {
|
|
1228
|
-
map.totalRect = totalRect;
|
|
1279
|
+
this.legendTotalRect = map.totalRect = totalRect;
|
|
1229
1280
|
}
|
|
1230
1281
|
else {
|
|
1231
1282
|
if ((legend.height || legend.width) && legend.mode === 'Interactive') {
|
|
1232
1283
|
map.totalRect = totalRect;
|
|
1233
1284
|
}
|
|
1234
|
-
map.mapAreaRect = totalRect;
|
|
1285
|
+
this.legendTotalRect = map.mapAreaRect = totalRect;
|
|
1235
1286
|
}
|
|
1236
1287
|
this.translate = new Point(x, y);
|
|
1237
1288
|
}
|
|
@@ -1268,21 +1319,25 @@ var Legend = /** @class */ (function () {
|
|
|
1268
1319
|
}
|
|
1269
1320
|
else {
|
|
1270
1321
|
newData.push({ layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex, value: legendFill, name: text,
|
|
1271
|
-
shape: !isNullOrUndefined(marker.shapeValuePath) ? data[marker.shapeValuePath] : marker.shape });
|
|
1322
|
+
shape: (!isNullOrUndefined(marker.shapeValuePath) && !isNullOrUndefined(data[marker.shapeValuePath]) && data[marker.shapeValuePath] !== '') ? data[marker.shapeValuePath] : (_this.maps.legendSettings.useMarkerShape ? marker.shape : _this.maps.legendSettings.shape) });
|
|
1272
1323
|
_this.getOverallLegendItemsCollection(text, legendFill, newData, showLegend);
|
|
1273
1324
|
}
|
|
1274
1325
|
}
|
|
1275
1326
|
});
|
|
1276
1327
|
});
|
|
1277
1328
|
};
|
|
1329
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1278
1330
|
Legend.prototype.getMarkerLegendData = function (layerIndex, text, legendFill) {
|
|
1279
1331
|
var _this = this;
|
|
1332
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1280
1333
|
var legendData = [];
|
|
1281
1334
|
this.maps.layers[layerIndex].markerSettings.map(function (markerSettings, markerIndex) {
|
|
1335
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1282
1336
|
var markerData = markerSettings.dataSource;
|
|
1337
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1283
1338
|
Array.prototype.forEach.call(markerData, function (data, dataIndex) {
|
|
1284
1339
|
var marker = _this.maps.layers[layerIndex].markerSettings[markerIndex];
|
|
1285
|
-
if ((text === data[marker.legendText] || text === '') && legendFill
|
|
1340
|
+
if ((text === data[marker.legendText] || text === '') && legendFill === data[marker.colorValuePath]) {
|
|
1286
1341
|
legendData.push({ layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex, value: legendFill, name: text,
|
|
1287
1342
|
shape: !isNullOrUndefined(marker.shapeValuePath) ? data[marker.shapeValuePath] : marker.shape });
|
|
1288
1343
|
}
|
|
@@ -1650,7 +1705,7 @@ var Legend = /** @class */ (function () {
|
|
|
1650
1705
|
shape = this.legendCollection[legendIndex]['data'][i];
|
|
1651
1706
|
mapElement = this.maps.legendSettings.type === 'Bubbles' ? querySelector(this.maps.element.id + '_LayerIndex_' + shape['layerIndex'] +
|
|
1652
1707
|
'_BubbleIndex_' + j + '_dataIndex_' + shape['dataIndex'], this.maps.element.id) : querySelector(this.maps.element.id + '_LayerIndex_' + shape['layerIndex'] +
|
|
1653
|
-
'_MarkerIndex_' +
|
|
1708
|
+
'_MarkerIndex_' + shape['markerIndex'] + '_dataIndex_' + shape['dataIndex'], this.maps.element.id);
|
|
1654
1709
|
if (!isNullOrUndefined(shape['shape']) && shape['shape'] === 'Balloon') {
|
|
1655
1710
|
mapElement = mapElement.children[0];
|
|
1656
1711
|
}
|
|
@@ -1659,7 +1714,7 @@ var Legend = /** @class */ (function () {
|
|
|
1659
1714
|
mapElement.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
|
|
1660
1715
|
mapElement.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color);
|
|
1661
1716
|
mapElement.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
|
|
1662
|
-
mapElement.setAttribute('stroke-width', (this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1717
|
+
mapElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1663
1718
|
mapElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
|
|
1664
1719
|
this.maps.layers[k].shapeSettings.opacity :
|
|
1665
1720
|
this.maps.layers[k].shapeSettings.border.opacity).toString());
|
|
@@ -1674,6 +1729,9 @@ var Legend = /** @class */ (function () {
|
|
|
1674
1729
|
if (targetEle !== null) {
|
|
1675
1730
|
legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
|
|
1676
1731
|
legendShapeId.setAttribute('fill', '#E5E5E5');
|
|
1732
|
+
if (this.maps.legendSettings.shape === 'HorizontalLine' || this.maps.legendSettings.shape === 'VerticalLine' || this.maps.legendSettings.shape === 'Cross') {
|
|
1733
|
+
legendShapeId.setAttribute('stroke', '#E5E5E5');
|
|
1734
|
+
}
|
|
1677
1735
|
legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
|
|
1678
1736
|
legendTextId.setAttribute('fill', '#E5E5E5');
|
|
1679
1737
|
}
|
|
@@ -1688,6 +1746,9 @@ var Legend = /** @class */ (function () {
|
|
|
1688
1746
|
if (targetEle !== null) {
|
|
1689
1747
|
legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
|
|
1690
1748
|
legendShapeId.setAttribute('fill', this.legendCollection[legendIndex]['fill']);
|
|
1749
|
+
if (this.maps.legendSettings.shape === 'HorizontalLine' || this.maps.legendSettings.shape === 'VerticalLine' || this.maps.legendSettings.shape === 'Cross') {
|
|
1750
|
+
legendShapeId.setAttribute('stroke', this.legendCollection[legendIndex]['fill']);
|
|
1751
|
+
}
|
|
1691
1752
|
legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
|
|
1692
1753
|
legendTextId.setAttribute('fill', '#757575');
|
|
1693
1754
|
}
|
|
@@ -1722,7 +1783,7 @@ var Legend = /** @class */ (function () {
|
|
|
1722
1783
|
layerElement.setAttribute('fill', this.maps.layers[j].shapeSettings.fill);
|
|
1723
1784
|
layerElement.setAttribute('fill-opacity', (this.maps.layers[j].shapeSettings.opacity).toString());
|
|
1724
1785
|
layerElement.setAttribute('stroke', this.maps.layers[j].shapeSettings.border.color);
|
|
1725
|
-
layerElement.setAttribute('stroke-width', (this.maps.layers[j].shapeSettings.border.width).toString());
|
|
1786
|
+
layerElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[j].shapeSettings.border.width) ? 0 : this.maps.layers[j].shapeSettings.border.width).toString());
|
|
1726
1787
|
layerElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[j].shapeSettings.border.opacity) ?
|
|
1727
1788
|
this.maps.layers[j].shapeSettings.opacity :
|
|
1728
1789
|
this.maps.layers[j].shapeSettings.border.opacity).toString());
|
|
@@ -1752,7 +1813,7 @@ var Legend = /** @class */ (function () {
|
|
|
1752
1813
|
layerElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[j].shapeSettings.border.opacity) ?
|
|
1753
1814
|
this.maps.layers[j].shapeSettings.opacity :
|
|
1754
1815
|
this.maps.layers[j].shapeSettings.border.opacity).toString());
|
|
1755
|
-
layerElement.setAttribute('stroke-width', (this.maps.layers[j].shapeSettings.border.width).toString());
|
|
1816
|
+
layerElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[j].shapeSettings.border.width) ? 0 : this.maps.layers[j].shapeSettings.border.width).toString());
|
|
1756
1817
|
layerElement.setAttribute('fill-opacity', (this.maps.layers[j].shapeSettings.opacity).toString());
|
|
1757
1818
|
layerElement.setAttribute('stroke', this.maps.layers[j].shapeSettings.border.color);
|
|
1758
1819
|
if (targetEle !== null) {
|
|
@@ -1772,7 +1833,7 @@ var Legend = /** @class */ (function () {
|
|
|
1772
1833
|
targetEle.id.indexOf(this.maps.element.id + '_Legend_Index') !== -1) && this.maps.legendSettings.visible &&
|
|
1773
1834
|
targetEle.id.indexOf('_Text') === -1) {
|
|
1774
1835
|
var LegendInteractive = void 0;
|
|
1775
|
-
var legendIndex = parseFloat(targetEle.id.
|
|
1836
|
+
var legendIndex = parseFloat(targetEle.id.split(this.maps.element.id + '_Legend_Index_')[1]);
|
|
1776
1837
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1777
1838
|
var mapdata = void 0;
|
|
1778
1839
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1793,7 +1854,7 @@ var Legend = /** @class */ (function () {
|
|
|
1793
1854
|
if (this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
|
|
1794
1855
|
LegendInteractive.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
|
|
1795
1856
|
LegendInteractive.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color);
|
|
1796
|
-
LegendInteractive.setAttribute('stroke-width', (this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1857
|
+
LegendInteractive.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1797
1858
|
LegendInteractive.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
|
|
1798
1859
|
this.maps.layers[k].shapeSettings.opacity :
|
|
1799
1860
|
this.maps.layers[k].shapeSettings.border.opacity).toString());
|
|
@@ -1857,7 +1918,7 @@ var Legend = /** @class */ (function () {
|
|
|
1857
1918
|
mapLegendElement.setAttribute('fill', this.maps.layers[0].shapeSettings.fill);
|
|
1858
1919
|
mapLegendElement.setAttribute('stroke', this.maps.layers[0].shapeSettings.border.color);
|
|
1859
1920
|
mapLegendElement.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
|
|
1860
|
-
mapLegendElement.setAttribute('stroke-width', (this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1921
|
+
mapLegendElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1861
1922
|
mapLegendElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
|
|
1862
1923
|
this.maps.layers[k].shapeSettings.opacity :
|
|
1863
1924
|
this.maps.layers[k].shapeSettings.border.opacity).toString());
|
|
@@ -1884,7 +1945,7 @@ var Legend = /** @class */ (function () {
|
|
|
1884
1945
|
this.maps.toggledShapeElementId.splice(toggledShapeIdIndex, 1);
|
|
1885
1946
|
}
|
|
1886
1947
|
mapLegendElement.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
|
|
1887
|
-
mapLegendElement.setAttribute('stroke-width', (this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1948
|
+
mapLegendElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
|
|
1888
1949
|
mapLegendElement.setAttribute('stroke', this.maps.layers[0].shapeSettings.border.color);
|
|
1889
1950
|
mapLegendElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
|
|
1890
1951
|
this.maps.layers[k].shapeSettings.opacity : this.maps.layers[k].shapeSettings.border.opacity).toString());
|
|
@@ -48,15 +48,9 @@ var Marker = /** @class */ (function () {
|
|
|
48
48
|
border: markerSettings.border, colorValuePath: markerSettings.colorValuePath,
|
|
49
49
|
shapeValuePath: markerSettings.shapeValuePath, imageUrlValuePath: markerSettings.imageUrlValuePath
|
|
50
50
|
};
|
|
51
|
-
eventArgs = markerColorChoose(eventArgs, data);
|
|
52
|
-
eventArgs = markerShapeChoose(eventArgs, data);
|
|
53
51
|
_this.maps.trigger('markerRendering', eventArgs, function (MarkerArgs) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
if (markerSettings.shapeValuePath !== eventArgs.shapeValuePath) {
|
|
58
|
-
eventArgs = markerShapeChoose(eventArgs, data);
|
|
59
|
-
}
|
|
52
|
+
eventArgs = markerColorChoose(eventArgs, data);
|
|
53
|
+
eventArgs = markerShapeChoose(eventArgs, data);
|
|
60
54
|
var lng = (!isNullOrUndefined(markerSettings.longitudeValuePath)) ?
|
|
61
55
|
Number(getValueFromObject(data, markerSettings.longitudeValuePath)) : !isNullOrUndefined(data['longitude']) ?
|
|
62
56
|
parseFloat(data['longitude']) : !isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : 0;
|
package/src/maps/maps-model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, NotifyPropertyChanges, INotifyPropertyChanged, Property, Ajax } from '@syncfusion/ej2-base';import { EventHandler, Browser, EmitType, isNullOrUndefined, createElement, setValue, extend } from '@syncfusion/ej2-base';import { Event, remove, L10n, Collection, Internationalization, Complex } from '@syncfusion/ej2-base';import { ModuleDeclaration } from '@syncfusion/ej2-base';import { SvgRenderer } from '@syncfusion/ej2-svg-base';import { Size, createSvg, Point, removeElement, triggerShapeEvent, showTooltip, checkShapeDataFields, MapLocation, getMousePosition } from './utils/helper';import { getElement, removeClass, getTranslate, triggerItemSelectionEvent, mergeSeparateCluster, customizeStyle } from './utils/helper';import { createStyle } from './utils/helper';import { ZoomSettings, LegendSettings, Tile } from './model/base';import { LayerSettings, TitleSettings, Border, Margin, MapsAreaSettings, Annotation, CenterPosition } from './model/base';import { ZoomSettingsModel, LegendSettingsModel, LayerSettingsModel, BubbleSettingsModel } from './model/base-model';import { MarkerSettingsModel, SelectionSettingsModel , InitialMarkerSelectionSettingsModel} from './model/base-model';import { TitleSettingsModel, BorderModel, MarginModel, CenterPositionModel, InitialShapeSelectionSettingsModel } from './model/base-model';import { MapsAreaSettingsModel, AnnotationModel } from './model/base-model';import { Bubble } from './layers/bubble';import { Legend } from './layers/legend';import { Marker } from './layers/marker';import { Highlight } from './user-interaction/highlight';import { Selection } from './user-interaction/selection';import { MapsTooltip } from './user-interaction/tooltip';import { Zoom } from './user-interaction/zoom';import { load, click, rightClick, loaded, doubleClick, resize, shapeSelected, itemSelection, zoomIn } from './model/constants';import { ProjectionType, MapsTheme, PanDirection, TooltipGesture } from './utils/enum';import { getThemeStyle } from './model/theme';import { BingMap } from './layers/bing-map';import { ILoadEventArgs, ILoadedEventArgs, IMouseEventArgs, IResizeEventArgs, ITooltipRenderEventArgs } from './model/interface';import { GeoPosition, ITooltipRenderCompleteEventArgs, ILegendRenderingEventArgs } from './model/interface';import { ILayerRenderingEventArgs, IShapeRenderingEventArgs, IMarkerRenderingEventArgs, IMarkerClickEventArgs } from './model/interface';import { IMarkerMoveEventArgs, ILabelRenderingEventArgs, IBubbleMoveEventArgs, IBubbleClickEventArgs } from './model/interface';import { IMarkerClusterClickEventArgs, IMarkerClusterMoveEventArgs, IMarkerClusterRenderingEventArgs } from './model/interface';import { ISelectionEventArgs, IShapeSelectedEventArgs, IMapPanEventArgs, IMapZoomEventArgs } from './model/interface';import { IBubbleRenderingEventArgs, IAnimationCompleteEventArgs, IPrintEventArgs, IThemeStyle } from './model/interface';import { LayerPanel } from './layers/layer-panel';import { GeoLocation, Rect, RectOption, measureText, getElementByID, MapAjax, processResult } from '../maps/utils/helper';import { findPosition, textTrim, TextOption, renderTextElement, convertGeoToPoint, calculateZoomLevel } from '../maps/utils/helper';import { Annotations } from '../maps/user-interaction/annotation';import { FontModel, DataLabel, MarkerSettings, IAnnotationRenderingEventArgs } from './index';import { NavigationLineSettingsModel, changeBorderWidth } from './index';import { NavigationLine } from './layers/navigation-selected-line';import { DataManager, Query } from '@syncfusion/ej2-data';import { ExportType } from '../maps/utils/enum';import { PdfPageOrientation } from '@syncfusion/ej2-pdf-export';import { Print } from './model/print';import { PdfExport } from './model/export-pdf';import { ImageExport } from './model/export-image';
|
|
1
|
+
import { Component, NotifyPropertyChanges, INotifyPropertyChanged, Property, Ajax } from '@syncfusion/ej2-base';import { EventHandler, Browser, EmitType, isNullOrUndefined, createElement, setValue, extend } from '@syncfusion/ej2-base';import { Event, remove, L10n, Collection, Internationalization, Complex } from '@syncfusion/ej2-base';import { ModuleDeclaration } from '@syncfusion/ej2-base';import { SvgRenderer } from '@syncfusion/ej2-svg-base';import { Size, createSvg, Point, removeElement, triggerShapeEvent, showTooltip, checkShapeDataFields, MapLocation, getMousePosition, calculateSize } from './utils/helper';import { getElement, removeClass, getTranslate, triggerItemSelectionEvent, mergeSeparateCluster, customizeStyle, querySelector } from './utils/helper';import { createStyle } from './utils/helper';import { ZoomSettings, LegendSettings, Tile } from './model/base';import { LayerSettings, TitleSettings, Border, Margin, MapsAreaSettings, Annotation, CenterPosition } from './model/base';import { ZoomSettingsModel, LegendSettingsModel, LayerSettingsModel, BubbleSettingsModel } from './model/base-model';import { MarkerSettingsModel, SelectionSettingsModel , InitialMarkerSelectionSettingsModel} from './model/base-model';import { TitleSettingsModel, BorderModel, MarginModel, CenterPositionModel, InitialShapeSelectionSettingsModel } from './model/base-model';import { MapsAreaSettingsModel, AnnotationModel } from './model/base-model';import { Bubble } from './layers/bubble';import { Legend } from './layers/legend';import { Marker } from './layers/marker';import { Highlight } from './user-interaction/highlight';import { Selection } from './user-interaction/selection';import { MapsTooltip } from './user-interaction/tooltip';import { Zoom } from './user-interaction/zoom';import { load, click, rightClick, loaded, doubleClick, resize, shapeSelected, itemSelection, zoomIn } from './model/constants';import { ProjectionType, MapsTheme, PanDirection, TooltipGesture } from './utils/enum';import { getThemeStyle } from './model/theme';import { BingMap } from './layers/bing-map';import { ILoadEventArgs, ILoadedEventArgs, IMouseEventArgs, IResizeEventArgs, ITooltipRenderEventArgs } from './model/interface';import { GeoPosition, ITooltipRenderCompleteEventArgs, ILegendRenderingEventArgs } from './model/interface';import { ILayerRenderingEventArgs, IShapeRenderingEventArgs, IMarkerRenderingEventArgs, IMarkerClickEventArgs } from './model/interface';import { IMarkerMoveEventArgs, ILabelRenderingEventArgs, IBubbleMoveEventArgs, IBubbleClickEventArgs } from './model/interface';import { IMarkerClusterClickEventArgs, IMarkerClusterMoveEventArgs, IMarkerClusterRenderingEventArgs } from './model/interface';import { ISelectionEventArgs, IShapeSelectedEventArgs, IMapPanEventArgs, IMapZoomEventArgs } from './model/interface';import { IBubbleRenderingEventArgs, IAnimationCompleteEventArgs, IPrintEventArgs, IThemeStyle } from './model/interface';import { LayerPanel } from './layers/layer-panel';import { GeoLocation, Rect, RectOption, measureText, getElementByID, MapAjax, processResult, getElementsByClassName } from '../maps/utils/helper';import { findPosition, textTrim, TextOption, renderTextElement, convertGeoToPoint, calculateZoomLevel } from '../maps/utils/helper';import { Annotations } from '../maps/user-interaction/annotation';import { FontModel, DataLabel, MarkerSettings, IAnnotationRenderingEventArgs } from './index';import { NavigationLineSettingsModel, changeBorderWidth } from './index';import { NavigationLine } from './layers/navigation-selected-line';import { DataManager, Query } from '@syncfusion/ej2-data';import { ExportType } from '../maps/utils/enum';import { PdfPageOrientation } from '@syncfusion/ej2-pdf-export';import { Print } from './model/print';import { PdfExport } from './model/export-pdf';import { ImageExport } from './model/export-image';
|
|
2
2
|
import {ComponentModel} from '@syncfusion/ej2-base';
|
|
3
3
|
|
|
4
4
|
/**
|
package/src/maps/maps.d.ts
CHANGED
|
@@ -801,6 +801,9 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
|
|
|
801
801
|
* @returns {void}
|
|
802
802
|
*/
|
|
803
803
|
mouseLeaveOnMap(e: PointerEvent): void;
|
|
804
|
+
private keyUpHandler;
|
|
805
|
+
private keyboardHighlightSelection;
|
|
806
|
+
private keyDownHandler;
|
|
804
807
|
/**
|
|
805
808
|
* Gets the selected element to be maintained or not.
|
|
806
809
|
*
|
|
@@ -986,6 +989,11 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
|
|
|
986
989
|
* To find navigation line visibility
|
|
987
990
|
*/
|
|
988
991
|
private isNavigationVisible;
|
|
992
|
+
/**
|
|
993
|
+
* To find space between the secondary element and svg element.
|
|
994
|
+
* @private
|
|
995
|
+
*/
|
|
996
|
+
getExtraPosition(): Point;
|
|
989
997
|
/**
|
|
990
998
|
* To find marker visibility
|
|
991
999
|
*/
|
package/src/maps/maps.js
CHANGED
|
@@ -29,8 +29,8 @@ import { Component, NotifyPropertyChanges, Property, Ajax } from '@syncfusion/ej
|
|
|
29
29
|
import { EventHandler, Browser, isNullOrUndefined, createElement, setValue, extend } from '@syncfusion/ej2-base';
|
|
30
30
|
import { Event, remove, L10n, Collection, Internationalization, Complex } from '@syncfusion/ej2-base';
|
|
31
31
|
import { SvgRenderer } from '@syncfusion/ej2-svg-base';
|
|
32
|
-
import { Size, createSvg, Point, removeElement, triggerShapeEvent, showTooltip, checkShapeDataFields, getMousePosition } from './utils/helper';
|
|
33
|
-
import { getElement, removeClass, getTranslate, triggerItemSelectionEvent, mergeSeparateCluster, customizeStyle } from './utils/helper';
|
|
32
|
+
import { Size, createSvg, Point, removeElement, triggerShapeEvent, showTooltip, checkShapeDataFields, getMousePosition, calculateSize } from './utils/helper';
|
|
33
|
+
import { getElement, removeClass, getTranslate, triggerItemSelectionEvent, mergeSeparateCluster, customizeStyle, querySelector } from './utils/helper';
|
|
34
34
|
import { createStyle } from './utils/helper';
|
|
35
35
|
import { ZoomSettings, LegendSettings } from './model/base';
|
|
36
36
|
import { LayerSettings, TitleSettings, Border, Margin, MapsAreaSettings, Annotation, CenterPosition } from './model/base';
|
|
@@ -39,7 +39,7 @@ import { load, click, loaded, doubleClick, resize, shapeSelected, zoomIn } from
|
|
|
39
39
|
import { getThemeStyle } from './model/theme';
|
|
40
40
|
import { BingMap } from './layers/bing-map';
|
|
41
41
|
import { LayerPanel } from './layers/layer-panel';
|
|
42
|
-
import { Rect, RectOption, measureText, getElementByID, MapAjax, processResult } from '../maps/utils/helper';
|
|
42
|
+
import { Rect, RectOption, measureText, getElementByID, MapAjax, processResult, getElementsByClassName } from '../maps/utils/helper';
|
|
43
43
|
import { findPosition, textTrim, TextOption, renderTextElement, convertGeoToPoint, calculateZoomLevel } from '../maps/utils/helper';
|
|
44
44
|
import { Annotations } from '../maps/user-interaction/annotation';
|
|
45
45
|
import { MarkerSettings } from './index';
|
|
@@ -395,7 +395,15 @@ var Maps = /** @class */ (function (_super) {
|
|
|
395
395
|
}
|
|
396
396
|
this.mapLayerPanel.measureLayerPanel();
|
|
397
397
|
this.element.appendChild(this.svgObject);
|
|
398
|
+
var position = this.getExtraPosition();
|
|
398
399
|
for (var i = 0; i < this.layers.length; i++) {
|
|
400
|
+
if (position.x !== 0 || position.y !== 0) {
|
|
401
|
+
var markerTemplate = document.getElementById(this.element.id + '_LayerIndex_' + i + '_Markers_Template_Group');
|
|
402
|
+
if (!isNullOrUndefined(markerTemplate)) {
|
|
403
|
+
markerTemplate.style.top = this.mapAreaRect.y + position.y + 'px';
|
|
404
|
+
markerTemplate.style.left = this.mapAreaRect.x + position.x + 'px';
|
|
405
|
+
}
|
|
406
|
+
}
|
|
399
407
|
if (this.layers[i].selectionSettings && this.layers[i].selectionSettings.enable &&
|
|
400
408
|
this.layers[i].initialShapeSelection.length > 0 && this.checkInitialRender) {
|
|
401
409
|
var checkSelection = this.layers[i].selectionSettings.enableMultiSelect;
|
|
@@ -795,7 +803,6 @@ var Maps = /** @class */ (function (_super) {
|
|
|
795
803
|
var titleBounds = new Rect(location_1.x, location_1.y, elementSize.width, elementSize.height);
|
|
796
804
|
var element = renderTextElement(options, style, style.color || (type === 'title' ? this.themeStyle.titleFontColor : this.themeStyle.subTitleFontColor), groupEle);
|
|
797
805
|
element.setAttribute('aria-label', this.description || title.text);
|
|
798
|
-
element.setAttribute('tabindex', (this.tabIndex + (type === 'title' ? 1 : 2)).toString());
|
|
799
806
|
if ((type === 'title' && !title.subtitleSettings.text) || (type === 'subtitle')) {
|
|
800
807
|
height = Math.abs((titleBounds.y + this.margin.bottom) - this.availableSize.height);
|
|
801
808
|
this.mapAreaRect = new Rect(this.margin.left, titleBounds.y + 10, width, height - 10);
|
|
@@ -854,6 +861,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
854
861
|
EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap, this);
|
|
855
862
|
EventHandler.add(this.element, Browser.touchEndEvent, this.mouseEndOnMap, this);
|
|
856
863
|
EventHandler.add(this.element, 'pointerleave mouseleave', this.mouseLeaveOnMap, this);
|
|
864
|
+
EventHandler.add(this.element, 'keydown', this.keyDownHandler, this);
|
|
865
|
+
EventHandler.add(this.element, 'keyup', this.keyUpHandler, this);
|
|
857
866
|
// EventHandler.add(this.element, cancelEvent, this.mouseLeaveOnMap, this);
|
|
858
867
|
window.addEventListener((Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.mapsOnResize.bind(this));
|
|
859
868
|
};
|
|
@@ -871,6 +880,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
871
880
|
EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap);
|
|
872
881
|
EventHandler.remove(this.element, Browser.touchEndEvent, this.mouseEndOnMap);
|
|
873
882
|
EventHandler.remove(this.element, 'pointerleave mouseleave', this.mouseLeaveOnMap);
|
|
883
|
+
EventHandler.remove(this.element, 'keydown', this.keyDownHandler);
|
|
884
|
+
EventHandler.remove(this.element, 'keyup', this.keyUpHandler);
|
|
874
885
|
//EventHandler.remove(this.element, cancelEvent, this.mouseLeaveOnMap);
|
|
875
886
|
window.removeEventListener((Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.mapsOnResize);
|
|
876
887
|
};
|
|
@@ -886,6 +897,96 @@ var Maps = /** @class */ (function (_super) {
|
|
|
886
897
|
removeClass(document.getElementsByClassName('highlightMapStyle')[0]);
|
|
887
898
|
}
|
|
888
899
|
};
|
|
900
|
+
Maps.prototype.keyUpHandler = function (event) {
|
|
901
|
+
var id = event.target['id'];
|
|
902
|
+
if (event.code === 'Tab' && id.indexOf('_LayerIndex_') > -1 && id.indexOf('shapeIndex') > -1) {
|
|
903
|
+
this.keyboardHighlightSelection(id, event.type);
|
|
904
|
+
}
|
|
905
|
+
else if (id.indexOf('_LayerIndex_') === -1 && id.indexOf('shapeIndex') === -1 &&
|
|
906
|
+
getElementsByClassName('highlightMapStyle').length > 0) {
|
|
907
|
+
removeClass(getElementsByClassName('highlightMapStyle')[0]);
|
|
908
|
+
if (this.legendSettings.visible && this.legendModule) {
|
|
909
|
+
this.legendModule.removeShapeHighlightCollection();
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
Maps.prototype.keyboardHighlightSelection = function (id, key) {
|
|
914
|
+
var layerIndex = parseInt(id.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
915
|
+
var shapeIndex = parseInt(id.split('_shapeIndex_')[1].split('_')[0], 10);
|
|
916
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
917
|
+
var shapeData = this.layers[layerIndex].shapeData['features']['length'] > shapeIndex ?
|
|
918
|
+
this.layers[layerIndex].shapeData['features'][shapeIndex]['properties'] : null;
|
|
919
|
+
var dataIndex = parseInt(id.split('_dataIndex_')[1].split('_')[0], 10);
|
|
920
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
921
|
+
var data = isNullOrUndefined(dataIndex) ? null : this.layers[layerIndex].dataSource[dataIndex];
|
|
922
|
+
if (this.layers[layerIndex].selectionSettings.enable && key === 'keydown' && this.selectionModule) {
|
|
923
|
+
this.selectionModule.selectionsettings = this.layers[layerIndex].selectionSettings;
|
|
924
|
+
this.selectionModule.selectionType = 'Shape';
|
|
925
|
+
this.selectionModule.selectElement(event.target, layerIndex, data, shapeData);
|
|
926
|
+
}
|
|
927
|
+
else if (this.highlightModule && (this.layers[layerIndex].highlightSettings.enable && key === 'keyup' &&
|
|
928
|
+
!event.target.classList.contains('ShapeselectionMapStyle'))) {
|
|
929
|
+
this.highlightModule.highlightSettings = this.layers[layerIndex].highlightSettings;
|
|
930
|
+
this.highlightModule.handleHighlight(event.target, layerIndex, data, shapeData);
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
Maps.prototype.keyDownHandler = function (event) {
|
|
934
|
+
var zoom = this.zoomModule;
|
|
935
|
+
if ((event.key === '+' || event.code === 'Equal') && zoom) {
|
|
936
|
+
zoom.performZoomingByToolBar('zoomin');
|
|
937
|
+
}
|
|
938
|
+
else if ((event.key === '-' || event.code === 'Minus') && zoom) {
|
|
939
|
+
zoom.performZoomingByToolBar('zoomout');
|
|
940
|
+
}
|
|
941
|
+
else if (event['keyCode'] === 82 && zoom) {
|
|
942
|
+
zoom.performZoomingByToolBar('reset');
|
|
943
|
+
}
|
|
944
|
+
else if ((event.code === 'ArrowUp' || event.code === 'ArrowDown') && zoom) {
|
|
945
|
+
event.preventDefault();
|
|
946
|
+
zoom.mouseDownLatLong['x'] = 0;
|
|
947
|
+
zoom.mouseMoveLatLong['y'] = this.mapAreaRect.height / 7;
|
|
948
|
+
zoom.panning('None', zoom.mouseDownLatLong['x'], event.code === 'ArrowUp' ? -(zoom.mouseMoveLatLong['y']) :
|
|
949
|
+
zoom.mouseMoveLatLong['y'], event);
|
|
950
|
+
zoom.mouseDownLatLong['y'] = zoom.mouseMoveLatLong['y'];
|
|
951
|
+
}
|
|
952
|
+
else if ((event.code === 'ArrowLeft' || event.code === 'ArrowRight') && zoom) {
|
|
953
|
+
event.preventDefault();
|
|
954
|
+
zoom.mouseDownLatLong['y'] = 0;
|
|
955
|
+
zoom.mouseMoveLatLong['x'] = this.mapAreaRect.width / 7;
|
|
956
|
+
zoom.panning('None', event.code === 'ArrowLeft' ? -(zoom.mouseMoveLatLong['x']) : zoom.mouseMoveLatLong['x'], zoom.mouseDownLatLong['y'], event);
|
|
957
|
+
zoom.mouseDownLatLong['x'] = zoom.mouseMoveLatLong['x'];
|
|
958
|
+
}
|
|
959
|
+
else if (event.code === 'Enter') {
|
|
960
|
+
var id = event.target['id'];
|
|
961
|
+
event.preventDefault();
|
|
962
|
+
if (this.legendModule && (id.indexOf('_Left_Page_Rect') > -1 || id.indexOf('_Right_Page_Rect') > -1)) {
|
|
963
|
+
this.legendModule.currentPage = (id.indexOf('_Left_Page_') > -1) ? (this.legendModule.currentPage - 1) :
|
|
964
|
+
(this.legendModule.currentPage + 1);
|
|
965
|
+
this.legendModule.legendGroup = this.renderer.createGroup({ id: this.element.id + '_Legend_Group' });
|
|
966
|
+
this.legendModule.drawLegendItem(this.legendModule.currentPage);
|
|
967
|
+
var textContent = (document.getElementById(this.element.id + '_Paging_Text')).textContent;
|
|
968
|
+
var text = textContent.split('/').map(Number);
|
|
969
|
+
if (id.indexOf('_Left_Page_Rect') > -1) {
|
|
970
|
+
if (text[0] !== 1) {
|
|
971
|
+
event.target.focus();
|
|
972
|
+
}
|
|
973
|
+
event.target.style.outlineColor = text[0] - 1 !== text[1] ? '' : 'transparent';
|
|
974
|
+
}
|
|
975
|
+
else if (id.indexOf('_Right_Page_Rect') > -1) {
|
|
976
|
+
if (text[0] !== text[1]) {
|
|
977
|
+
event.target.focus();
|
|
978
|
+
}
|
|
979
|
+
event.target.style.outlineColor = text[0] !== text[1] + 1 ? '' : 'transparent';
|
|
980
|
+
}
|
|
981
|
+
if (querySelector(this.element.id + '_Legend_Border', this.element.id)) {
|
|
982
|
+
querySelector(this.element.id + '_Legend_Border', this.element.id).style.pointerEvents = 'none';
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
if (id.indexOf('shapeIndex') > -1) {
|
|
986
|
+
this.keyboardHighlightSelection(id, event.type);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
};
|
|
889
990
|
/**
|
|
890
991
|
* Gets the selected element to be maintained or not.
|
|
891
992
|
*
|
|
@@ -1233,26 +1334,28 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1233
1334
|
*/
|
|
1234
1335
|
Maps.prototype.mapsOnResize = function (e) {
|
|
1235
1336
|
var _this = this;
|
|
1236
|
-
this.isResize = true;
|
|
1337
|
+
this.isResize = this.isReset = true;
|
|
1237
1338
|
var args = {
|
|
1339
|
+
cancel: false,
|
|
1238
1340
|
name: resize,
|
|
1239
1341
|
previousSize: this.availableSize,
|
|
1240
|
-
currentSize:
|
|
1342
|
+
currentSize: calculateSize(this),
|
|
1241
1343
|
maps: this
|
|
1242
1344
|
};
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1345
|
+
this.trigger(resize, args);
|
|
1346
|
+
if (!args.cancel) {
|
|
1347
|
+
if (this.resizeTo) {
|
|
1348
|
+
clearTimeout(this.resizeTo);
|
|
1349
|
+
}
|
|
1350
|
+
if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-maps')) {
|
|
1351
|
+
this.resizeTo = setTimeout(function () {
|
|
1352
|
+
_this.unWireEVents();
|
|
1353
|
+
_this.createSVG();
|
|
1354
|
+
_this.refreshing = true;
|
|
1355
|
+
_this.wireEVents();
|
|
1356
|
+
_this.render();
|
|
1357
|
+
}, 500);
|
|
1358
|
+
}
|
|
1256
1359
|
}
|
|
1257
1360
|
return false;
|
|
1258
1361
|
};
|
|
@@ -1840,6 +1943,26 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1840
1943
|
});
|
|
1841
1944
|
return isVisible;
|
|
1842
1945
|
};
|
|
1946
|
+
/**
|
|
1947
|
+
* To find space between the secondary element and svg element.
|
|
1948
|
+
* @private
|
|
1949
|
+
*/
|
|
1950
|
+
Maps.prototype.getExtraPosition = function () {
|
|
1951
|
+
var top = 0;
|
|
1952
|
+
var left = 0;
|
|
1953
|
+
var svgElement = getElement(this.element.id + '_svg');
|
|
1954
|
+
if (!isNullOrUndefined(svgElement)) {
|
|
1955
|
+
var svgClientRects = svgElement.getClientRects();
|
|
1956
|
+
var mapsClientRects = (getElement(this.element.id + '_Secondary_Element')).getClientRects();
|
|
1957
|
+
if (svgClientRects.length !== 0 && mapsClientRects.length !== 0) {
|
|
1958
|
+
var svgClientRect = svgClientRects[0];
|
|
1959
|
+
var mapsClientRect = mapsClientRects[0];
|
|
1960
|
+
top = svgClientRect.top - mapsClientRect.top;
|
|
1961
|
+
left = svgClientRect.left - mapsClientRect.left;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
return new Point(left, top);
|
|
1965
|
+
};
|
|
1843
1966
|
/**
|
|
1844
1967
|
* To find marker visibility
|
|
1845
1968
|
*/
|
|
@@ -975,6 +975,13 @@ export interface ToggleLegendSettingsModel {
|
|
|
975
975
|
*/
|
|
976
976
|
export interface LegendSettingsModel {
|
|
977
977
|
|
|
978
|
+
/**
|
|
979
|
+
* Enables or disables to render the legend item based on the shapes from the data source of markers.
|
|
980
|
+
*
|
|
981
|
+
* @default false
|
|
982
|
+
*/
|
|
983
|
+
useMarkerShape?: boolean;
|
|
984
|
+
|
|
978
985
|
/**
|
|
979
986
|
* Enables or disables the toggle visibility for legend in maps.
|
|
980
987
|
*
|