@syncfusion/ej2-maps 20.4.40 → 20.4.44

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.
@@ -8000,7 +8000,8 @@ let Maps = class Maps extends Component {
8000
8000
  EventHandler.add(this.element, 'keydown', this.keyDownHandler, this);
8001
8001
  EventHandler.add(this.element, 'keyup', this.keyUpHandler, this);
8002
8002
  // EventHandler.add(this.element, cancelEvent, this.mouseLeaveOnMap, this);
8003
- window.addEventListener((Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.mapsOnResize.bind(this));
8003
+ this.resizeEvent = this.mapsOnResize.bind(this);
8004
+ window.addEventListener((Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.resizeEvent);
8004
8005
  }
8005
8006
  /**
8006
8007
  * To unbind event handlers from maps.
@@ -8019,7 +8020,7 @@ let Maps = class Maps extends Component {
8019
8020
  EventHandler.remove(this.element, 'keydown', this.keyDownHandler);
8020
8021
  EventHandler.remove(this.element, 'keyup', this.keyUpHandler);
8021
8022
  //EventHandler.remove(this.element, cancelEvent, this.mouseLeaveOnMap);
8022
- window.removeEventListener((Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.mapsOnResize);
8023
+ window.removeEventListener((Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.resizeEvent);
8023
8024
  }
8024
8025
  /**
8025
8026
  * This method is used to perform operations when mouse pointer leave from maps.
@@ -8861,6 +8862,9 @@ let Maps = class Maps extends Component {
8861
8862
  */
8862
8863
  destroy() {
8863
8864
  this.unWireEVents();
8865
+ if (!isNullOrUndefined(this.mapsTooltipModule)) {
8866
+ this.mapsTooltipModule.removeEventListener();
8867
+ }
8864
8868
  super.destroy();
8865
8869
  this.shapeSelectionItem = [];
8866
8870
  this.toggledShapeElementId = [];
@@ -10936,14 +10940,14 @@ class Legend {
10936
10940
  ' L ' + (rightPageX - width) + ' ' + (locY + height) + ' z ';
10937
10941
  const leftPath = ' M ' + leftPageX + ' ' + locY + ' L ' + (leftPageX + width) + ' ' + (locY - height) +
10938
10942
  ' L ' + (leftPageX + width) + ' ' + (locY + height) + ' z ';
10939
- const leftPageOptions = new PathOption(map.element.id + '_Left_Page', '#a6a6a6', 0, '#a6a6a6', ((page + 1) === 1 ? 0.5 : 1), 1, '', leftPath);
10943
+ const leftPageOptions = new PathOption(map.element.id + '_Left_Page', this.maps.themeStyle.legendTextColor, 0, this.maps.themeStyle.legendTextColor, ((page + 1) === 1 ? 0.5 : 1), 1, '', leftPath);
10940
10944
  leftPageElement.appendChild(render.drawPath(leftPageOptions));
10941
10945
  const 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, '', '');
10942
10946
  let pathEle = render.drawRectangle(leftRectPageOptions);
10943
10947
  pathEle.tabIndex = (page + 1) === 1 ? -1 : (map.tabIndex + 1);
10944
10948
  leftPageElement.appendChild(pathEle);
10945
10949
  this.wireEvents(leftPageElement);
10946
- const rightPageOptions = new PathOption(map.element.id + '_Right_Page', '#a6a6a6', 0, '#a6a6a6', ((page + 1) === this.totalPages.length ? 0.5 : 1), 1, '', rightPath);
10950
+ const rightPageOptions = new PathOption(map.element.id + '_Right_Page', this.maps.themeStyle.legendTextColor, 0, this.maps.themeStyle.legendTextColor, ((page + 1) === this.totalPages.length ? 0.5 : 1), 1, '', rightPath);
10947
10951
  rightPageElement.appendChild(render.drawPath(rightPageOptions));
10948
10952
  const 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, '', '');
10949
10953
  pathEle = render.drawRectangle(rightRectPageOptions);
@@ -10957,7 +10961,7 @@ class Legend {
10957
10961
  'id': map.element.id + '_Paging_Text',
10958
10962
  'x': pageTextX,
10959
10963
  'y': locY + (pagingTextSize.height / 4),
10960
- 'fill': '#a6a6a6',
10964
+ 'fill': this.maps.themeStyle.legendTextColor,
10961
10965
  'font-size': '14px',
10962
10966
  'font-style': pagingFont.fontStyle,
10963
10967
  'font-family': pagingFont.fontFamily,
@@ -12192,22 +12196,10 @@ class Legend {
12192
12196
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
12193
12197
  legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
12194
12198
  if (!this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
12195
- legendShapeId.setAttribute('fill', legendToggleFill);
12196
- legendShapeId.setAttribute('fill-opacity', (legendToggleOpacity).toString());
12197
- legendShapeId.setAttribute('stroke', legendToggleBorderColor);
12198
- legendShapeId.setAttribute('stroke-width', (legendToggleBorderWidth).toString());
12199
- legendShapeId.setAttribute('stroke-opacity', (legendToggleBorderOpacity).toString());
12200
- legendTextId.setAttribute('fill', legendToggleFill);
12199
+ this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
12201
12200
  }
12202
12201
  else {
12203
- legendTextId.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
12204
- legendShapeId.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
12205
- legendShapeId.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color);
12206
- legendShapeId.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
12207
- legendShapeId.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
12208
- legendShapeId.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
12209
- this.maps.layers[k].shapeSettings.opacity :
12210
- this.maps.layers[k].shapeSettings.border.opacity).toString());
12202
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[k].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity, this.maps.layers[k].shapeSettings.border.color, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ? this.maps.layers[k].shapeSettings.opacity : this.maps.layers[k].shapeSettings.border.opacity, this.maps.layers[k].shapeSettings.fill);
12211
12203
  }
