@syncfusion/ej2-maps 20.2.43 → 20.3.47
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/CHANGELOG.md +19 -2
- package/dist/ej2-maps.min.js +10 -0
- 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 +317 -258
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +321 -263
- 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 +13 -13
- package/src/maps/layers/bing-map.d.ts +4 -0
- package/src/maps/layers/bing-map.js +7 -0
- package/src/maps/layers/bubble.d.ts +1 -2
- package/src/maps/layers/bubble.js +4 -5
- package/src/maps/layers/data-label.d.ts +1 -4
- package/src/maps/layers/data-label.js +13 -15
- package/src/maps/layers/layer-panel.d.ts +5 -0
- package/src/maps/layers/layer-panel.js +28 -5
- package/src/maps/layers/legend.d.ts +1 -2
- package/src/maps/layers/legend.js +26 -5
- package/src/maps/layers/marker.d.ts +2 -4
- package/src/maps/layers/marker.js +44 -44
- package/src/maps/layers/navigation-selected-line.d.ts +1 -2
- package/src/maps/layers/navigation-selected-line.js +7 -13
- package/src/maps/maps.js +18 -9
- package/src/maps/model/export-image.d.ts +2 -4
- package/src/maps/model/export-image.js +19 -27
- package/src/maps/model/export-pdf.d.ts +4 -6
- package/src/maps/model/export-pdf.js +22 -30
- package/src/maps/model/interface.d.ts +8 -0
- package/src/maps/model/print.d.ts +2 -5
- package/src/maps/model/print.js +15 -23
- package/src/maps/user-interaction/annotation.d.ts +1 -2
- package/src/maps/user-interaction/annotation.js +2 -3
- package/src/maps/user-interaction/highlight.d.ts +1 -2
- package/src/maps/user-interaction/highlight.js +3 -5
- package/src/maps/user-interaction/selection.d.ts +1 -2
- package/src/maps/user-interaction/selection.js +3 -5
- package/src/maps/user-interaction/tooltip.d.ts +1 -4
- package/src/maps/user-interaction/tooltip.js +7 -2
- package/src/maps/user-interaction/zoom.d.ts +2 -7
- package/src/maps/user-interaction/zoom.js +83 -66
- package/src/maps/utils/helper.js +22 -11
|
@@ -29,9 +29,6 @@ var NavigationLine = /** @class */ (function () {
|
|
|
29
29
|
var dashArray;
|
|
30
30
|
var pathOption;
|
|
31
31
|
var direction;
|
|
32
|
-
var markerWidth;
|
|
33
|
-
var arcId;
|
|
34
|
-
var radius;
|
|
35
32
|
var showArrow;
|
|
36
33
|
var arrowColor;
|
|
37
34
|
var arrowSize;
|
|
@@ -69,8 +66,8 @@ var NavigationLine = /** @class */ (function () {
|
|
|
69
66
|
for (var j = 0; j < point['length'] - 1; j++) {
|
|
70
67
|
angle = (-1 > angle) ? -1 : angle;
|
|
71
68
|
angle = (1 < angle) ? 1 : angle;
|
|
72
|
-
var
|
|
73
|
-
var
|
|
69
|
+
var arcId = this.maps.element.id + '_LayerIndex_' + layerIndex + '_NavigationIndex_' + i + '_Line' + j + '';
|
|
70
|
+
var radius = this.convertRadius(point[j], point[j + 1]);
|
|
74
71
|
if (angle <= 1 && angle > 0) {
|
|
75
72
|
direction = 0;
|
|
76
73
|
if (point[j]['x'] > point[j + 1]['x']) {
|
|
@@ -115,10 +112,10 @@ var NavigationLine = /** @class */ (function () {
|
|
|
115
112
|
angle = Math.abs(angle);
|
|
116
113
|
d = (angle === 0) ? 'M ' + point[j]['x'] + ',' + point[j]['y'] + 'L ' + point[j + 1]['x']
|
|
117
114
|
+ ',' + point[j + 1]['y'] + ' ' :
|
|
118
|
-
'M ' + point[j]['x'] + ',' + point[j]['y'] + ' A ' + (
|
|
119
|
-
' ' + (
|
|
115
|
+
'M ' + point[j]['x'] + ',' + point[j]['y'] + ' A ' + (radius / 2 + (1 - angle) * radius / (angle * 10)) +
|
|
116
|
+
' ' + (radius / 2 + (1 - angle) * radius / (angle * 10)) + ' ' + 0 + ',' + 0 + ','
|
|
120
117
|
+ direction + ' , ' + point[j + 1]['x'] + ',' + point[j + 1]['y'] + ' ';
|
|
121
|
-
pathOption = new PathOption(
|
|
118
|
+
pathOption = new PathOption(arcId, 'none', width, color, 1, 1, dashArray, d);
|
|
122
119
|
navigationEle = this.maps.renderer.drawPath(pathOption);
|
|
123
120
|
if (!isNullOrUndefined(arrowPosition)) {
|
|
124
121
|
var position = (arrowPosition === 'Start') ? navigationEle.setAttribute('marker-start', startArrow)
|
|
@@ -151,14 +148,11 @@ var NavigationLine = /** @class */ (function () {
|
|
|
151
148
|
/**
|
|
152
149
|
* To destroy the layers.
|
|
153
150
|
*
|
|
154
|
-
* @param {Maps} maps - Specifies the instance of the map
|
|
155
151
|
* @returns {void}
|
|
156
152
|
* @private
|
|
157
153
|
*/
|
|
158
|
-
NavigationLine.prototype.destroy = function (
|
|
159
|
-
|
|
160
|
-
* Destroy method performed here
|
|
161
|
-
*/
|
|
154
|
+
NavigationLine.prototype.destroy = function () {
|
|
155
|
+
this.maps = null;
|
|
162
156
|
};
|
|
163
157
|
return NavigationLine;
|
|
164
158
|
}());
|
package/src/maps/maps.js
CHANGED
|
@@ -390,7 +390,9 @@ var Maps = /** @class */ (function (_super) {
|
|
|
390
390
|
this.dataLabelShape = [];
|
|
391
391
|
}
|
|
392
392
|
this.mapLayerPanel.measureLayerPanel();
|
|
393
|
-
|
|
393
|
+
if (!isNullOrUndefined(this.svgObject)) {
|
|
394
|
+
this.element.appendChild(this.svgObject);
|
|
395
|
+
}
|
|
394
396
|
var position = this.getExtraPosition();
|
|
395
397
|
for (var i = 0; i < this.layers.length; i++) {
|
|
396
398
|
if (position.x !== 0 || position.y !== 0) {
|
|
@@ -579,6 +581,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
579
581
|
*/
|
|
580
582
|
Maps.prototype.addTabIndex = function () {
|
|
581
583
|
this.element.setAttribute('aria-label', this.description || 'Maps Element');
|
|
584
|
+
this.element.setAttribute('role', '');
|
|
582
585
|
this.element.setAttribute('tabindex', this.tabIndex.toString());
|
|
583
586
|
};
|
|
584
587
|
// private setSecondaryElementPosition(): void {
|
|
@@ -643,7 +646,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
643
646
|
}
|
|
644
647
|
}
|
|
645
648
|
if (this.zoomModule && (this.previousScale !== this.scale)) {
|
|
646
|
-
this.zoomModule.applyTransform(true);
|
|
649
|
+
this.zoomModule.applyTransform(this, true);
|
|
647
650
|
}
|
|
648
651
|
}
|
|
649
652
|
};
|
|
@@ -821,6 +824,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
821
824
|
var titleBounds = new Rect(location_1.x, location_1.y, elementSize.width, elementSize.height);
|
|
822
825
|
var element = renderTextElement(options, style, style.color || (type === 'title' ? this.themeStyle.titleFontColor : this.themeStyle.subTitleFontColor), groupEle);
|
|
823
826
|
element.setAttribute('aria-label', this.description || title.text);
|
|
827
|
+
element.setAttribute('role', '');
|
|
824
828
|
if ((type === 'title' && !title.subtitleSettings.text) || (type === 'subtitle')) {
|
|
825
829
|
height = Math.abs((titleBounds.y + this.margin.bottom) - this.availableSize.height);
|
|
826
830
|
this.mapAreaRect = new Rect(this.margin.left, titleBounds.y + 10, width, height - 10);
|
|
@@ -1410,7 +1414,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1410
1414
|
this.scale = zoomFactor;
|
|
1411
1415
|
this.translatePoint.x = ((mapRect.left < svgRect.left ? x : 0) + (size.width / 2) - (position.x * zoomFactor)) / zoomFactor;
|
|
1412
1416
|
this.translatePoint.y = ((mapRect.top < svgRect.top ? y : 0) + (size.height / 2) - (position.y * zoomFactor)) / zoomFactor;
|
|
1413
|
-
this.zoomModule.applyTransform();
|
|
1417
|
+
this.zoomModule.applyTransform(this);
|
|
1414
1418
|
}
|
|
1415
1419
|
else {
|
|
1416
1420
|
position = { x: size.width / 2, y: size.height / 2 };
|
|
@@ -1489,7 +1493,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1489
1493
|
this.layersCollection[layerIndex].markerSettings.push(new MarkerSettings(this, 'markerSettings', newMarker));
|
|
1490
1494
|
}
|
|
1491
1495
|
var markerModule = new Marker(this);
|
|
1492
|
-
markerModule.markerRender(layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
|
|
1496
|
+
markerModule.markerRender(this, layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
|
|
1493
1497
|
this.arrangeTemplate();
|
|
1494
1498
|
}
|
|
1495
1499
|
};
|
|
@@ -1696,7 +1700,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1696
1700
|
Zoom: 'Zoom',
|
|
1697
1701
|
ZoomOut: 'Zoom out',
|
|
1698
1702
|
Pan: 'Pan',
|
|
1699
|
-
Reset: 'Reset'
|
|
1703
|
+
Reset: 'Reset',
|
|
1704
|
+
ImageNotFound: 'Image Not Found'
|
|
1700
1705
|
};
|
|
1701
1706
|
};
|
|
1702
1707
|
/**
|
|
@@ -1704,6 +1709,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1704
1709
|
*/
|
|
1705
1710
|
Maps.prototype.destroy = function () {
|
|
1706
1711
|
this.unWireEVents();
|
|
1712
|
+
_super.prototype.destroy.call(this);
|
|
1707
1713
|
this.shapeSelectionItem = [];
|
|
1708
1714
|
this.toggledShapeElementId = [];
|
|
1709
1715
|
this.toggledLegendId = [];
|
|
@@ -1718,11 +1724,14 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1718
1724
|
this.zoomLabelPositions = [];
|
|
1719
1725
|
this.mouseDownEvent = { x: null, y: null };
|
|
1720
1726
|
this.mouseClickEvent = { x: null, y: null };
|
|
1727
|
+
this.formatFunction = null;
|
|
1728
|
+
//TODO: Calling the below code throws spec issue.
|
|
1729
|
+
//this.renderer = null;
|
|
1730
|
+
this.availableSize = new Size(0, 0);
|
|
1721
1731
|
if (document.getElementById('mapsmeasuretext')) {
|
|
1722
1732
|
document.getElementById('mapsmeasuretext').remove();
|
|
1723
1733
|
}
|
|
1724
1734
|
this.removeSvg();
|
|
1725
|
-
_super.prototype.destroy.call(this);
|
|
1726
1735
|
};
|
|
1727
1736
|
/**
|
|
1728
1737
|
* Gets component name
|
|
@@ -2038,7 +2047,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2038
2047
|
*/
|
|
2039
2048
|
Maps.prototype.print = function (id) {
|
|
2040
2049
|
if ((this.allowPrint) && (this.printModule)) {
|
|
2041
|
-
this.printModule.print(id);
|
|
2050
|
+
this.printModule.print(this, id);
|
|
2042
2051
|
}
|
|
2043
2052
|
};
|
|
2044
2053
|
/**
|
|
@@ -2057,12 +2066,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2057
2066
|
}
|
|
2058
2067
|
if ((type !== 'PDF') && (this.allowImageExport) && (this.imageExportModule)) {
|
|
2059
2068
|
return new Promise(function (resolve, reject) {
|
|
2060
|
-
resolve(_this.imageExportModule.export(type, fileName, allowDownload));
|
|
2069
|
+
resolve(_this.imageExportModule.export(_this, type, fileName, allowDownload));
|
|
2061
2070
|
});
|
|
2062
2071
|
}
|
|
2063
2072
|
else if ((this.allowPdfExport) && (this.pdfExportModule)) {
|
|
2064
2073
|
return new Promise(function (resolve, reject) {
|
|
2065
|
-
resolve(_this.pdfExportModule.export(type, fileName, allowDownload, orientation));
|
|
2074
|
+
resolve(_this.pdfExportModule.export(_this, type, fileName, allowDownload, orientation));
|
|
2066
2075
|
});
|
|
2067
2076
|
}
|
|
2068
2077
|
return null;
|
|
@@ -6,7 +6,6 @@ import { ExportType } from '../utils/enum';
|
|
|
6
6
|
* @hidden
|
|
7
7
|
*/
|
|
8
8
|
export declare class ImageExport {
|
|
9
|
-
private control;
|
|
10
9
|
/**
|
|
11
10
|
* Constructor for Maps
|
|
12
11
|
*
|
|
@@ -22,7 +21,7 @@ export declare class ImageExport {
|
|
|
22
21
|
* @returns {Promise<string>} - Returns the promise string.
|
|
23
22
|
* @private
|
|
24
23
|
*/
|
|
25
|
-
export(type: ExportType, fileName: string, allowDownload?: boolean): Promise<string>;
|
|
24
|
+
export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean): Promise<string>;
|
|
26
25
|
/**
|
|
27
26
|
* Get module name.
|
|
28
27
|
*
|
|
@@ -32,9 +31,8 @@ export declare class ImageExport {
|
|
|
32
31
|
/**
|
|
33
32
|
* To destroy the ImageExport.
|
|
34
33
|
*
|
|
35
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
36
34
|
* @returns {void}
|
|
37
35
|
* @private
|
|
38
36
|
*/
|
|
39
|
-
destroy(
|
|
37
|
+
destroy(): void;
|
|
40
38
|
}
|
|
@@ -13,7 +13,6 @@ var ImageExport = /** @class */ (function () {
|
|
|
13
13
|
* @param {Maps} control - Specifies the instance of the map
|
|
14
14
|
*/
|
|
15
15
|
function ImageExport(control) {
|
|
16
|
-
this.control = control;
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* To export the file as image/svg format
|
|
@@ -24,29 +23,28 @@ var ImageExport = /** @class */ (function () {
|
|
|
24
23
|
* @returns {Promise<string>} - Returns the promise string.
|
|
25
24
|
* @private
|
|
26
25
|
*/
|
|
27
|
-
ImageExport.prototype.export = function (type, fileName, allowDownload) {
|
|
28
|
-
var _this = this;
|
|
26
|
+
ImageExport.prototype.export = function (maps, type, fileName, allowDownload) {
|
|
29
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
28
|
var promise = new Promise(function (resolve, reject) {
|
|
31
29
|
var imageCanvasElement = createElement('canvas', {
|
|
32
30
|
id: 'ej2-canvas',
|
|
33
31
|
attrs: {
|
|
34
|
-
'width':
|
|
35
|
-
'height':
|
|
32
|
+
'width': maps.availableSize.width.toString(),
|
|
33
|
+
'height': maps.availableSize.height.toString()
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
var isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
|
|
39
|
-
var toolbarEle = document.getElementById(
|
|
40
|
-
var svgParent = document.getElementById(
|
|
37
|
+
var toolbarEle = document.getElementById(maps.element.id + '_ToolBar');
|
|
38
|
+
var svgParent = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
|
|
41
39
|
var svgDataElement;
|
|
42
40
|
var tileSvg;
|
|
43
|
-
var svgObject = getElementByID(
|
|
44
|
-
if (!
|
|
41
|
+
var svgObject = getElementByID(maps.element.id + '_svg').cloneNode(true);
|
|
42
|
+
if (!maps.isTileMap) {
|
|
45
43
|
svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
|
|
46
|
-
|
|
44
|
+
maps.svgObject.outerHTML + '</svg>';
|
|
47
45
|
}
|
|
48
46
|
else {
|
|
49
|
-
tileSvg = getElementByID(
|
|
47
|
+
tileSvg = getElementByID(maps.element.id + '_Tile_SVG').cloneNode(true);
|
|
50
48
|
svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
|
|
51
49
|
svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
|
|
52
50
|
}
|
|
@@ -63,7 +61,7 @@ var ImageExport = /** @class */ (function () {
|
|
|
63
61
|
else {
|
|
64
62
|
var image_1 = new Image();
|
|
65
63
|
var ctxt_1 = imageCanvasElement.getContext('2d');
|
|
66
|
-
if (!
|
|
64
|
+
if (!maps.isTileMap) {
|
|
67
65
|
image_1.onload = (function () {
|
|
68
66
|
ctxt_1.drawImage(image_1, 0, 0);
|
|
69
67
|
window.URL.revokeObjectURL(url);
|
|
@@ -82,22 +80,22 @@ var ImageExport = /** @class */ (function () {
|
|
|
82
80
|
image_1.src = url;
|
|
83
81
|
}
|
|
84
82
|
else {
|
|
85
|
-
var svgParentElement = document.getElementById(
|
|
83
|
+
var svgParentElement = document.getElementById(maps.element.id + '_MapAreaBorder');
|
|
86
84
|
var top_1 = parseFloat(svgParentElement.getAttribute('y'));
|
|
87
85
|
var left_1 = parseFloat(svgParentElement.getAttribute('x'));
|
|
88
86
|
var imgxHttp = new XMLHttpRequest();
|
|
89
|
-
var imgTileLength_1 =
|
|
87
|
+
var imgTileLength_1 = maps.mapLayerPanel.tiles.length;
|
|
90
88
|
var _loop_1 = function (i) {
|
|
91
|
-
var tile = document.getElementById(
|
|
89
|
+
var tile = document.getElementById(maps.element.id + '_tile_' + (i - 1));
|
|
92
90
|
var exportTileImg = new Image();
|
|
93
91
|
exportTileImg.crossOrigin = 'Anonymous';
|
|
94
|
-
ctxt_1.fillStyle =
|
|
95
|
-
ctxt_1.fillRect(0, 0,
|
|
96
|
-
ctxt_1.font =
|
|
97
|
-
var titleElement = document.getElementById(
|
|
92
|
+
ctxt_1.fillStyle = maps.background ? maps.background : '#FFFFFF';
|
|
93
|
+
ctxt_1.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
|
|
94
|
+
ctxt_1.font = maps.titleSettings.textStyle.size + ' Arial';
|
|
95
|
+
var titleElement = document.getElementById(maps.element.id + '_Map_title');
|
|
98
96
|
if (!isNullOrUndefined(titleElement)) {
|
|
99
97
|
ctxt_1.fillStyle = titleElement.getAttribute('fill');
|
|
100
|
-
ctxt_1.fillText(
|
|
98
|
+
ctxt_1.fillText(maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
|
|
101
99
|
}
|
|
102
100
|
exportTileImg.onload = (function () {
|
|
103
101
|
if (i === 0 || i === imgTileLength_1 + 1) {
|
|
@@ -111,7 +109,6 @@ var ImageExport = /** @class */ (function () {
|
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
else {
|
|
114
|
-
var tileParent = document.getElementById(_this.control.element.id + '_tile_parent');
|
|
115
112
|
ctxt_1.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left_1, parseFloat(tile.style.top) +
|
|
116
113
|
top_1);
|
|
117
114
|
}
|
|
@@ -168,15 +165,10 @@ var ImageExport = /** @class */ (function () {
|
|
|
168
165
|
/**
|
|
169
166
|
* To destroy the ImageExport.
|
|
170
167
|
*
|
|
171
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
172
168
|
* @returns {void}
|
|
173
169
|
* @private
|
|
174
170
|
*/
|
|
175
|
-
ImageExport.prototype.destroy = function (
|
|
176
|
-
/**
|
|
177
|
-
* Destroy method performed here
|
|
178
|
-
*/
|
|
179
|
-
};
|
|
171
|
+
ImageExport.prototype.destroy = function () { };
|
|
180
172
|
return ImageExport;
|
|
181
173
|
}());
|
|
182
174
|
export { ImageExport };
|
|
@@ -7,13 +7,12 @@ import { PdfPageOrientation } from '@syncfusion/ej2-pdf-export';
|
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
9
9
|
export declare class PdfExport {
|
|
10
|
-
private control;
|
|
11
10
|
/**
|
|
12
11
|
* Constructor for Maps
|
|
13
12
|
*
|
|
14
13
|
* @param {Maps} control Specifies the instance of the map
|
|
15
14
|
*/
|
|
16
|
-
constructor(
|
|
15
|
+
constructor();
|
|
17
16
|
/**
|
|
18
17
|
* To export the file as image/svg format
|
|
19
18
|
*
|
|
@@ -24,7 +23,7 @@ export declare class PdfExport {
|
|
|
24
23
|
* @returns {Promise<string>} - Returns the promise string
|
|
25
24
|
* @private
|
|
26
25
|
*/
|
|
27
|
-
export(type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string>;
|
|
26
|
+
export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string>;
|
|
28
27
|
/**
|
|
29
28
|
* Get module name.
|
|
30
29
|
*
|
|
@@ -32,11 +31,10 @@ export declare class PdfExport {
|
|
|
32
31
|
*/
|
|
33
32
|
protected getModuleName(): string;
|
|
34
33
|
/**
|
|
35
|
-
* To destroy the
|
|
34
|
+
* To destroy the PdfExport.
|
|
36
35
|
*
|
|
37
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
38
36
|
* @returns {void}
|
|
39
37
|
* @private
|
|
40
38
|
*/
|
|
41
|
-
destroy(
|
|
39
|
+
destroy(): void;
|
|
42
40
|
}
|
|
@@ -12,8 +12,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
12
12
|
*
|
|
13
13
|
* @param {Maps} control Specifies the instance of the map
|
|
14
14
|
*/
|
|
15
|
-
function PdfExport(
|
|
16
|
-
this.control = control;
|
|
15
|
+
function PdfExport() {
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* To export the file as image/svg format
|
|
@@ -25,25 +24,24 @@ var PdfExport = /** @class */ (function () {
|
|
|
25
24
|
* @returns {Promise<string>} - Returns the promise string
|
|
26
25
|
* @private
|
|
27
26
|
*/
|
|
28
|
-
PdfExport.prototype.export = function (type, fileName, allowDownload, orientation) {
|
|
29
|
-
var _this = this;
|
|
27
|
+
PdfExport.prototype.export = function (maps, type, fileName, allowDownload, orientation) {
|
|
30
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
29
|
var promise = new Promise(function (resolve, reject) {
|
|
32
30
|
var canvasElement = createElement('canvas', {
|
|
33
31
|
id: 'ej2-canvas',
|
|
34
32
|
attrs: {
|
|
35
|
-
'width':
|
|
36
|
-
'height':
|
|
33
|
+
'width': maps.availableSize.width.toString(),
|
|
34
|
+
'height': maps.availableSize.height.toString()
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
37
|
orientation = isNullOrUndefined(orientation) ? PdfPageOrientation.Landscape : orientation;
|
|
40
|
-
var svgParent = document.getElementById(
|
|
38
|
+
var svgParent = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
|
|
41
39
|
var svgData;
|
|
42
|
-
var exportElement =
|
|
40
|
+
var exportElement = maps.svgObject.cloneNode(true);
|
|
43
41
|
var backgroundElement = exportElement.childNodes[0];
|
|
44
42
|
var backgroundColor = backgroundElement.getAttribute('fill');
|
|
45
|
-
if ((
|
|
46
|
-
||
|
|
43
|
+
if ((maps.theme === 'Tailwind' || maps.theme === 'TailwindDark' || maps.theme === 'Bootstrap5' || maps.theme === 'Bootstrap5Dark'
|
|
44
|
+
|| maps.theme === 'Fluent' || maps.theme === 'FluentDark') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
47
45
|
exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
|
|
48
46
|
}
|
|
49
47
|
var url = window.URL.createObjectURL(new Blob(type === 'SVG' ? [svgData] :
|
|
@@ -51,7 +49,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
51
49
|
var pdfDocument = new PdfDocument();
|
|
52
50
|
var image = new Image();
|
|
53
51
|
var ctx = canvasElement.getContext('2d');
|
|
54
|
-
if (!
|
|
52
|
+
if (!maps.isTileMap) {
|
|
55
53
|
image.onload = (function () {
|
|
56
54
|
ctx.drawImage(image, 0, 0);
|
|
57
55
|
window.URL.revokeObjectURL(url);
|
|
@@ -59,7 +57,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
59
57
|
var imageString = canvasElement.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream');
|
|
60
58
|
pdfDocument.pageSettings.orientation = orientation;
|
|
61
59
|
imageString = imageString.slice(imageString.indexOf(',') + 1);
|
|
62
|
-
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (
|
|
60
|
+
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height);
|
|
63
61
|
if (allowDownload) {
|
|
64
62
|
pdfDocument.save(fileName + '.pdf');
|
|
65
63
|
pdfDocument.destroy();
|
|
@@ -72,22 +70,22 @@ var PdfExport = /** @class */ (function () {
|
|
|
72
70
|
image.src = url;
|
|
73
71
|
}
|
|
74
72
|
else {
|
|
75
|
-
var svgParentElement = document.getElementById(
|
|
73
|
+
var svgParentElement = document.getElementById(maps.element.id + '_MapAreaBorder');
|
|
76
74
|
var top_1 = parseFloat(svgParentElement.getAttribute('y'));
|
|
77
75
|
var left_1 = parseFloat(svgParentElement.getAttribute('x'));
|
|
78
76
|
var xHttp = new XMLHttpRequest();
|
|
79
|
-
var tileLength_1 =
|
|
77
|
+
var tileLength_1 = maps.mapLayerPanel.tiles.length;
|
|
80
78
|
var _loop_1 = function (i) {
|
|
81
|
-
var tile = document.getElementById(
|
|
79
|
+
var tile = document.getElementById(maps.element.id + '_tile_' + (i - 1));
|
|
82
80
|
var tileImg = new Image();
|
|
83
81
|
tileImg.crossOrigin = 'Anonymous';
|
|
84
|
-
ctx.fillStyle =
|
|
85
|
-
ctx.fillRect(0, 0,
|
|
86
|
-
ctx.font =
|
|
87
|
-
var titleElement = document.getElementById(
|
|
82
|
+
ctx.fillStyle = maps.background ? maps.background : '#FFFFFF';
|
|
83
|
+
ctx.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
|
|
84
|
+
ctx.font = maps.titleSettings.textStyle.size + ' Arial';
|
|
85
|
+
var titleElement = document.getElementById(maps.element.id + '_Map_title');
|
|
88
86
|
if (!isNullOrUndefined(titleElement)) {
|
|
89
87
|
ctx.fillStyle = titleElement.getAttribute('fill');
|
|
90
|
-
ctx.fillText(
|
|
88
|
+
ctx.fillText(maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
|
|
91
89
|
}
|
|
92
90
|
tileImg.onload = (function () {
|
|
93
91
|
if (i === 0 || i === tileLength_1 + 1) {
|
|
@@ -101,7 +99,6 @@ var PdfExport = /** @class */ (function () {
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
else {
|
|
104
|
-
var tileParent = document.getElementById(_this.control.element.id + '_tile_parent');
|
|
105
102
|
ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left_1, parseFloat(tile.style.top) + top_1);
|
|
106
103
|
}
|
|
107
104
|
ctx.drawImage(tileImg, 0, 0);
|
|
@@ -111,7 +108,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
111
108
|
var x = localStorage.getItem('saved-image-example');
|
|
112
109
|
pdfDocument.pageSettings.orientation = orientation;
|
|
113
110
|
x = x.slice(x.indexOf(',') + 1);
|
|
114
|
-
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(x), 0, 0, (
|
|
111
|
+
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(x), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height);
|
|
115
112
|
if (allowDownload) {
|
|
116
113
|
pdfDocument.save(fileName + '.pdf');
|
|
117
114
|
pdfDocument.destroy();
|
|
@@ -128,7 +125,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
128
125
|
}
|
|
129
126
|
else {
|
|
130
127
|
setTimeout(function () {
|
|
131
|
-
var tileSvg = document.getElementById(
|
|
128
|
+
var tileSvg = document.getElementById(maps.element.id + '_Tile_SVG');
|
|
132
129
|
tileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(tileSvg)], { type: 'image/svg+xml' }));
|
|
133
130
|
}, 300);
|
|
134
131
|
}
|
|
@@ -155,17 +152,12 @@ var PdfExport = /** @class */ (function () {
|
|
|
155
152
|
return 'PdfExport';
|
|
156
153
|
};
|
|
157
154
|
/**
|
|
158
|
-
* To destroy the
|
|
155
|
+
* To destroy the PdfExport.
|
|
159
156
|
*
|
|
160
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
161
157
|
* @returns {void}
|
|
162
158
|
* @private
|
|
163
159
|
*/
|
|
164
|
-
PdfExport.prototype.destroy = function (
|
|
165
|
-
/**
|
|
166
|
-
* Destroy method performed here
|
|
167
|
-
*/
|
|
168
|
-
};
|
|
160
|
+
PdfExport.prototype.destroy = function () { };
|
|
169
161
|
return PdfExport;
|
|
170
162
|
}());
|
|
171
163
|
export { PdfExport };
|
|
@@ -503,6 +503,14 @@ export interface ILabelRenderingEventArgs extends IMapsEventArgs {
|
|
|
503
503
|
* Defines the text for the data-label in event argument.
|
|
504
504
|
*/
|
|
505
505
|
text: string;
|
|
506
|
+
/**
|
|
507
|
+
* Defines the right and left position of text for the data-label in event argument.
|
|
508
|
+
*/
|
|
509
|
+
offsetX: number;
|
|
510
|
+
/**
|
|
511
|
+
* Defines the top and bottom position of text for the data-label in event argument.
|
|
512
|
+
*/
|
|
513
|
+
offsetY: number;
|
|
506
514
|
/**
|
|
507
515
|
* Defines the color and width of the border for the data-label in event argument.
|
|
508
516
|
*/
|
|
@@ -5,8 +5,6 @@ import { Maps } from '../../index';
|
|
|
5
5
|
* @hidden
|
|
6
6
|
*/
|
|
7
7
|
export declare class Print {
|
|
8
|
-
private control;
|
|
9
|
-
private printWindow;
|
|
10
8
|
/**
|
|
11
9
|
* Constructor for Maps
|
|
12
10
|
*
|
|
@@ -20,7 +18,7 @@ export declare class Print {
|
|
|
20
18
|
* @returns {void}
|
|
21
19
|
* @private
|
|
22
20
|
*/
|
|
23
|
-
print(elements?: string[] | string | Element): void;
|
|
21
|
+
print(maps: Maps, elements?: string[] | string | Element): void;
|
|
24
22
|
/**
|
|
25
23
|
* To get the html string of the Maps
|
|
26
24
|
*
|
|
@@ -38,9 +36,8 @@ export declare class Print {
|
|
|
38
36
|
/**
|
|
39
37
|
* To destroy the print.
|
|
40
38
|
*
|
|
41
|
-
* @param {Maps} maps - Specifies the instance of the maps
|
|
42
39
|
* @returns {void}
|
|
43
40
|
* @private
|
|
44
41
|
*/
|
|
45
|
-
destroy(
|
|
42
|
+
destroy(): void;
|
|
46
43
|
}
|
package/src/maps/model/print.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import { print as
|
|
3
|
-
import { getElement
|
|
2
|
+
import { print as printFunction, createElement } from '@syncfusion/ej2-base';
|
|
3
|
+
import { getElement } from '../utils/helper';
|
|
4
4
|
import { beforePrint } from '../model/constants';
|
|
5
5
|
/**
|
|
6
6
|
* This module enables the print functionality in maps.
|
|
@@ -14,7 +14,6 @@ var Print = /** @class */ (function () {
|
|
|
14
14
|
* @param {Maps} control - Specifies the instance of the map
|
|
15
15
|
*/
|
|
16
16
|
function Print(control) {
|
|
17
|
-
this.control = control;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* To print the Maps
|
|
@@ -23,17 +22,16 @@ var Print = /** @class */ (function () {
|
|
|
23
22
|
* @returns {void}
|
|
24
23
|
* @private
|
|
25
24
|
*/
|
|
26
|
-
Print.prototype.print = function (elements) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.printWindow.resizeTo(screen.availWidth, screen.availHeight);
|
|
25
|
+
Print.prototype.print = function (maps, elements) {
|
|
26
|
+
var printWindow = window.open('', 'print', 'height=' + window.outerHeight + ',width=' + window.outerWidth + ',tabbar=no');
|
|
27
|
+
printWindow.moveTo(0, 0);
|
|
28
|
+
printWindow.resizeTo(screen.availWidth, screen.availHeight);
|
|
31
29
|
var argsData = {
|
|
32
|
-
cancel: false, htmlContent: this.getHTMLContent(elements), name: beforePrint
|
|
30
|
+
cancel: false, htmlContent: this.getHTMLContent(maps, elements), name: beforePrint
|
|
33
31
|
};
|
|
34
|
-
|
|
32
|
+
maps.trigger('beforePrint', argsData, function (beforePrintArgs) {
|
|
35
33
|
if (!argsData.cancel) {
|
|
36
|
-
|
|
34
|
+
printFunction(argsData.htmlContent, printWindow);
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
37
|
};
|
|
@@ -44,20 +42,19 @@ var Print = /** @class */ (function () {
|
|
|
44
42
|
* @returns {Element} - Returns the div element
|
|
45
43
|
* @private
|
|
46
44
|
*/
|
|
47
|
-
Print.prototype.getHTMLContent = function (elements) {
|
|
48
|
-
var elementRect = getClientElement(this.control.element.id);
|
|
45
|
+
Print.prototype.getHTMLContent = function (maps, elements) {
|
|
49
46
|
var div = createElement('div');
|
|
50
|
-
var divElement =
|
|
51
|
-
if (
|
|
47
|
+
var divElement = maps.element.cloneNode(true);
|
|
48
|
+
if (maps.isTileMap) {
|
|
52
49
|
for (var i = 0; i < divElement.childElementCount; i++) {
|
|
53
|
-
if (divElement.children[i].id ===
|
|
50
|
+
if (divElement.children[i].id === maps.element.id + '_tile_parent') {
|
|
54
51
|
divElement.children[i].style.removeProperty('height');
|
|
55
52
|
divElement.children[i].style.removeProperty('width');
|
|
56
53
|
divElement.children[i].style.removeProperty('top');
|
|
57
54
|
divElement.children[i].style.removeProperty('left');
|
|
58
55
|
divElement.children[i].style.removeProperty('right');
|
|
59
56
|
divElement.children[i].style.removeProperty('overflow');
|
|
60
|
-
var svgElement = document.getElementById(
|
|
57
|
+
var svgElement = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
|
|
61
58
|
divElement.children[i].children[0].style.overflow = 'hidden';
|
|
62
59
|
divElement.children[i].children[0].style.position = 'absolute';
|
|
63
60
|
divElement.children[i].children[0].style.height = svgElement.style.height;
|
|
@@ -97,15 +94,10 @@ var Print = /** @class */ (function () {
|
|
|
97
94
|
/**
|
|
98
95
|
* To destroy the print.
|
|
99
96
|
*
|
|
100
|
-
* @param {Maps} maps - Specifies the instance of the maps
|
|
101
97
|
* @returns {void}
|
|
102
98
|
* @private
|
|
103
99
|
*/
|
|
104
|
-
Print.prototype.destroy = function (
|
|
105
|
-
/**
|
|
106
|
-
* Destroy method performed here
|
|
107
|
-
*/
|
|
108
|
-
};
|
|
100
|
+
Print.prototype.destroy = function () { };
|
|
109
101
|
return Print;
|
|
110
102
|
}());
|
|
111
103
|
export { Print };
|
|
@@ -113,12 +113,11 @@ var Annotations = /** @class */ (function () {
|
|
|
113
113
|
/**
|
|
114
114
|
* To destroy the annotation.
|
|
115
115
|
*
|
|
116
|
-
* @param {Maps} map - Specifies the instance of the maps
|
|
117
116
|
* @returns {void}
|
|
118
117
|
* @private
|
|
119
118
|
*/
|
|
120
|
-
Annotations.prototype.destroy = function (
|
|
121
|
-
|
|
119
|
+
Annotations.prototype.destroy = function () {
|
|
120
|
+
this.map = null;
|
|
122
121
|
};
|
|
123
122
|
return Annotations;
|
|
124
123
|
}());
|