@syncfusion/ej2-maps 19.4.52 → 19.4.56

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.
@@ -1240,8 +1240,10 @@ function maintainSelection(elementId, elementClass, element, className) {
1240
1240
  if (elementId) {
1241
1241
  for (let index = 0; index < elementId.length; index++) {
1242
1242
  if (element.getAttribute('id') === elementId[index]) {
1243
- if (isNullOrUndefined(getElement(elementClass.id)) || index === 0) {
1244
- document.body.appendChild(elementClass);
1243
+ if (index === 0 || element.tagName === 'g') {
1244
+ if (!isNullOrUndefined(elementClass) && !isNullOrUndefined(elementClass.id)) {
1245
+ document.body.appendChild(elementClass);
1246
+ }
1245
1247
  if (element.id.indexOf('_MarkerIndex_') > -1 && element.childElementCount > 0) {
1246
1248
  element.children[0].setAttribute('class', className);
1247
1249
  }
@@ -2198,6 +2200,22 @@ function fixInitialScaleForTile(map) {
2198
2200
  function getElementByID(id) {
2199
2201
  return document.getElementById(id);
2200
2202
  }
2203
+ /**
2204
+ * Function to get clientElement from id.
2205
+ *
2206
+ * @param {string} id - Specifies the id
2207
+ * @returns {Element} - Returns the element
2208
+ * @private
2209
+ */
2210
+ function getClientElement(id) {
2211
+ const element = document.getElementById(id);
2212
+ if (!isNullOrUndefined(element)) {
2213
+ return element.getClientRects()[0];
2214
+ }
2215
+ else {
2216
+ return null;
2217
+ }
2218
+ }
2201
2219
  /**
2202
2220
  * To apply internalization
2203
2221
  *
@@ -7209,12 +7227,14 @@ let Maps = class Maps extends Component {
7209
7227
  this.checkInitialRender = false;
7210
7228
  }
7211
7229
  }
7212
- for (let k = 0; k < this.layers[i].markerSettings.length; k++) {
7213
- if (this.layers[i].markerSettings[k].selectionSettings && this.layers[i].markerSettings[k].selectionSettings.enable
7214
- && this.layers[i].markerSettings[k].initialMarkerSelection.length > 0) {
7215
- const markerSelectionValues = this.layers[i].markerSettings[k].initialMarkerSelection;
7216
- for (let j = 0; j < markerSelectionValues.length; j++) {
7217
- this.markerInitialSelection(i, k, this.layers[i].markerSettings[k], markerSelectionValues[j].latitude, markerSelectionValues[j].longitude);
7230
+ if (!this.isResize) {
7231
+ for (let k = 0; k < this.layers[i].markerSettings.length; k++) {
7232
+ if (this.layers[i].markerSettings[k].selectionSettings && this.layers[i].markerSettings[k].selectionSettings.enable
7233
+ && this.layers[i].markerSettings[k].initialMarkerSelection.length > 0) {
7234
+ const markerSelectionValues = this.layers[i].markerSettings[k].initialMarkerSelection;
7235
+ for (let j = 0; j < markerSelectionValues.length; j++) {
7236
+ this.markerInitialSelection(i, k, this.layers[i].markerSettings[k], markerSelectionValues[j].latitude, markerSelectionValues[j].longitude);
7237
+ }
7218
7238
  }
7219
7239
  }
7220
7240
  }
@@ -7292,7 +7312,8 @@ let Maps = class Maps extends Component {
7292
7312
  markerSelection(selectionSettings, map, targetElement, data) {
7293
7313
  const border = {
7294
7314
  color: selectionSettings.border.color,
7295
- width: selectionSettings.border.width / map.scale
7315
+ width: selectionSettings.border.width / map.scale,
7316
+ opacity: selectionSettings.border.opacity
7296
7317
  };
7297
7318
  const markerSelectionProperties = {
7298
7319
  opacity: selectionSettings.opacity,
@@ -7312,9 +7333,11 @@ let Maps = class Maps extends Component {
7312
7333
  if (this.selectedMarkerElementId.length === 0 || selectionSettings.enableMultiSelect) {
7313
7334
  if (targetElement.tagName === 'g') {
7314
7335
  targetElement.children[0].setAttribute('class', 'MarkerselectionMapStyle');
7336
+ this.selectedMarkerElementId.push(targetElement.children[0].id);
7315
7337
  }
7316
7338
  else {
7317
7339
  targetElement.setAttribute('class', 'MarkerselectionMapStyle');
7340
+ this.selectedMarkerElementId.push(targetElement.id);
7318
7341
  }
7319
7342
  }
7320
7343
  }
@@ -7823,30 +7846,29 @@ let Maps = class Maps extends Component {
7823
7846
  }
7824
7847
  }
7825
7848
  if (this.markerModule) {
7826
- this.markerModule.markerClick(e);
7827
7849
  this.markerModule.markerClusterClick(e);
7828
7850
  }
7829
- if (this.bubbleModule) {
7830
- this.bubbleModule.bubbleClick(e);
7831
- }
7832
7851
  if (!eventArgs.cancel) {
7833
7852
  this.notify(click, targetEle);
7834
7853
  }
7835
7854
  if (!eventArgs.cancel && targetEle.id.indexOf('shapeIndex') !== -1) {
7836
- const layerIndex = parseInt(targetEle.id.split('_LayerIndex_')[1].split('_')[0], 10);
7837
- const shapeSelectedEventArgs = triggerShapeEvent(targetId, this.layers[layerIndex].selectionSettings, this, shapeSelected);
7838
- if (!shapeSelectedEventArgs.cancel && this.selectionModule && !isNullOrUndefined(this.shapeSelected)) {
7839
- customizeStyle(this.selectionModule.selectionType + 'selectionMap', this.selectionModule.selectionType + 'selectionMapStyle', shapeSelectedEventArgs);
7840
- }
7841
- else if (shapeSelectedEventArgs.cancel && this.selectionModule
7842
- && isNullOrUndefined(shapeSelectedEventArgs['data'])) {
7843
- removeClass(targetEle);
7844
- this.selectionModule.removedSelectionList(targetEle);
7845
- }
7855
+ this.triggerShapeSelection(targetEle);
7846
7856
  }
7847
7857
  });
7848
7858
  }
7849
7859
  }
7860
+ triggerShapeSelection(targetEle) {
7861
+ const layerIndex = parseInt(targetEle.id.split('_LayerIndex_')[1].split('_')[0], 10);
7862
+ const shapeSelectedEventArgs = triggerShapeEvent(targetEle.id, this.layers[layerIndex].selectionSettings, this, shapeSelected);
7863
+ if (!shapeSelectedEventArgs.cancel && this.selectionModule && !isNullOrUndefined(this.shapeSelected)) {
7864
+ customizeStyle(this.selectionModule.selectionType + 'selectionMap', this.selectionModule.selectionType + 'selectionMapStyle', shapeSelectedEventArgs);
7865
+ }
7866
+ else if (shapeSelectedEventArgs.cancel && this.selectionModule
7867
+ && isNullOrUndefined(shapeSelectedEventArgs['data'])) {
7868
+ removeClass(targetEle);
7869
+ this.selectionModule.removedSelectionList(targetEle);
7870
+ }
7871
+ }
7850
7872
  getClickLocation(targetId, pageX, pageY, targetElement, x, y) {
7851
7873
  let layerIndex = 0;
7852
7874
  let latLongValue;
@@ -7968,6 +7990,9 @@ let Maps = class Maps extends Component {
7968
7990
  const markerModule = this.markerModule;
7969
7991
  if (element.id.indexOf('shapeIndex') > -1 || element.id.indexOf('Tile') > -1) {
7970
7992
  this.mergeCluster();
7993
+ if (element.id.indexOf('shapeIndex') > -1) {
7994
+ this.triggerShapeSelection(element);
7995
+ }
7971
7996
  }
7972
7997
  if (markerModule) {
7973
7998
  markerModule.markerClick(e);
@@ -14457,7 +14482,9 @@ class Print {
14457
14482
  * @private
14458
14483
  */
14459
14484
  getHTMLContent(elements) {
14460
- const div = createElement('div');
14485
+ const elementRect = getClientElement(this.control.element.id);
14486
+ let div = createElement('div');
14487
+ div.setAttribute("style", "margin-top:" + elementRect["top"] + "px");
14461
14488
  if (elements) {
14462
14489
  if (elements instanceof Array) {
14463
14490
  Array.prototype.forEach.call(elements, (value) => {
@@ -14535,18 +14562,21 @@ class ImageExport {
14535
14562
  const isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
14536
14563
  const toolbarEle = document.getElementById(this.control.element.id + '_ToolBar');
14537
14564
  const svgParent = document.getElementById(this.control.element.id + '_Tile_SVG_Parent');
14565
+ const tileParent = document.getElementById(this.control.element.id + '_tile_parent');
14538
14566
  let svgDataElement;
14567
+ let tileSvg;
14568
+ let svgObject = getElementByID(this.control.element.id + '_svg').cloneNode(true);
14539
14569
  if (!this.control.isTileMap) {
14540
14570
  svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
14541
14571
  this.control.svgObject.outerHTML + '</svg>';
14542
14572
  }
14543
14573
  else {
14544
- const tileSvg = document.getElementById(this.control.element.id + '_Tile_SVG');
14574
+ tileSvg = getElementByID(this.control.element.id + '_Tile_SVG').cloneNode(true);
14545
14575
  svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
14546
- this.control.svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
14576
+ svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
14547
14577
  }
14548
14578
  const url = window.URL.createObjectURL(new Blob(type === 'SVG' ? [svgDataElement] :
14549
- [(new XMLSerializer()).serializeToString(this.control.svgObject)], { type: 'image/svg+xml' }));
14579
+ [(new XMLSerializer()).serializeToString(svgObject)], { type: 'image/svg+xml' }));
14550
14580
  if (type === 'SVG') {
14551
14581
  if (allowDownload) {
14552
14582
  triggerDownload(fileName, type, url, isDownload);
@@ -14577,6 +14607,7 @@ class ImageExport {
14577
14607
  image.src = url;
14578
14608
  }
14579
14609
  else {
14610
+ const extraSpace = getClientElement(this.control.element.id);
14580
14611
  const imgxHttp = new XMLHttpRequest();
14581
14612
  const imgTileLength = this.control.mapLayerPanel.tiles.length;
14582
14613
  for (let i = 0; i <= imgTileLength + 1; i++) {
@@ -14586,8 +14617,11 @@ class ImageExport {
14586
14617
  ctxt.fillStyle = this.control.background ? this.control.background : '#FFFFFF';
14587
14618
  ctxt.fillRect(0, 0, this.control.availableSize.width, this.control.availableSize.height);
14588
14619
  ctxt.font = this.control.titleSettings.textStyle.size + ' Arial';
14589
- ctxt.fillStyle = document.getElementById(this.control.element.id + '_Map_title').getAttribute('fill');
14590
- ctxt.fillText(this.control.titleSettings.text, parseFloat(document.getElementById(this.control.element.id + '_Map_title').getAttribute('x')), parseFloat(document.getElementById(this.control.element.id + '_Map_title').getAttribute('y')));
14620
+ let titleElement = document.getElementById(this.control.element.id + '_Map_title');
14621
+ if (!isNullOrUndefined(titleElement)) {
14622
+ ctxt.fillStyle = titleElement.getAttribute('fill');
14623
+ ctxt.fillText(this.control.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
14624
+ }
14591
14625
  exportTileImg.onload = (() => {
14592
14626
  if (i === 0 || i === imgTileLength + 1) {
14593
14627
  if (i === 0) {
@@ -14596,12 +14630,12 @@ class ImageExport {
14596
14630
  ctxt.clip();
14597
14631
  }
14598
14632
  else {
14599
- ctxt.setTransform(1, 0, 0, 1, parseFloat(svgParent.style.left), parseFloat(svgParent.style.top));
14633
+ ctxt.setTransform(1, 0, 0, 1, parseFloat(svgParent.style.left), (parseFloat(tileParent.style.top) - extraSpace["top"]));
14600
14634
  }
14601
14635
  }
14602
14636
  else {
14603
- ctxt.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + 10, parseFloat(tile.style.top) +
14604
- (parseFloat(document.getElementById(this.control.element.id + '_tile_parent').style.top)));
14637
+ ctxt.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + this.control.margin.left, parseFloat(tile.style.top) +
14638
+ (parseFloat(tileParent.style.top)) - extraSpace["top"]);
14605
14639
  }
14606
14640
  ctxt.drawImage(exportTileImg, 0, 0);
14607
14641
  if (i === imgTileLength + 1) {
@@ -14627,7 +14661,7 @@ class ImageExport {
14627
14661
  }
14628
14662
  else {
14629
14663
  setTimeout(() => {
14630
- exportTileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(document.getElementById(this.control.element.id + '_Tile_SVG'))], { type: 'image/svg+xml' }));
14664
+ exportTileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(tileSvg)], { type: 'image/svg+xml' }));
14631
14665
  }, 300);
14632
14666
  }
14633
14667
  }
@@ -14703,6 +14737,7 @@ class PdfExport {
14703
14737
  const svgParent = document.getElementById(this.control.element.id + '_Tile_SVG_Parent');
14704
14738
  let svgData;
14705
14739
  const exportElement = this.control.svgObject.cloneNode(true);
14740
+ const tileParent = document.getElementById(this.control.element.id + '_tile_parent');
14706
14741
  const backgroundElement = exportElement.childNodes[0];
14707
14742
  const backgroundColor = backgroundElement.getAttribute('fill');
14708
14743
  if ((this.control.theme === 'Tailwind' || this.control.theme === 'TailwindDark' || this.control.theme === 'Bootstrap5' || this.control.theme === 'Bootstrap5Dark')
@@ -14735,6 +14770,7 @@ class PdfExport {
14735
14770
  image.src = url;
14736
14771
  }
14737
14772
  else {
14773
+ const extraSpace = getClientElement(this.control.element.id);
14738
14774
  const xHttp = new XMLHttpRequest();
14739
14775
  const tileLength = this.control.mapLayerPanel.tiles.length;
14740
14776
  for (let i = 0; i <= tileLength + 1; i++) {
@@ -14744,8 +14780,11 @@ class PdfExport {
14744
14780
  ctx.fillStyle = this.control.background ? this.control.background : '#FFFFFF';
14745
14781
  ctx.fillRect(0, 0, this.control.availableSize.width, this.control.availableSize.height);
14746
14782
  ctx.font = this.control.titleSettings.textStyle.size + ' Arial';
14747
- ctx.fillStyle = document.getElementById(this.control.element.id + '_Map_title').getAttribute('fill');
14748
- ctx.fillText(this.control.titleSettings.text, parseFloat(document.getElementById(this.control.element.id + '_Map_title').getAttribute('x')), parseFloat(document.getElementById(this.control.element.id + '_Map_title').getAttribute('y')));
14783
+ let titleElement = document.getElementById(this.control.element.id + '_Map_title');
14784
+ if (!isNullOrUndefined(titleElement)) {
14785
+ ctx.fillStyle = titleElement.getAttribute('fill');
14786
+ ctx.fillText(this.control.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
14787
+ }
14749
14788
  tileImg.onload = (() => {
14750
14789
  if (i === 0 || i === tileLength + 1) {
14751
14790
  if (i === 0) {
@@ -14754,12 +14793,12 @@ class PdfExport {
14754
14793
  ctx.clip();
14755
14794
  }
14756
14795
  else {
14757
- ctx.setTransform(1, 0, 0, 1, parseFloat(svgParent.style.left), parseFloat(svgParent.style.top));
14796
+ ctx.setTransform(1, 0, 0, 1, parseFloat(svgParent.style.left), (parseFloat(tileParent.style.top) - extraSpace["top"]));
14758
14797
  }
14759
14798
  }
14760
14799
  else {
14761
- ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + 10, parseFloat(tile.style.top) +
14762
- (parseFloat(document.getElementById(this.control.element.id + '_tile_parent').style.top)));
14800
+ ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + this.control.margin.left, (parseFloat(tile.style.top) +
14801
+ (parseFloat(tileParent.style.top)) - extraSpace["top"]));
14763
14802
  }
14764
14803
  ctx.drawImage(tileImg, 0, 0);
14765
14804
  if (i === tileLength + 1) {
@@ -14785,7 +14824,8 @@ class PdfExport {
14785
14824
  }
14786
14825
  else {
14787
14826
  setTimeout(() => {
14788
- tileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(document.getElementById(this.control.element.id + '_Tile_SVG'))], { type: 'image/svg+xml' }));
14827
+ let tileSvg = document.getElementById(this.control.element.id + '_Tile_SVG');
14828
+ tileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(tileSvg)], { type: 'image/svg+xml' }));
14789
14829
  }, 300);
14790
14830
  }
14791
14831
  }
@@ -14829,5 +14869,5 @@ class PdfExport {
14829
14869
  * exporting all modules from maps index
14830
14870
  */
14831
14871
 
14832
- export { Maps, load, loaded, click, rightClick, doubleClick, resize, tooltipRender, shapeSelected, shapeHighlight, mousemove, mouseup, mousedown, layerRendering, shapeRendering, markerRendering, markerClusterRendering, markerClick, markerClusterClick, markerMouseMove, markerClusterMouseMove, dataLabelRendering, bubbleRendering, bubbleClick, bubbleMouseMove, animationComplete, legendRendering, annotationRendering, itemSelection, itemHighlight, beforePrint, zoomIn, zoomOut, pan, Annotation, Arrow, Font, Border, CenterPosition, TooltipSettings, Margin, ConnectorLineSettings, MarkerClusterSettings, MarkerClusterData, ColorMappingSettings, InitialMarkerSelectionSettings, InitialShapeSelectionSettings, SelectionSettings, HighlightSettings, NavigationLineSettings, BubbleSettings, CommonTitleSettings, SubTitleSettings, TitleSettings, ZoomSettings, ToggleLegendSettings, LegendSettings, DataLabelSettings, ShapeSettings, MarkerBase, MarkerSettings, LayerSettings, Tile, MapsAreaSettings, Size, stringToNumber, calculateSize, createSvg, getMousePosition, degreesToRadians, radiansToDegrees, convertGeoToPoint, convertTileLatLongToPoint, xToCoordinate, yToCoordinate, aitoff, roundTo, sinci, acos, calculateBound, triggerDownload, Point, MinMax, GeoLocation, measureText, TextOption, PathOption, ColorValue, RectOption, CircleOption, PolygonOption, PolylineOption, LineOption, Line, MapLocation, Rect, PatternOptions, renderTextElement, convertElement, formatValue, convertStringToValue, convertElementFromLabel, drawSymbols, getValueFromObject, markerColorChoose, markerShapeChoose, clusterTemplate, mergeSeparateCluster, clusterSeparate, marker, markerTemplate, maintainSelection, maintainStyleClass, appendShape, drawCircle, drawRectangle, drawPath, drawPolygon, drawPolyline, drawLine, calculateShapes, drawDiamond, drawTriangle, drawCross, drawHorizontalLine, drawVerticalLine, drawStar, drawBalloon, drawPattern, getFieldData, checkShapeDataFields, checkPropertyPath, filter, getRatioOfBubble, findMidPointOfPolygon, isCustomPath, textTrim, findPosition, removeElement, calculateCenterFromPixel, getTranslate, getZoomTranslate, fixInitialScaleForTile, getElementByID, Internalize, getTemplateFunction, getElement, getShapeData, triggerShapeEvent, getElementsByClassName, querySelector, getTargetElement, createStyle, customizeStyle, triggerItemSelectionEvent, removeClass, elementAnimate, timeout, showTooltip, wordWrap, createTooltip, drawSymbol, renderLegendShape, getElementOffset, changeBorderWidth, changeNavaigationLineWidth, targetTouches, calculateScale, getDistance, getTouches, getTouchCenter, sum, zoomAnimate, animate, MapAjax, smoothTranslate, compareZoomFactor, calculateZoomLevel, processResult, LayerPanel, Bubble, BingMap, Marker, ColorMapping, DataLabel, NavigationLine, Legend, Highlight, Selection, MapsTooltip, Zoom, Annotations, Print, ImageExport, PdfExport };
14872
+ export { Maps, load, loaded, click, rightClick, doubleClick, resize, tooltipRender, shapeSelected, shapeHighlight, mousemove, mouseup, mousedown, layerRendering, shapeRendering, markerRendering, markerClusterRendering, markerClick, markerClusterClick, markerMouseMove, markerClusterMouseMove, dataLabelRendering, bubbleRendering, bubbleClick, bubbleMouseMove, animationComplete, legendRendering, annotationRendering, itemSelection, itemHighlight, beforePrint, zoomIn, zoomOut, pan, Annotation, Arrow, Font, Border, CenterPosition, TooltipSettings, Margin, ConnectorLineSettings, MarkerClusterSettings, MarkerClusterData, ColorMappingSettings, InitialMarkerSelectionSettings, InitialShapeSelectionSettings, SelectionSettings, HighlightSettings, NavigationLineSettings, BubbleSettings, CommonTitleSettings, SubTitleSettings, TitleSettings, ZoomSettings, ToggleLegendSettings, LegendSettings, DataLabelSettings, ShapeSettings, MarkerBase, MarkerSettings, LayerSettings, Tile, MapsAreaSettings, Size, stringToNumber, calculateSize, createSvg, getMousePosition, degreesToRadians, radiansToDegrees, convertGeoToPoint, convertTileLatLongToPoint, xToCoordinate, yToCoordinate, aitoff, roundTo, sinci, acos, calculateBound, triggerDownload, Point, MinMax, GeoLocation, measureText, TextOption, PathOption, ColorValue, RectOption, CircleOption, PolygonOption, PolylineOption, LineOption, Line, MapLocation, Rect, PatternOptions, renderTextElement, convertElement, formatValue, convertStringToValue, convertElementFromLabel, drawSymbols, getValueFromObject, markerColorChoose, markerShapeChoose, clusterTemplate, mergeSeparateCluster, clusterSeparate, marker, markerTemplate, maintainSelection, maintainStyleClass, appendShape, drawCircle, drawRectangle, drawPath, drawPolygon, drawPolyline, drawLine, calculateShapes, drawDiamond, drawTriangle, drawCross, drawHorizontalLine, drawVerticalLine, drawStar, drawBalloon, drawPattern, getFieldData, checkShapeDataFields, checkPropertyPath, filter, getRatioOfBubble, findMidPointOfPolygon, isCustomPath, textTrim, findPosition, removeElement, calculateCenterFromPixel, getTranslate, getZoomTranslate, fixInitialScaleForTile, getElementByID, getClientElement, Internalize, getTemplateFunction, getElement, getShapeData, triggerShapeEvent, getElementsByClassName, querySelector, getTargetElement, createStyle, customizeStyle, triggerItemSelectionEvent, removeClass, elementAnimate, timeout, showTooltip, wordWrap, createTooltip, drawSymbol, renderLegendShape, getElementOffset, changeBorderWidth, changeNavaigationLineWidth, targetTouches, calculateScale, getDistance, getTouches, getTouchCenter, sum, zoomAnimate, animate, MapAjax, smoothTranslate, compareZoomFactor, calculateZoomLevel, processResult, LayerPanel, Bubble, BingMap, Marker, ColorMapping, DataLabel, NavigationLine, Legend, Highlight, Selection, MapsTooltip, Zoom, Annotations, Print, ImageExport, PdfExport };
14833
14873
  //# sourceMappingURL=ej2-maps.es2015.js.map