12212
12204
  }
12213
12205
  }
@@ -12220,16 +12212,11 @@ class Legend {
12220
12212
  }
12221
12213
  if (targetEle !== null) {
12222
12214
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
12223
- legendShapeId.setAttribute('fill', this.legendCollection[legendIndex]['fill']);
12224
- legendShapeId.setAttribute('fill-opacity', this.legendCollection[legendIndex]['opacity']);
12225
- legendShapeId.setAttribute('stroke', this.legendCollection[legendIndex]['shapeBorder']['color']);
12226
- legendShapeId.setAttribute('stroke-width', this.legendCollection[legendIndex]['shapeBorder']['width']);
12227
- legendShapeId.setAttribute('stroke-opacity', this.legendCollection[legendIndex]['shapeBorder']['opacity']);
12215
+ legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
12216
+ this.setToggleAttributes(legendTextId, legendShapeId, this.legendCollection[legendIndex]['fill'], this.legendCollection[legendIndex]['opacity'], this.legendCollection[legendIndex]['shapeBorder']['color'], this.legendCollection[legendIndex]['shapeBorder']['width'], this.legendCollection[legendIndex]['shapeBorder']['opacity'], '#757575');
12228
12217
  if (this.maps.legendSettings.shape === 'HorizontalLine' || this.maps.legendSettings.shape === 'VerticalLine' || this.maps.legendSettings.shape === 'Cross') {
12229
12218
  legendShapeId.setAttribute('stroke', this.legendCollection[legendIndex]['fill']);
12230
12219
  }
12231
- legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
12232
- legendTextId.setAttribute('fill', '#757575');
12233
12220
  }
12234
12221
  }
12235
12222
  }
@@ -12276,9 +12263,13 @@ class Legend {
12276
12263
  }
12277
12264
  if (targetEle !== null) {
12278
12265
  legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
12279
- legendTextId.setAttribute('fill', '#E5E5E5');
12280
12266
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
12281
- legendShapeId.setAttribute('fill', '#E5E5E5');
12267
+ if (!this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
12268
+ this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
12269
+ }
12270
+ else {
12271
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[j].shapeSettings.fill, this.maps.layers[j].shapeSettings.opacity, this.maps.layers[j].shapeSettings.border.color, isNullOrUndefined(this.maps.layers[j].shapeSettings.border.width) ? 0 : this.maps.layers[j].shapeSettings.border.width, isNullOrUndefined(this.maps.layers[j].shapeSettings.border.opacity) ? this.maps.layers[j].shapeSettings.opacity : this.maps.layers[j].shapeSettings.border.opacity, this.maps.layers[j].shapeSettings.fill);
12272
+ }
12282
12273
  }
