@mapgis/leaflet-easyprint 17.0.0 → 17.2.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 +17 -44
- package/src/index - ex.js +0 -447
- package/src/index - ori.js +0 -447
- package/src/index-dev1.js +0 -447
- package/src/index-dev2.js +0 -453
package/package.json
CHANGED
|
@@ -1,42 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
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"
|
|
2
|
+
"name": "@mapgis/leaflet-easyprint",
|
|
3
|
+
"version": "17.2.0",
|
|
4
|
+
"description": "A leaflet plugin which adds an icon to print the map",
|
|
5
|
+
"main": "dist/bundle.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/rowanwins/leaflet-easyPrint.git"
|
|
18
9
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
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"
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rollup -c",
|
|
12
|
+
"dev": "rollup -c -w"
|
|
29
13
|
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"leaflet"
|
|
16
|
+
],
|
|
17
|
+
"author": "Rowan Winsemius <rowanwins@yahoo.com.au>",
|
|
18
|
+
"license": "MIT",
|
|
30
19
|
"bugs": {
|
|
31
20
|
"url": "https://github.com/rowanwins/leaflet-easyPrint/issues"
|
|
32
21
|
},
|
|
33
|
-
"
|
|
22
|
+
"homepage": "https://github.com/rowanwins/leaflet-easyPrint#readme",
|
|
34
23
|
"dependencies": {
|
|
35
24
|
"dom-to-image": "^2.5.2",
|
|
36
25
|
"file-saver": "^1.3.3"
|
|
37
26
|
},
|
|
38
|
-
"deprecated": false,
|
|
39
|
-
"description": "A leaflet plugin which adds an icon to print the map",
|
|
40
27
|
"devDependencies": {
|
|
41
28
|
"babel-plugin-external-helpers": "^6.22.0",
|
|
42
29
|
"babel-preset-latest": "^6.24.1",
|
|
@@ -48,19 +35,5 @@
|
|
|
48
35
|
"rollup-plugin-node-resolve": "^3.0.0",
|
|
49
36
|
"rollup-plugin-uglify": "^1.0.2",
|
|
50
37
|
"rollup-watch": "^3.2.2"
|
|
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"
|
|
38
|
+
}
|
|
66
39
|
}
|
package/src/index - ex.js
DELETED
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
var domtoimage = require('dom-to-image');
|
|
2
|
-
var fileSaver = require('file-saver');
|
|
3
|
-
var L = require('@mapgis/leaflet');
|
|
4
|
-
var EasyPrint = {
|
|
5
|
-
options: {
|
|
6
|
-
title: 'Print map',
|
|
7
|
-
position: 'topleft',
|
|
8
|
-
sizeModes: ['Current'],
|
|
9
|
-
filename: 'map',
|
|
10
|
-
exportOnly: false,
|
|
11
|
-
hidden: false,
|
|
12
|
-
tileWait: 500,
|
|
13
|
-
hideControlContainer: true,
|
|
14
|
-
hideClasses: [],
|
|
15
|
-
customWindowTitle: window.document.title,
|
|
16
|
-
spinnerBgCOlor: '#0DC5C1',
|
|
17
|
-
customSpinnerClass: 'epLoader',
|
|
18
|
-
defaultSizeTitles: {
|
|
19
|
-
Current: 'Current Size',
|
|
20
|
-
A4Landscape: 'A4 Landscape',
|
|
21
|
-
A4Portrait: 'A4 Portrait'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
onAdd: function () {
|
|
26
|
-
this.mapContainer = this._map.getContainer();
|
|
27
|
-
this.options.sizeModes = this.options.sizeModes.map(function (sizeMode) {
|
|
28
|
-
if (sizeMode === 'Current') {
|
|
29
|
-
return {
|
|
30
|
-
name: this.options.defaultSizeTitles.Current,
|
|
31
|
-
className: 'CurrentSize'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (sizeMode === 'A4Landscape') {
|
|
35
|
-
return {
|
|
36
|
-
height: this._a4PageSize.height,
|
|
37
|
-
width: this._a4PageSize.width,
|
|
38
|
-
name: this.options.defaultSizeTitles.A4Landscape,
|
|
39
|
-
className: 'A4Landscape page'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (sizeMode === 'A4Portrait') {
|
|
43
|
-
return {
|
|
44
|
-
height: this._a4PageSize.width,
|
|
45
|
-
width: this._a4PageSize.height,
|
|
46
|
-
name: this.options.defaultSizeTitles.A4Portrait,
|
|
47
|
-
className: 'A4Portrait page'
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
return sizeMode;
|
|
51
|
-
}, this);
|
|
52
|
-
|
|
53
|
-
var container = L.DomUtil.create('div', 'leaflet-control-easyPrint leaflet-bar leaflet-control');
|
|
54
|
-
if (!this.options.hidden) {
|
|
55
|
-
this._addCss();
|
|
56
|
-
|
|
57
|
-
L.DomEvent.addListener(container, 'mouseover', this._togglePageSizeButtons, this);
|
|
58
|
-
L.DomEvent.addListener(container, 'mouseout', this._togglePageSizeButtons, this);
|
|
59
|
-
|
|
60
|
-
var btnClass = 'leaflet-control-easyPrint-button'
|
|
61
|
-
if (this.options.exportOnly) btnClass = btnClass + '-export'
|
|
62
|
-
|
|
63
|
-
this.link = L.DomUtil.create('a', btnClass, container);
|
|
64
|
-
this.link.id = "leafletEasyPrint";
|
|
65
|
-
this.link.title = this.options.title;
|
|
66
|
-
this.holder = L.DomUtil.create('ul', 'easyPrintHolder', container);
|
|
67
|
-
|
|
68
|
-
this.options.sizeModes.forEach(function (sizeMode) {
|
|
69
|
-
var btn = L.DomUtil.create('li', 'easyPrintSizeMode', this.holder);
|
|
70
|
-
btn.title = sizeMode.name;
|
|
71
|
-
var link = L.DomUtil.create('a', sizeMode.className, btn);
|
|
72
|
-
L.DomEvent.addListener(btn, 'click', this.printMap, this);
|
|
73
|
-
}, this);
|
|
74
|
-
|
|
75
|
-
L.DomEvent.disableClickPropagation(container);
|
|
76
|
-
}
|
|
77
|
-
return container;
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
printMap: function (event, filename) {
|
|
81
|
-
if (filename) {
|
|
82
|
-
this.options.filename = filename
|
|
83
|
-
}
|
|
84
|
-
if (!this.options.exportOnly) {
|
|
85
|
-
this._page = window.open("", "_blank", 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10, top=10, width=200, height=250, visible=none');
|
|
86
|
-
this._page.document.write(this._createSpinner(this.options.customWindowTitle, this.options.customSpinnerClass, this.options.spinnerBgCOlor));
|
|
87
|
-
}
|
|
88
|
-
this.originalState = {
|
|
89
|
-
mapWidth: this.mapContainer.style.width,
|
|
90
|
-
widthWasAuto: false,
|
|
91
|
-
widthWasPercentage: false,
|
|
92
|
-
mapHeight: this.mapContainer.style.height,
|
|
93
|
-
zoom: this._map.getZoom(),
|
|
94
|
-
center: this._map.getCenter()
|
|
95
|
-
};
|
|
96
|
-
if (this.originalState.mapWidth === 'auto') {
|
|
97
|
-
this.originalState.mapWidth = this._map.getSize().x + 'px'
|
|
98
|
-
this.originalState.widthWasAuto = true
|
|
99
|
-
} else if (this.originalState.mapWidth.includes('%')) {
|
|
100
|
-
this.originalState.percentageWidth = this.originalState.mapWidth
|
|
101
|
-
this.originalState.widthWasPercentage = true
|
|
102
|
-
this.originalState.mapWidth = this._map.getSize().x + 'px'
|
|
103
|
-
}
|
|
104
|
-
this._map.fire("easyPrint-start", { event: event });
|
|
105
|
-
if (!this.options.hidden) {
|
|
106
|
-
this._togglePageSizeButtons({type: null});
|
|
107
|
-
}
|
|
108
|
-
if (this.options.hideControlContainer) {
|
|
109
|
-
this._toggleControls();
|
|
110
|
-
}
|
|
111
|
-
if (this.options.hideClasses) {
|
|
112
|
-
this._toggleClasses(this.options.hideClasses);
|
|
113
|
-
}
|
|
114
|
-
var sizeMode = typeof event !== 'string' ? event.target.className : event;
|
|
115
|
-
if (sizeMode === 'CurrentSize') {
|
|
116
|
-
return this._printOpertion(sizeMode);
|
|
117
|
-
}
|
|
118
|
-
this.outerContainer = this._createOuterContainer(this.mapContainer)
|
|
119
|
-
if (this.originalState.widthWasAuto) {
|
|
120
|
-
this.outerContainer.style.width = this.originalState.mapWidth
|
|
121
|
-
}
|
|
122
|
-
this._createImagePlaceholder(sizeMode)
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
_createImagePlaceholder: function (sizeMode) {
|
|
126
|
-
var plugin = this;
|
|
127
|
-
domtoimage.toPng(this.mapContainer, {
|
|
128
|
-
width: parseInt(this.originalState.mapWidth.replace('px')),
|
|
129
|
-
height: parseInt(this.originalState.mapHeight.replace('px'))
|
|
130
|
-
})
|
|
131
|
-
.then(function (dataUrl) {
|
|
132
|
-
plugin.blankDiv = document.createElement("div");
|
|
133
|
-
var blankDiv = plugin.blankDiv;
|
|
134
|
-
plugin.outerContainer.parentElement.insertBefore(blankDiv, plugin.outerContainer);
|
|
135
|
-
blankDiv.className = 'epHolder';
|
|
136
|
-
blankDiv.style.backgroundImage = 'url("' + dataUrl + '")';
|
|
137
|
-
blankDiv.style.position = 'absolute';
|
|
138
|
-
blankDiv.style.zIndex = 1011;
|
|
139
|
-
blankDiv.style.display = 'initial';
|
|
140
|
-
blankDiv.style.width = plugin.originalState.mapWidth;
|
|
141
|
-
blankDiv.style.height = plugin.originalState.mapHeight;
|
|
142
|
-
plugin._resizeAndPrintMap(sizeMode);
|
|
143
|
-
})
|
|
144
|
-
.catch(function (error) {
|
|
145
|
-
console.error('oops, something went wrong!', error);
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
_resizeAndPrintMap: function (sizeMode) {
|
|
150
|
-
this.outerContainer.style.opacity = 0;
|
|
151
|
-
var pageSize = this.options.sizeModes.filter(function (item) {
|
|
152
|
-
return item.className.indexOf(sizeMode) > -1;
|
|
153
|
-
});
|
|
154
|
-
pageSize = pageSize[0]
|
|
155
|
-
this.mapContainer.style.width = pageSize.width + 'px';
|
|
156
|
-
this.mapContainer.style.height = pageSize.height + 'px';
|
|
157
|
-
if (this.mapContainer.style.width > this.mapContainer.style.height) {
|
|
158
|
-
this.orientation = 'portrait';
|
|
159
|
-
} else {
|
|
160
|
-
this.orientation = 'landscape';
|
|
161
|
-
}
|
|
162
|
-
this._map.setView(this.originalState.center);
|
|
163
|
-
this._map.setZoom(this.originalState.zoom);
|
|
164
|
-
this._map.invalidateSize();
|
|
165
|
-
if (this.options.tileLayer) {
|
|
166
|
-
this._pausePrint(sizeMode)
|
|
167
|
-
} else {
|
|
168
|
-
this._printOpertion(sizeMode)
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
_pausePrint: function (sizeMode) {
|
|
173
|
-
var plugin = this
|
|
174
|
-
var loadingTest = setInterval(function () {
|
|
175
|
-
if(!plugin.options.tileLayer.isLoading()) {
|
|
176
|
-
clearInterval(loadingTest);
|
|
177
|
-
plugin._printOpertion(sizeMode)
|
|
178
|
-
}
|
|
179
|
-
}, plugin.options.tileWait);
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
_printOpertion: function (sizemode) {
|
|
183
|
-
var plugin = this;
|
|
184
|
-
var widthForExport = this.mapContainer.style.width
|
|
185
|
-
if (this.originalState.widthWasAuto && sizemode === 'CurrentSize' || this.originalState.widthWasPercentage && sizemode === 'CurrentSize') {
|
|
186
|
-
widthForExport = this.originalState.mapWidth
|
|
187
|
-
}
|
|
188
|
-
domtoimage.toPng(plugin.mapContainer, {
|
|
189
|
-
width: parseInt(widthForExport),
|
|
190
|
-
height: parseInt(plugin.mapContainer.style.height.replace('px'))
|
|
191
|
-
})
|
|
192
|
-
.then(function (dataUrl) {
|
|
193
|
-
var blob = plugin._dataURItoBlob(dataUrl);
|
|
194
|
-
if (plugin.options.exportOnly) {
|
|
195
|
-
fileSaver.saveAs(blob, plugin.options.filename + '.png');
|
|
196
|
-
} else {
|
|
197
|
-
plugin._sendToBrowserPrint(dataUrl, plugin.orientation);
|
|
198
|
-
}
|
|
199
|
-
plugin._toggleControls(true);
|
|
200
|
-
plugin._toggleClasses(plugin.options.hideClasses, true);
|
|
201
|
-
|
|
202
|
-
if (plugin.outerContainer) {
|
|
203
|
-
if (plugin.originalState.widthWasAuto) {
|
|
204
|
-
plugin.mapContainer.style.width = 'auto'
|
|
205
|
-
} else if (plugin.originalState.widthWasPercentage) {
|
|
206
|
-
plugin.mapContainer.style.width = plugin.originalState.percentageWidth
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
plugin.mapContainer.style.width = plugin.originalState.mapWidth;
|
|
210
|
-
}
|
|
211
|
-
plugin.mapContainer.style.height = plugin.originalState.mapHeight;
|
|
212
|
-
plugin._removeOuterContainer(plugin.mapContainer, plugin.outerContainer, plugin.blankDiv)
|
|
213
|
-
plugin._map.invalidateSize();
|
|
214
|
-
plugin._map.setView(plugin.originalState.center);
|
|
215
|
-
plugin._map.setZoom(plugin.originalState.zoom);
|
|
216
|
-
}
|
|
217
|
-
plugin._map.fire("easyPrint-finished");
|
|
218
|
-
})
|
|
219
|
-
.catch(function (error) {
|
|
220
|
-
console.error('Print operation failed', error);
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
_sendToBrowserPrint: function (img, orientation) {
|
|
225
|
-
this._page.resizeTo(600, 800);
|
|
226
|
-
var pageContent = this._createNewWindow(img, orientation, this)
|
|
227
|
-
this._page.document.body.innerHTML = ''
|
|
228
|
-
this._page.document.write(pageContent);
|
|
229
|
-
this._page.document.close();
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
_createSpinner: function (title, spinnerClass, spinnerColor) {
|
|
233
|
-
return `<html><head><title>`+ title + `</title></head><body><style>
|
|
234
|
-
body{
|
|
235
|
-
background: ` + spinnerColor + `;
|
|
236
|
-
}
|
|
237
|
-
.epLoader,
|
|
238
|
-
.epLoader:before,
|
|
239
|
-
.epLoader:after {
|
|
240
|
-
border-radius: 50%;
|
|
241
|
-
}
|
|
242
|
-
.epLoader {
|
|
243
|
-
color: #ffffff;
|
|
244
|
-
font-size: 11px;
|
|
245
|
-
text-indent: -99999em;
|
|
246
|
-
margin: 55px auto;
|
|
247
|
-
position: relative;
|
|
248
|
-
width: 10em;
|
|
249
|
-
height: 10em;
|
|
250
|
-
box-shadow: inset 0 0 0 1em;
|
|
251
|
-
-webkit-transform: translateZ(0);
|
|
252
|
-
-ms-transform: translateZ(0);
|
|
253
|
-
transform: translateZ(0);
|
|
254
|
-
}
|
|
255
|
-
.epLoader:before,
|
|
256
|
-
.epLoader:after {
|
|
257
|
-
position: absolute;
|
|
258
|
-
content: '';
|
|
259
|
-
}
|
|
260
|
-
.epLoader:before {
|
|
261
|
-
width: 5.2em;
|
|
262
|
-
height: 10.2em;
|
|
263
|
-
background: #0dc5c1;
|
|
264
|
-
border-radius: 10.2em 0 0 10.2em;
|
|
265
|
-
top: -0.1em;
|
|
266
|
-
left: -0.1em;
|
|
267
|
-
-webkit-transform-origin: 5.2em 5.1em;
|
|
268
|
-
transform-origin: 5.2em 5.1em;
|
|
269
|
-
-webkit-animation: load2 2s infinite ease 1.5s;
|
|
270
|
-
animation: load2 2s infinite ease 1.5s;
|
|
271
|
-
}
|
|
272
|
-
.epLoader:after {
|
|
273
|
-
width: 5.2em;
|
|
274
|
-
height: 10.2em;
|
|
275
|
-
background: #0dc5c1;
|
|
276
|
-
border-radius: 0 10.2em 10.2em 0;
|
|
277
|
-
top: -0.1em;
|
|
278
|
-
left: 5.1em;
|
|
279
|
-
-webkit-transform-origin: 0px 5.1em;
|
|
280
|
-
transform-origin: 0px 5.1em;
|
|
281
|
-
-webkit-animation: load2 2s infinite ease;
|
|
282
|
-
animation: load2 2s infinite ease;
|
|
283
|
-
}
|
|
284
|
-
@-webkit-keyframes load2 {
|
|
285
|
-
0% {
|
|
286
|
-
-webkit-transform: rotate(0deg);
|
|
287
|
-
transform: rotate(0deg);
|
|
288
|
-
}
|
|
289
|
-
100% {
|
|
290
|
-
-webkit-transform: rotate(360deg);
|
|
291
|
-
transform: rotate(360deg);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
@keyframes load2 {
|
|
295
|
-
0% {
|
|
296
|
-
-webkit-transform: rotate(0deg);
|
|
297
|
-
transform: rotate(0deg);
|
|
298
|
-
}
|
|
299
|
-
100% {
|
|
300
|
-
-webkit-transform: rotate(360deg);
|
|
301
|
-
transform: rotate(360deg);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
</style>
|
|
305
|
-
<div class="`+spinnerClass+`">Loading...</div></body></html>`;
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
_createNewWindow: function (img, orientation, plugin) {
|
|
309
|
-
return `<html><head>
|
|
310
|
-
<style>@media print {
|
|
311
|
-
img { max-width: 98%!important; max-height: 98%!important; }
|
|
312
|
-
@page { size: ` + orientation + `;}}
|
|
313
|
-
</style>
|
|
314
|
-
<script>function step1(){
|
|
315
|
-
setTimeout('step2()', 10);}
|
|
316
|
-
function step2(){window.print();window.close()}
|
|
317
|
-
</script></head><body onload='step1()'>
|
|
318
|
-
<img src="` + img + `" style="display:block; margin:auto;"></body></html>`;
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
_createOuterContainer: function (mapDiv) {
|
|
322
|
-
var outerContainer = document.createElement('div');
|
|
323
|
-
mapDiv.parentNode.insertBefore(outerContainer, mapDiv);
|
|
324
|
-
mapDiv.parentNode.removeChild(mapDiv);
|
|
325
|
-
outerContainer.appendChild(mapDiv);
|
|
326
|
-
outerContainer.style.width = mapDiv.style.width;
|
|
327
|
-
outerContainer.style.height = mapDiv.style.height;
|
|
328
|
-
outerContainer.style.display = 'inline-block'
|
|
329
|
-
outerContainer.style.overflow = 'hidden';
|
|
330
|
-
return outerContainer;
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
_removeOuterContainer: function (mapDiv, outerContainer, blankDiv) {
|
|
334
|
-
if (outerContainer.parentNode) {
|
|
335
|
-
outerContainer.parentNode.insertBefore(mapDiv, outerContainer);
|
|
336
|
-
outerContainer.parentNode.removeChild(blankDiv);
|
|
337
|
-
outerContainer.parentNode.removeChild(outerContainer);
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
_addCss: function () {
|
|
342
|
-
var css = document.createElement("style");
|
|
343
|
-
css.type = "text/css";
|
|
344
|
-
css.innerHTML = `.leaflet-control-easyPrint-button {
|
|
345
|
-
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVy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KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
|
346
|
-
background-size: 16px 16px;
|
|
347
|
-
cursor: pointer;
|
|
348
|
-
}
|
|
349
|
-
.leaflet-control-easyPrint-button-export {
|
|
350
|
-
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDQzMy41IDQzMy41IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MzMuNSA0MzMuNTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8Zz4KCTxnIGlkPSJmaWxlLWRvd25sb2FkIj4KCQk8cGF0aCBkPSJNMzk1LjI1LDE1M2gtMTAyVjBoLTE1M3YxNTNoLTEwMmwxNzguNSwxNzguNUwzOTUuMjUsMTUzeiBNMzguMjUsMzgyLjV2NTFoMzU3di01MUgzOC4yNXoiIGZpbGw9IiMwMDAwMDAiLz4KCTwvZz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
|
351
|
-
background-size: 16px 16px;
|
|
352
|
-
cursor: pointer;
|
|
353
|
-
}
|
|
354
|
-
.easyPrintHolder a {
|
|
355
|
-
background-size: 16px 16px;
|
|
356
|
-
cursor: pointer;
|
|
357
|
-
}
|
|
358
|
-
.easyPrintHolder .CurrentSize{
|
|
359
|
-
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTZweCIgdmVyc2lvbj0iMS4xIiBoZWlnaHQ9IjE2cHgiIHZpZXdCb3g9IjAgMCA2NCA2NCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNjQgNjQiPgogIDxnPgogICAgPGcgZmlsbD0iIzFEMUQxQiI+CiAgICAgIDxwYXRoIGQ9Ik0yNS4yNTUsMzUuOTA1TDQuMDE2LDU3LjE0N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w3LjY1LDE3LDE3LDE3aDEzMy4xNjd2MjI5LjVINzIuMjVWMzR6ICAgICIgZmlsbD0iIzAwMDAwMCIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=);
|
|
363
|
-
}
|
|
364
|
-
.easyPrintHolder .A4Landscape {
|
|
365
|
-
transform: rotate(-90deg);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.leaflet-control-easyPrint-button{
|
|
369
|
-
display: inline-block;
|
|
370
|
-
}
|
|
371
|
-
.easyPrintHolder{
|
|
372
|
-
margin-top:-31px;
|
|
373
|
-
margin-bottom: -5px;
|
|
374
|
-
margin-left: 30px;
|
|
375
|
-
padding-left: 0px;
|
|
376
|
-
display: none;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
.easyPrintSizeMode {
|
|
380
|
-
display: inline-block;
|
|
381
|
-
}
|
|
382
|
-
.easyPrintHolder .easyPrintSizeMode a {
|
|
383
|
-
border-radius: 0px;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
.easyPrintHolder .easyPrintSizeMode:last-child a{
|
|
387
|
-
border-top-right-radius: 2px;
|
|
388
|
-
border-bottom-right-radius: 2px;
|
|
389
|
-
margin-left: -1px;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.easyPrintPortrait:hover, .easyPrintLandscape:hover{
|
|
393
|
-
background-color: #757570;
|
|
394
|
-
cursor: pointer;
|
|
395
|
-
}`;
|
|
396
|
-
document.body.appendChild(css);
|
|
397
|
-
},
|
|
398
|
-
|
|
399
|
-
_dataURItoBlob: function (dataURI) {
|
|
400
|
-
var byteString = atob(dataURI.split(',')[1]);
|
|
401
|
-
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
|
402
|
-
var ab = new ArrayBuffer(byteString.length);
|
|
403
|
-
var dw = new DataView(ab);
|
|
404
|
-
for(var i = 0; i < byteString.length; i++) {
|
|
405
|
-
dw.setUint8(i, byteString.charCodeAt(i));
|
|
406
|
-
}
|
|
407
|
-
return new Blob([ab], {type: mimeString});
|
|
408
|
-
},
|
|
409
|
-
|
|
410
|
-
_togglePageSizeButtons: function (e) {
|
|
411
|
-
var holderStyle = this.holder.style
|
|
412
|
-
var linkStyle = this.link.style
|
|
413
|
-
if (e.type === 'mouseover') {
|
|
414
|
-
holderStyle.display = 'block';
|
|
415
|
-
linkStyle.borderTopRightRadius = '0'
|
|
416
|
-
linkStyle.borderBottomRightRadius = '0'
|
|
417
|
-
} else {
|
|
418
|
-
holderStyle.display = 'none';
|
|
419
|
-
linkStyle.borderTopRightRadius = '2px'
|
|
420
|
-
linkStyle.borderBottomRightRadius = '2px'
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
_toggleControls: function (show) {
|
|
425
|
-
var controlContainer = document.getElementsByClassName("leaflet-control-container")[0];
|
|
426
|
-
if (show) return controlContainer.style.display = 'block';
|
|
427
|
-
controlContainer.style.display = 'none';
|
|
428
|
-
},
|
|
429
|
-
_toggleClasses: function (classes, show) {
|
|
430
|
-
classes.forEach(function (className) {
|
|
431
|
-
var div = document.getElementsByClassName(className)[0];
|
|
432
|
-
if (show) return div.style.display = 'block';
|
|
433
|
-
div.style.display = 'none';
|
|
434
|
-
});
|
|
435
|
-
},
|
|
436
|
-
|
|
437
|
-
_a4PageSize: {
|
|
438
|
-
height: 715,
|
|
439
|
-
width: 1045
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
};
|
|
443
|
-
export default EasyPrint;
|
|
444
|
-
// L.easyPrint = function(options) {
|
|
445
|
-
// return new L.Control.EasyPrint(options);
|
|
446
|
-
// };
|
|
447
|
-
|