@syncfusion/ej2-maps 19.4.38 → 19.4.52

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.
@@ -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
  *
@@ -845,6 +845,12 @@ export declare class ToggleLegendSettings extends ChildProperty<ToggleLegendSett
845
845
  * Sets and gets the options to customize the legend of the maps.
846
846
  */
847
847
  export declare class LegendSettings extends ChildProperty<LegendSettings> {
848
+ /**
849
+ * Enables or disables to render the legend item based on the shapes from the data source of markers.
850
+ *
851
+ * @default false
852
+ */
853
+ useMarkerShape: boolean;
848
854
  /**
849
855
  * Enables or disables the toggle visibility for legend in maps.
850
856
  *
@@ -655,6 +655,9 @@ var LegendSettings = /** @class */ (function (_super) {
655
655
  function LegendSettings() {
656
656
  return _super !== null && _super.apply(this, arguments) || this;
657
657
  }
658
+ __decorate([
659
+ Property(false)
660
+ ], LegendSettings.prototype, "useMarkerShape", void 0);
658
661
  __decorate([
659
662
  Property(false)
660
663
  ], LegendSettings.prototype, "toggleVisibility", void 0);
@@ -109,9 +109,7 @@ export interface ITooltipRenderCompleteEventArgs extends IMapsEventArgs {
109
109
  /**
110
110
  * Specifies the event arguments for the resize event in maps.
111
111
  */
112
- export interface IResizeEventArgs {
113
- /** Defines the name of the event. */
114
- name: string;
112
+ export interface IResizeEventArgs extends IMapsEventArgs {
115
113
  /** Defines the previous size of the maps before the resize event. */
116
114
  previousSize: Size;
117
115
  /** Defines the current size of the maps after the resize event. */
@@ -1,10 +1,14 @@
1
1
  import { Maps } from '../../index';
2
+ import { HighlightSettingsModel } from '../index';
2
3
  /**
3
4
  * Highlight module class
4
5
  */
5
6
  export declare class Highlight {
6
7
  private maps;
7
- private highlightSettings;
8
+ /**
9
+ * @private
10
+ */
11
+ highlightSettings: HighlightSettingsModel;
8
12
  constructor(maps: Maps);
9
13
  /**
10
14
  * To bind events for highlight module
@@ -23,6 +27,10 @@ export declare class Highlight {
23
27
  */
24
28
  addHighlight(layerIndex: number, name: string, enable: boolean): void;
25
29
  private mouseMove;
30
+ /**
31
+ * @private
32
+ */
33
+ handleHighlight(targetElement: Element, layerIndex: number, data: any, shapeData: any): void;
26
34
  private mapHighlight;
27
35
  private highlightMap;
28
36
  /**
@@ -93,14 +93,7 @@ var Highlight = /** @class */ (function () {
93
93
  this.highlightSettings = this.maps.layers[layerIndex].navigationLineSettings[index].highlightSettings;
94
94
  }
95
95
  if (this.highlightSettings.enable) {
96
- if (this.maps.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1) {
97
- this.maps.legendModule.shapeHighLightAndSelection(targetEle, data, this.highlightSettings, 'highlight', layerIndex);
98
- }
99
- var selectHighLight = targetEle.id.indexOf('shapeIndex') > -1 && this.maps.legendSettings.visible ?
100
- this.maps.legendModule.shapeToggled : true;
101
- if (selectHighLight) {
102
- this.mapHighlight(targetEle, shapeData, data);
103
- }
96
+ this.handleHighlight(targetEle, layerIndex, data, shapeData);
104
97
  }
105
98
  else {
106
99
  var element = document.getElementsByClassName('highlightMapStyle')[0];
@@ -124,21 +117,35 @@ var Highlight = /** @class */ (function () {
124
117
  targetEle.setAttribute('stroke', this.maps.layers[layerIndex].navigationLineSettings[index].color);
125
118
  }
126
119
  removeClass(targetEle);
127
- if (this.maps.legendSettings.visible) {
120
+ if (this.maps.legendSettings.visible && this.maps.legendModule) {
128
121
  this.maps.legendModule.removeShapeHighlightCollection();
129
122
  }
130
123
  }
131
124
  else if ((targetEle.id.indexOf(this.maps.element.id + '_Legend_Shape_Index') !== -1 ||
132
- targetEle.id.indexOf(this.maps.element.id + '_Legend_Index') !== -1) &&
125
+ targetEle.id.indexOf(this.maps.element.id + '_Legend_Index') !== -1) && this.maps.legendModule &&
133
126
  this.maps.legendSettings.visible && targetEle.id.indexOf('_Text') === -1) {
134
127
  this.maps.legendModule.legendHighLightAndSelection(targetEle, 'highlight');
135
128
  }
136
129
  else {
137
- if (this.maps.legendSettings.visible) {
130
+ if (this.maps.legendSettings.visible && this.maps.legendModule) {
138
131
  this.maps.legendModule.removeLegendHighlightCollection();
139
132
  }
140
133
  }
141
134
  };
135
+ /**
136
+ * @private
137
+ */
138
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
+ Highlight.prototype.handleHighlight = function (targetElement, layerIndex, data, shapeData) {
140
+ if (this.maps.legendSettings.visible && targetElement.id.indexOf('_MarkerIndex_') === -1 && this.maps.legendModule) {
141
+ this.maps.legendModule.shapeHighLightAndSelection(targetElement, data, this.highlightSettings, 'highlight', layerIndex);
142
+ }
143
+ var selectHighLight = targetElement.id.indexOf('shapeIndex') > -1 && (this.maps.legendSettings.visible && this.maps.legendModule) ?
144
+ this.maps.legendModule.shapeToggled : true;
145
+ if (selectHighLight) {
146
+ this.mapHighlight(targetElement, shapeData, data);
147
+ }
148
+ };
142
149
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
150
  Highlight.prototype.mapHighlight = function (targetEle, shapeData, data) {
144
151
  var _this = this;
@@ -1,10 +1,14 @@
1
1
  import { Maps } from '../../index';
2
+ import { SelectionSettingsModel } from '../index';
2
3
  /**
3
4
  * Selection module class
4
5
  */
5
6
  export declare class Selection {
6
7
  private maps;
7
- private selectionsettings;
8
+ /**
9
+ * @private
10
+ */
11
+ selectionsettings: SelectionSettingsModel;
8
12
  /**
9
13
  * @private
10
14
  */
@@ -23,6 +27,10 @@ export declare class Selection {
23
27
  */
24
28
  private removeEventListener;
25
29
  private mouseClick;
30
+ /**
31
+ * @private
32
+ */
33
+ selectElement(targetElement: Element, layerIndex: number, data: any, shapeData: any): void;
26
34
  /**
27
35
  * Public method for selection
28
36
  */
@@ -80,24 +80,31 @@ var Selection = /** @class */ (function () {
80
80
  this.selectionType = 'navigationline';
81
81
  }
82
82
  if (this.selectionsettings.enable) {
83
- this.maps.mapSelect = targetElement ? true : false;
84
- if (this.maps.legendSettings.visible && targetElement.id.indexOf('_MarkerIndex_') === -1) {
85
- this.maps.legendModule.shapeHighLightAndSelection(targetElement, data, this.selectionsettings, 'selection', layerIndex);
86
- }
87
- var shapeToggled = (targetElement.id.indexOf('shapeIndex') > -1 && this.maps.legendSettings.visible) ?
88
- this.maps.legendModule.shapeToggled : true;
89
- if (shapeToggled) {
90
- this.selectMap(targetElement, shapeData, data);
91
- }
83
+ this.selectElement(targetElement, layerIndex, data, shapeData);
92
84
  }
93
85
  }
94
- else if (this.maps.legendSettings.visible && !this.maps.legendSettings.toggleLegendSettings.enable &&
86
+ else if ((this.maps.legendSettings.visible && !this.maps.legendSettings.toggleLegendSettings.enable && this.maps.legendModule) &&
95
87
  !isNullOrUndefined(targetElement.id) && targetElement.id.indexOf('_Text') === -1 &&
96
88
  (targetElement.id.indexOf(this.maps.element.id + '_Legend_Shape_Index') > -1 ||
97
89
  targetElement.id.indexOf(this.maps.element.id + '_Legend_Index') !== -1)) {
98
90
  this.maps.legendModule.legendHighLightAndSelection(targetElement, 'selection');
99
91
  }
100
92
  };
93
+ /**
94
+ * @private
95
+ */
96
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
+ Selection.prototype.selectElement = function (targetElement, layerIndex, data, shapeData) {
98
+ this.maps.mapSelect = targetElement ? true : false;
99
+ if (this.maps.legendModule && this.maps.legendSettings.visible && targetElement.id.indexOf('_MarkerIndex_') === -1) {
100
+ this.maps.legendModule.shapeHighLightAndSelection(targetElement, data, this.selectionsettings, 'selection', layerIndex);
101
+ }
102
+ var shapeToggled = (targetElement.id.indexOf('shapeIndex') > -1 && this.maps.legendSettings.visible && this.maps.legendModule) ?
103
+ this.maps.legendModule.shapeToggled : true;
104
+ if (shapeToggled) {
105
+ this.selectMap(targetElement, shapeData, data);
106
+ }
107
+ };
101
108
  // eslint-disable-next-line valid-jsdoc
102
109
  /**
103
110
  * Public method for selection
@@ -103,7 +103,10 @@ export declare class Zoom {
103
103
  private dataLabelTranslate;
104
104
  private markerTranslate;
105
105
  private markerLineAnimation;
106
- panning(direction: PanDirection, xDifference: number, yDifference: number, mouseLocation?: PointerEvent | TouchEvent): void;
106
+ /**
107
+ * @private
108
+ */
109
+ panning(direction: PanDirection, xDifference: number, yDifference: number, mouseLocation?: PointerEvent | TouchEvent | KeyboardEvent): void;
107
110
  private toAlignSublayer;
108
111
  toolBarZooming(zoomFactor: number, type: string): void;
109
112
  createZoomingToolbars(): void;
@@ -847,6 +847,9 @@ var Zoom = /** @class */ (function () {
847
847
  }
848
848
  }
849
849
  };
850
+ /**
851
+ * @private
852
+ */
850
853
  Zoom.prototype.panning = function (direction, xDifference, yDifference, mouseLocation) {
851
854
  var map = this.maps;
852
855
  var panArgs;
@@ -865,6 +868,8 @@ var Zoom = /** @class */ (function () {
865
868
  yDifference = !isNullOrUndefined(yDifference) ? yDifference : (down.y - move.y);
866
869
  this.maps.mergeCluster();
867
870
  if (!map.isTileMap) {
871
+ var legendElement = document.getElementById(map.element.id + '_Legend_Group');
872
+ var legendHeight = !isNullOrUndefined(legendElement) ? legendElement.getClientRects()[0].height : 0;
868
873
  x = translatePoint.x - xDifference / scale;
869
874
  y = translatePoint.y - yDifference / scale;
870
875
  var layerRect = getElementByID(map.element.id + '_Layer_Collections').getBoundingClientRect();
@@ -872,7 +877,7 @@ var Zoom = /** @class */ (function () {
872
877
  var panningXDirection = ((xDifference < 0 ? layerRect.left <= (elementRect.left + map.mapAreaRect.x) :
873
878
  ((layerRect.left + layerRect.width) >= (elementRect.left + elementRect.width) + map.mapAreaRect.x + map.margin.left)));
874
879
  var panningYDirection = ((yDifference < 0 ? layerRect.top <= (elementRect.top + map.mapAreaRect.y) :
875
- ((layerRect.top + layerRect.height + map.margin.top) >= (elementRect.top + elementRect.height))));
880
+ ((layerRect.top + layerRect.height + legendHeight + map.margin.top) >= (elementRect.top + elementRect.height))));
876
881
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
877
882
  var location_3 = this.maps.getGeoLocation(this.maps.layersCollection.length - 1, mouseLocation['layerX'], mouseLocation['layerY']);
878
883
  panArgs = {
@@ -1285,8 +1290,9 @@ var Zoom = /** @class */ (function () {
1285
1290
  x = (size.width - toolBarSize.width) - padding;
1286
1291
  break;
1287
1292
  }
1288
- element.style.left = x + 'px';
1289
- element.style.top = y + 'px';
1293
+ var extraPosition = map.getExtraPosition();
1294
+ element.style.left = x + extraPosition.x + 'px';
1295
+ element.style.top = y + extraPosition.y + 'px';
1290
1296
  var color = this.maps.zoomSettings.highlightColor || this.maps.themeStyle.zoomSelectionColor;
1291
1297
  var css = ' .e-maps-toolbar:hover > circle { stroke:' + color + '; } .e-maps-toolbar:hover > path { fill: ' + color + ' ; stroke: ' + color + '; }' +
1292
1298
  '.e-maps-toolbar:hover { cursor: pointer; } .e-maps-cursor-disable:hover { cursor: not-allowed; } .e-maps-panning:hover { cursor: pointer; } ' +
@@ -245,7 +245,9 @@ export declare type LegendShape =
245
245
  /** Specifies the legend shape as a pentagon. */
246
246
  'Pentagon' |
247
247
  /** Specifies the legend shape as a inverted triangle. */
248
- 'InvertedTriangle';
248
+ 'InvertedTriangle' |
249
+ /** Specifies to render the marker shape as balloon on maps. */
250
+ 'Balloon';
249
251
  /**
250
252
  * Defines the legend arrangement in the maps component.
251
253
  */
@@ -31,7 +31,7 @@ export declare function stringToNumber(value: string, containerSize: number): nu
31
31
  * @param {Maps} maps Specifies the maps instance
32
32
  * @returns {void}
33
33
  */
34
- export declare function calculateSize(maps: Maps): void;
34
+ export declare function calculateSize(maps: Maps): Size;
35
35
  /**
36
36
  * Method to create svg for maps.
37
37
  *
@@ -678,7 +678,7 @@ export declare function drawStar(maps: Maps, options: PathOption, size: Size, lo
678
678
  * @returns {Element} - Returns the element
679
679
  * @private
680
680
  */
681
- export declare function drawBalloon(maps: Maps, options: PathOption, size: Size, location: MapLocation, element?: Element): Element;
681
+ export declare function drawBalloon(maps: Maps, options: PathOption, size: Size, location: MapLocation, type: string, element?: Element): Element;
682
682
  /**
683
683
  * Internal rendering of Pattern
684
684
  *
@@ -61,13 +61,15 @@ export function calculateSize(maps) {
61
61
  var containerHeight = maps.element.clientHeight;
62
62
  var containerElementWidth = stringToNumber(maps.element.style.width, containerWidth);
63
63
  var containerElementHeight = stringToNumber(maps.element.style.height, containerHeight);
64
+ var availableSize = new Size(0, 0);
64
65
  if (maps.width === '0px' || maps.width === '0%' || maps.height === '0%' || maps.height === '0px') {
65
- maps.availableSize = new Size(0, 0);
66
+ availableSize = new Size(0, 0);
66
67
  }
67
68
  else {
68
- maps.availableSize = new Size(stringToNumber(maps.width, containerWidth) || containerWidth || containerElementWidth || 600, stringToNumber(maps.height, containerHeight) || containerHeight || containerElementHeight || (maps.isDevice ?
69
+ availableSize = new Size(stringToNumber(maps.width, containerWidth) || containerWidth || containerElementWidth || 600, stringToNumber(maps.height, containerHeight) || containerHeight || containerElementHeight || (maps.isDevice ?
69
70
  Math.min(window.innerWidth, window.innerHeight) : 450));
70
71
  }
72
+ return availableSize;
71
73
  }
72
74
  /**
73
75
  * Method to create svg for maps.
@@ -77,7 +79,7 @@ export function calculateSize(maps) {
77
79
  */
78
80
  export function createSvg(maps) {
79
81
  maps.renderer = new SvgRenderer(maps.element.id);
80
- calculateSize(maps);
82
+ maps.availableSize = calculateSize(maps);
81
83
  maps.svgObject = maps.renderer.createSvg({
82
84
  id: maps.element.id + '_svg',
83
85
  width: maps.availableSize.width,
@@ -876,7 +878,7 @@ export function markerShapeChoose(eventArgs, data) {
876
878
  var shape = ((eventArgs.shapeValuePath.indexOf('.') > -1) ?
877
879
  (getValueFromObject(data, eventArgs.shapeValuePath).toString()) :
878
880
  data[eventArgs.shapeValuePath]);
879
- eventArgs.shape = shape;
881
+ eventArgs.shape = (shape.toString() !== "") ? shape : eventArgs.shape;
880
882
  if (data[eventArgs.shapeValuePath] === 'Image') {
881
883
  eventArgs.imageUrl = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
882
884
  ((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
@@ -885,7 +887,7 @@ export function markerShapeChoose(eventArgs, data) {
885
887
  }
886
888
  else {
887
889
  var shapes = (!isNullOrUndefined(eventArgs.shapeValuePath)) ? ((eventArgs.shapeValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.shapeValuePath).toString() : eventArgs.shape) : eventArgs.shape;
888
- eventArgs.shape = shapes;
890
+ eventArgs.shape = (shapes.toString() !== "") ? shapes : eventArgs.shape;
889
891
  var shapeImage = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
890
892
  ((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
891
893
  data[eventArgs.imageUrlValuePath] : eventArgs.imageUrl)) : eventArgs.imageUrl;
@@ -1448,7 +1450,7 @@ export function calculateShapes(maps, shape, options, size, location, markerEle)
1448
1450
  var tempGroup;
1449
1451
  switch (shape) {
1450
1452
  case 'Balloon':
1451
- tempGroup = drawBalloon(maps, options, size, location, markerEle);
1453
+ tempGroup = drawBalloon(maps, options, size, location, 'Marker', markerEle);
1452
1454
  break;
1453
1455
  case 'Cross':
1454
1456
  options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' + (location.y + size.height
@@ -1606,9 +1608,10 @@ export function drawStar(maps, options, size, location, element) {
1606
1608
  * @returns {Element} - Returns the element
1607
1609
  * @private
1608
1610
  */
1609
- export function drawBalloon(maps, options, size, location, element) {
1611
+ export function drawBalloon(maps, options, size, location, type, element) {
1610
1612
  var width = size.width;
1611
1613
  var height = size.height;
1614
+ var pathElement;
1612
1615
  location.x -= width / 2;
1613
1616
  location.y -= height;
1614
1617
  options.d = 'M15,0C8.8,0,3.8,5,3.8,11.2C3.8,17.5,9.4,24.4,15,30c5.6-5.6,11.2-12.5,11.2-18.8C26.2,5,21.2,0,15,0z M15,16' +
@@ -1617,9 +1620,15 @@ export function drawBalloon(maps, options, size, location, element) {
1617
1620
  var x = size.width / 30;
1618
1621
  var y = size.height / 30;
1619
1622
  balloon.setAttribute('transform', 'translate(' + location.x + ', ' + location.y + ') scale(' + x + ', ' + y + ')');
1620
- var g = maps.renderer.createGroup({ id: options.id });
1621
- appendShape(balloon, g);
1622
- return appendShape(g, element);
1623
+ if (type === 'Marker') {
1624
+ var g = maps.renderer.createGroup({ id: options.id });
1625
+ appendShape(balloon, g);
1626
+ pathElement = appendShape(g, element);
1627
+ }
1628
+ else {
1629
+ pathElement = balloon;
1630
+ }
1631
+ return pathElement;
1623
1632
  }
1624
1633
  /**
1625
1634
  * Internal rendering of Pattern
@@ -2744,6 +2753,8 @@ export function renderLegendShape(location, size, shape, options, url) {
2744
2753
  var shapeY = location.y;
2745
2754
  var x = location.x + (-shapeWidth / 2);
2746
2755
  var y = location.y + (-shapeHeight / 2);
2756
+ options['stroke'] = (shape === 'HorizontalLine' || shape === 'VerticalLine' || shape === 'Cross') ? options['fill'] : options['stroke'];
2757
+ options['stroke-width'] = (options['stroke-width'] === 0 && (shape === 'HorizontalLine' || shape === 'VerticalLine' || shape === 'Cross')) ? 1 : options['stroke-width'];
2747
2758
  switch (shape) {
2748
2759
  case 'Circle':
2749
2760
  case 'Bubble':
@@ -2755,6 +2766,11 @@ export function renderLegendShape(location, size, shape, options, url) {
2755
2766
  + (shapeY + (-shapeHeight / 2));
2756
2767
  merge(options, { 'd': renderPath });
2757
2768
  break;
2769
+ case 'HorizontalLine':
2770
+ renderPath = 'M' + ' ' + shapeX + ' ' + shapeY + ' ' + 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' '
2771
+ + shapeY;
2772
+ merge(options, { 'd': renderPath });
2773
+ break;
2758
2774
  case 'Diamond':
2759
2775
  renderPath = 'M' + ' ' + x + ' ' + shapeY + ' ' +
2760
2776
  'L' + ' ' + shapeX + ' ' + (shapeY + (-shapeHeight / 2)) + ' ' +