12283
12274
  }
12284
12275
  else {
@@ -12297,9 +12288,8 @@ class Legend {
12297
12288
  layerElement.setAttribute('stroke', this.maps.layers[j].shapeSettings.border.color);
12298
12289
  if (targetEle !== null) {
12299
12290
  legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
12300
- legendTextId.setAttribute('fill', '#757575');
12301
12291
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
12302
- legendShapeId.setAttribute('fill', this.legendCollection[legendIndex]['fill']);
12292
+ this.setToggleAttributes(legendTextId, legendShapeId, this.legendCollection[legendIndex]['fill'], this.legendCollection[legendIndex]['opacity'], this.legendCollection[legendIndex]['shapeBorder']['color'], this.legendCollection[legendIndex]['shapeBorder']['width'], this.legendCollection[legendIndex]['shapeBorder']['opacity'], '#757575');
12303
12293
  }
12304
12294
  }
12305
12295
  }
@@ -12353,22 +12343,10 @@ class Legend {
12353
12343
  legendTextId = querySelector(this.maps.element.id + '_Legend_Index_' + legendIndex + '_Text', this.maps.element.id);
12354
12344
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Index_' + legendIndex, this.maps.element.id);
12355
12345
  if (!this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
12356
- legendTextId.setAttribute('fill', legendToggleFill);
12357
- legendShapeId.setAttribute('fill', legendToggleFill);
12358
- legendShapeId.setAttribute('fill-opacity', (legendToggleOpacity).toString());
12359
- legendShapeId.setAttribute('stroke', legendToggleBorderColor);
12360
- legendShapeId.setAttribute('stroke-width', (legendToggleBorderWidth).toString());
12361
- legendShapeId.setAttribute('stroke-opacity', (legendToggleBorderOpacity).toString());
12346
+ this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
12362
12347
  }
12363
12348
  else {
12364
- legendTextId.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
12365
- legendShapeId.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
12366
- legendShapeId.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color);
12367
- legendShapeId.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
12368
- legendShapeId.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
12369
- this.maps.layers[k].shapeSettings.opacity :
12370
- this.maps.layers[k].shapeSettings.border.opacity).toString());
12371
- legendShapeId.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
12349
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[k].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity, this.maps.layers[k].shapeSettings.border.color, (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width), (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ? this.maps.layers[k].shapeSettings.opacity : this.maps.layers[k].shapeSettings.border.opacity), this.maps.layers[k].shapeSettings.fill);
12372
12350
  }
12373
12351
  }
12374
12352
  }
@@ -12434,9 +12412,13 @@ class Legend {
12434
12412
  }
12435
12413
  if (targetEle !== null) {
12436
12414
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Index_' + legendIndex, this.maps.element.id);
12437
- legendShapeId.setAttribute('fill', '#E5E5E5');
12438
12415
  legendTextId = querySelector(this.maps.element.id + '_Legend_Index_' + legendIndex + '_Text', this.maps.element.id);
12439
- legendTextId.setAttribute('fill', '#E5E5E5');
12416
+ if (!this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
12417
+ this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
12418
+ }
12419
+ else {
12420
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[0].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity, this.maps.layers[0].shapeSettings.border.color, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ? this.maps.layers[k].shapeSettings.opacity : this.maps.layers[k].shapeSettings.border.opacity, this.maps.layers[0].shapeSettings.fill);
12421
+ }
12440
12422
  }
12441
12423
  }
