@syncfusion/ej2-maps 19.4.55 → 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
  }
@@ -14459,7 +14482,9 @@ class Print {
14459
14482
  * @private
14460
14483
  */
14461
14484
  getHTMLContent(elements) {
14462
- 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");
14463
14488
  if (elements) {
14464
14489
  if (elements instanceof Array) {
14465
14490
  Array.prototype.forEach.call(elements, (value) => {
@@ -14537,18 +14562,21 @@ class ImageExport {
14537
14562
  const isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
14538
14563
  const toolbarEle = document.getElementById(this.control.element.id + '_ToolBar');
14539
14564
  const svgParent = document.getElementById(this.control.element.id + '_Tile_SVG_Parent');
14565
+ const tileParent = document.getElementById(this.control.element.id + '_tile_parent');
14540
14566
  let svgDataElement;
14567
+ let tileSvg;
14568
+ let svgObject = getElementByID(this.control.element.id + '_svg').cloneNode(true);
14541
14569
  if (!this.control.isTileMap) {
14542
14570
  svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
14543
14571
  this.control.svgObject.outerHTML + '</svg>';
14544
14572
  }
14545
14573
  else {
14546
- const tileSvg = document.getElementById(this.control.element.id + '_Tile_SVG');
14574
+ tileSvg = getElementByID(this.control.element.id + '_Tile_SVG').cloneNode(true);
14547
14575
  svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
14548
- this.control.svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
14576
+ svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
14549
14577
  }
14550
14578
  const url = window.URL.createObjectURL(new Blob(type === 'SVG' ? [svgDataElement] :
14551
- [(new XMLSerializer()).serializeToString(this.control.svgObject)], { type: 'image/svg+xml' }));
14579
+ [(new XMLSerializer()).serializeToString(svgObject)], { type: 'image/svg+xml' }));
14552
14580
  if (type === 'SVG') {
14553
14581
  if (allowDownload) {
14554
14582
  triggerDownload(fileName, type, url, isDownload);
@@ -14579,6 +14607,7 @@ class ImageExport {
14579
14607
  image.src = url;
14580
14608
  }
14581
14609
  else {
14610
+ const extraSpace = getClientElement(this.control.element.id);
14582
14611
  const imgxHttp = new XMLHttpRequest();
14583
14612
  const imgTileLength = this.control.mapLayerPanel.tiles.length;
14584
14613
  for (let i = 0; i <= imgTileLength + 1; i++) {
@@ -14588,8 +14617,11 @@ class ImageExport {
14588
14617
  ctxt.fillStyle = this.control.background ? this.control.background : '#FFFFFF';
14589
14618
  ctxt.fillRect(0, 0, this.control.availableSize.width, this.control.availableSize.height);
14590
14619
  ctxt.font = this.control.titleSettings.textStyle.size + ' Arial';
14591
- ctxt.fillStyle = document.getElementById(this.control.element.id + '_Map_title').getAttribute('fill');
14592
- 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
+ }
14593
14625
  exportTileImg.onload = (() => {
14594
14626
  if (i === 0 || i === imgTileLength + 1) {
14595
14627
  if (i === 0) {
@@ -14598,12 +14630,12 @@ class ImageExport {
14598
14630
  ctxt.clip();
14599
14631
  }
14600
14632
  else {
14601
- 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"]));
14602
14634
  }
14603
14635
  }
14604
14636
  else {
14605
- ctxt.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + 10, parseFloat(tile.style.top) +
14606
- (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"]);
14607
14639
  }
14608
14640
  ctxt.drawImage(exportTileImg, 0, 0);
14609
14641
  if (i === imgTileLength + 1) {
@@ -14629,7 +14661,7 @@ class ImageExport {
14629
14661
  }
14630
14662
  else {
14631
14663
  setTimeout(() => {
14632
- 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' }));
14633
14665
  }, 300);
14634
14666
  }
14635
14667
  }
@@ -14705,6 +14737,7 @@ class PdfExport {
14705
14737
  const svgParent = document.getElementById(this.control.element.id + '_Tile_SVG_Parent');
14706
14738
  let svgData;
14707
14739
  const exportElement = this.control.svgObject.cloneNode(true);
14740
+ const tileParent = document.getElementById(this.control.element.id + '_tile_parent');
14708
14741
  const backgroundElement = exportElement.childNodes[0];
14709
14742
  const backgroundColor = backgroundElement.getAttribute('fill');
14710
14743
  if ((this.control.theme === 'Tailwind' || this.control.theme === 'TailwindDark' || this.control.theme === 'Bootstrap5' || this.control.theme === 'Bootstrap5Dark')
@@ -14737,6 +14770,7 @@ class PdfExport {
14737
14770
  image.src = url;
14738
14771
  }
14739
14772
  else {
14773
+ const extraSpace = getClientElement(this.control.element.id);
14740
14774
  const xHttp = new XMLHttpRequest();
14741
14775
  const tileLength = this.control.mapLayerPanel.tiles.length;
14742
14776
  for (let i = 0; i <= tileLength + 1; i++) {
@@ -14746,8 +14780,11 @@ class PdfExport {
14746
14780
  ctx.fillStyle = this.control.background ? this.control.background : '#FFFFFF';
14747
14781
  ctx.fillRect(0, 0, this.control.availableSize.width, this.control.availableSize.height);
14748
14782
  ctx.font = this.control.titleSettings.textStyle.size + ' Arial';
14749
- ctx.fillStyle = document.getElementById(this.control.element.id + '_Map_title').getAttribute('fill');
14750
- 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
+ }
14751
14788
  tileImg.onload = (() => {
14752
14789
  if (i === 0 || i === tileLength + 1) {
14753
14790
  if (i === 0) {
@@ -14756,12 +14793,12 @@ class PdfExport {
14756
14793
  ctx.clip();
14757
14794
  }
14758
14795
  else {
14759
- 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"]));
14760
14797
  }
14761
14798
  }
14762
14799
  else {
14763
- ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + 10, parseFloat(tile.style.top) +
14764
- (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"]));
14765
14802
  }
14766
14803
  ctx.drawImage(tileImg, 0, 0);
14767
14804
  if (i === tileLength + 1) {
@@ -14787,7 +14824,8 @@ class PdfExport {
14787
14824
  }
14788
14825
  else {
14789
14826
  setTimeout(() => {
14790
- 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' }));
14791
14829
  }, 300);
14792
14830
  }
14793
14831
  }
@@ -14831,5 +14869,5 @@ class PdfExport {
14831
14869
  * exporting all modules from maps index
14832
14870
  */
14833
14871
 
14834
- 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 };
14835
14873
  //# sourceMappingURL=ej2-maps.es2015.js.map