@mapgis/leaflet-easyprint 16.6.0 → 17.0.0
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/package.json +44 -17
- package/src/index.js +27 -10
package/package.json
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
2
|
+
"_from": "@mapgis/leaflet-easyprint@^16.6.0",
|
|
3
|
+
"_id": "@mapgis/leaflet-easyprint@16.6.0",
|
|
4
|
+
"_inBundle": false,
|
|
5
|
+
"_integrity": "sha512-5hoXt44CGxdCI+zFFHYi061FEHpbZF8CWOVCso6EUgx42CTDVzqwz2V16NcexefIIGXRt2YXXRhmS5JuQgh/NA==",
|
|
6
|
+
"_location": "/@mapgis/leaflet-easyprint",
|
|
7
|
+
"_phantomChildren": {},
|
|
8
|
+
"_requested": {
|
|
9
|
+
"type": "range",
|
|
10
|
+
"registry": true,
|
|
11
|
+
"raw": "@mapgis/leaflet-easyprint@^16.6.0",
|
|
12
|
+
"name": "@mapgis/leaflet-easyprint",
|
|
13
|
+
"escapedName": "@mapgis%2fleaflet-easyprint",
|
|
14
|
+
"scope": "@mapgis",
|
|
15
|
+
"rawSpec": "^16.6.0",
|
|
16
|
+
"saveSpec": null,
|
|
17
|
+
"fetchSpec": "^16.6.0"
|
|
13
18
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
19
|
+
"_requiredBy": [
|
|
20
|
+
"/"
|
|
16
21
|
],
|
|
17
|
-
"
|
|
18
|
-
"
|
|
22
|
+
"_resolved": "http://192.168.11.130:4873/@mapgis%2fleaflet-easyprint/-/leaflet-easyprint-16.6.0.tgz",
|
|
23
|
+
"_shasum": "7661d6af855e9e48c39fa0b7322b6950baa966fb",
|
|
24
|
+
"_spec": "@mapgis/leaflet-easyprint@^16.6.0",
|
|
25
|
+
"_where": "F:\\YTR\\project\\webclient-javascript-1113\\src\\leaflet",
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "Rowan Winsemius",
|
|
28
|
+
"email": "rowanwins@yahoo.com.au"
|
|
29
|
+
},
|
|
19
30
|
"bugs": {
|
|
20
31
|
"url": "https://github.com/rowanwins/leaflet-easyPrint/issues"
|
|
21
32
|
},
|
|
22
|
-
"
|
|
33
|
+
"bundleDependencies": false,
|
|
23
34
|
"dependencies": {
|
|
24
35
|
"dom-to-image": "^2.5.2",
|
|
25
36
|
"file-saver": "^1.3.3"
|
|
26
37
|
},
|
|
38
|
+
"deprecated": false,
|
|
39
|
+
"description": "A leaflet plugin which adds an icon to print the map",
|
|
27
40
|
"devDependencies": {
|
|
28
41
|
"babel-plugin-external-helpers": "^6.22.0",
|
|
29
42
|
"babel-preset-latest": "^6.24.1",
|
|
@@ -35,5 +48,19 @@
|
|
|
35
48
|
"rollup-plugin-node-resolve": "^3.0.0",
|
|
36
49
|
"rollup-plugin-uglify": "^1.0.2",
|
|
37
50
|
"rollup-watch": "^3.2.2"
|
|
38
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/rowanwins/leaflet-easyPrint#readme",
|
|
53
|
+
"keywords": [
|
|
54
|
+
"leaflet"
|
|
55
|
+
],
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"main": "dist/bundle.js",
|
|
58
|
+
"name": "@mapgis/leaflet-easyprint",
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "git+https://github.com/rowanwins/leaflet-easyPrint.git"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
},
|
|
65
|
+
"version": "17.0.0"
|
|
39
66
|
}
|
package/src/index.js
CHANGED
|
@@ -198,27 +198,46 @@ function EasyPrint(L) {
|
|
|
198
198
|
}
|
|
199
199
|
}, plugin.options.tileWait);
|
|
200
200
|
},
|
|
201
|
-
|
|
201
|
+
|
|
202
|
+
_getValidDom: function(dom){
|
|
203
|
+
// var cloneDom = dom.cloneNode(true)
|
|
204
|
+
var cloneDom = dom
|
|
205
|
+
var leafletTileDoms = cloneDom.getElementsByClassName("leaflet-tile")
|
|
206
|
+
for(var i = 0; i < leafletTileDoms.length; i++){
|
|
207
|
+
var el = leafletTileDoms[i]
|
|
208
|
+
if ( !el.classList.contains('leaflet-tile-loaded') && el.parentElement.classList.contains('leaflet-tile-container')) {
|
|
209
|
+
el.remove()
|
|
210
|
+
i --
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
dom.parentNode.appendChild(cloneDom)
|
|
214
|
+
return cloneDom
|
|
215
|
+
},
|
|
216
|
+
|
|
202
217
|
_printOpertion: function (sizemode) {
|
|
203
218
|
var plugin = this;
|
|
204
|
-
|
|
205
|
-
var widthForExport = this.options.width
|
|
206
|
-
// var
|
|
207
|
-
var
|
|
219
|
+
var widthForExport = this.mapContainer.style.width
|
|
220
|
+
// var widthForExport = this.options.width
|
|
221
|
+
// var heightForExport = this.options.height
|
|
222
|
+
var isDownload = this.options.isDownload
|
|
208
223
|
if (this.originalState.widthWasAuto && sizemode === 'CurrentSize' || this.originalState.widthWasPercentage && sizemode === 'CurrentSize') {
|
|
209
224
|
widthForExport = this.originalState.mapWidth
|
|
210
225
|
}
|
|
211
226
|
|
|
212
227
|
return new Promise((resolve)=>{
|
|
213
|
-
domtoimage[this.formatFun](plugin.mapContainer, {
|
|
228
|
+
domtoimage[this.formatFun]( plugin._getValidDom(plugin.mapContainer), {
|
|
214
229
|
// domtoimage.toPng(plugin.mapContainer, {
|
|
230
|
+
// width: parseInt(widthForExport),
|
|
231
|
+
// height: parseInt(heightForExport)
|
|
215
232
|
width: parseInt(widthForExport),
|
|
216
|
-
height: parseInt(
|
|
233
|
+
height: parseInt(plugin.mapContainer.style.height.replace('px'))
|
|
217
234
|
})
|
|
218
235
|
.then(function (dataUrl) {
|
|
219
236
|
var blob = plugin._dataURItoBlob(dataUrl);
|
|
220
237
|
if (plugin.options.exportOnly) {
|
|
221
|
-
|
|
238
|
+
if (isDownload) {
|
|
239
|
+
fileSaver.saveAs(blob, plugin.options.filename + '.' + plugin.format);
|
|
240
|
+
}
|
|
222
241
|
} else {
|
|
223
242
|
plugin._sendToBrowserPrint(dataUrl, plugin.orientation);
|
|
224
243
|
}
|
|
@@ -472,8 +491,6 @@ function EasyPrint(L) {
|
|
|
472
491
|
L.EasyPrint = function(options) {
|
|
473
492
|
return new L.Control.EasyPrint(options);
|
|
474
493
|
};
|
|
475
|
-
console.log("1--"+L.EasyPrint)
|
|
476
|
-
|
|
477
494
|
}
|
|
478
495
|
|
|
479
496
|
export default EasyPrint
|