12442
12424
  else {
@@ -12456,9 +12438,8 @@ class Legend {
12456
12438
  mapLegendElement.setAttribute('fill', this.legendCollection[legendIndex]['fill']);
12457
12439
  if (targetEle !== null) {
12458
12440
  legendTextId = querySelector(this.maps.element.id + '_Legend_Index_' + legendIndex + '_Text', this.maps.element.id);
12459
- legendTextId.setAttribute('fill', '#757575');
12460
12441
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Index_' + legendIndex, this.maps.element.id);
12461
- legendShapeId.setAttribute('fill', this.legendCollection[legendIndex]['fill']);
12442
+ this.setToggleAttributes(legendTextId, legendShapeId, this.legendCollection[legendIndex]['fill'], this.legendCollection[legendIndex]['opacity'], this.legendCollection[legendIndex]['shapeBorder']['color'], this.legendCollection[legendIndex]['shapeBorder']['width'], this.legendCollection[legendIndex]['shapeBorder']['opacity'], '#757575');
12462
12443
  }
12463
12444
  }
12464
12445
  }
@@ -12535,6 +12516,16 @@ class Legend {
12535
12516
  }
12536
12517
  return legendData;
12537
12518
  }
12519
+ setToggleAttributes(textElement, shapeElement, fillColor, fillOpacity, borderColor, borderWidth, borderOpacity, textColor) {
12520
+ textElement.setAttribute('fill', textColor);
12521
+ shapeElement.setAttribute('fill', fillColor);
12522
+ shapeElement.setAttribute('fill-opacity', (fillOpacity).toString());
12523
+ shapeElement.setAttribute('stroke', borderColor);
12524
+ shapeElement.setAttribute('stroke-width', (borderWidth).toString());
12525
+ if (!isNullOrUndefined(borderOpacity)) {
12526
+ shapeElement.setAttribute('stroke-opacity', (borderOpacity).toString());
12527
+ }
12528
+ }
12538
12529
  legendGradientColor(colorMap, legendIndex) {
12539
12530
  let legendFillColor;
12540
12531
  const xmlns = 'http://www.w3.org/2000/svg';
@@ -13496,23 +13487,26 @@ class MapsTooltip {
13496
13487
  else {
13497
13488
  this.maps.on(Browser.touchMoveEvent, this.renderTooltip, this);
13498
13489
  }
13499
- this.maps.element.addEventListener('contextmenu', this.removeTooltip);
13500
13490
  this.maps.on(Browser.touchCancelEvent, this.removeTooltip, this);
13491
+ this.maps.element.addEventListener('contextmenu', this.removeTooltip);
13501
13492
  }
13502
13493
  removeEventListener() {
13503
- if (this.maps.isDestroyed) {
13504
- return;
13505
- }
13506
- if (this.maps.tooltipDisplayMode === 'DoubleClick') {
13507
- this.maps.off('dblclick', this.removeTooltip);
13508
- }
13509
- else if (this.maps.tooltipDisplayMode === 'Click') {
13510
- this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
13511
- }
13512
- else {
13513
- this.maps.off(Browser.touchMoveEvent, this.renderTooltip);
13494
+ if (this.maps) {
13495
+ if (this.maps.isDestroyed) {
13496
+ return;
13497
+ }
13498
+ if (this.maps.tooltipDisplayMode === 'DoubleClick') {
13499
+ this.maps.off('dblclick', this.removeTooltip);
13500
+ }
13501
+ else if (this.maps.tooltipDisplayMode === 'Click') {
13502
+ this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
13503
+ }
13504
+ else {
13505
+ this.maps.off(Browser.touchMoveEvent, this.renderTooltip);
13506
+ }
13507
+ this.maps.off(Browser.touchCancelEvent, this.removeTooltip);
13508
+ this.maps.element.removeEventListener('contextmenu', this.removeTooltip);
13514
13509
  }
13515
- this.maps.off(Browser.touchCancelEvent, this.removeTooltip);
13516
13510
  }
13517
13511
  /**
13518
13512
  * Get module name.
@@ -13533,7 +13527,6 @@ class MapsTooltip {
13533
13527
  this.svgTooltip.destroy();
13534
13528
  }
13535
13529
  this.svgTooltip = null;
13536
- this.removeEventListener();
13537
13530
  //TODO: Calling the below code throws spec issue.
13538
13531
  //this.maps = null;
13539
13532
  }