@sswroom/sswr 1.6.20 → 1.6.22
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 +25 -0
- package/cesium.d.ts +13 -5
- package/cesium.js +225 -21
- package/data.d.ts +3 -0
- package/data.js +94 -1
- package/domtoimage/images.js +5 -3
- package/domtoimage/index.js +18 -13
- package/domtoimage/inliner.js +9 -7
- package/domtoimage/util.js +0 -106
- package/dummy/olayer2.d.ts +1 -1
- package/leaflet/EasyPrint.js +73 -65
- package/leaflet.d.ts +10 -4
- package/leaflet.js +258 -16
- package/map.d.ts +39 -29
- package/olayer2.d.ts +10 -4
- package/olayer2.js +82 -3
- package/package.json +1 -1
- package/parser.js +20 -0
- package/text.d.ts +3 -0
- package/text.js +24 -0
- package/web.d.ts +18 -0
- package/web.js +100 -0
package/map.d.ts
CHANGED
|
@@ -134,37 +134,47 @@ declare class GeometryOptions
|
|
|
134
134
|
fillOpacity?: number;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
declare class MarkerInfo
|
|
138
|
+
{
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export abstract class MapControl
|
|
138
142
|
{
|
|
139
143
|
constructor();
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
144
|
+
abstract getDiv(): HTMLDivElement;
|
|
145
|
+
abstract sizeUpdated(): void;
|
|
146
|
+
abstract createLayer(layer: map.LayerInfo, options?: LayerOptions): any;
|
|
147
|
+
abstract createMarkerLayer(name: string, options?: LayerOptions): any;
|
|
148
|
+
abstract createGeometryLayer(name: string, options?: LayerOptions): any;
|
|
149
|
+
abstract addLayer(layer: any): void;
|
|
150
|
+
abstract addKML(feature: kml.Feature | kml.KMLFile): void;
|
|
151
|
+
abstract uninit(): void;
|
|
152
|
+
abstract zoomIn(): void;
|
|
153
|
+
abstract zoomOut(): void;
|
|
154
|
+
abstract zoomScale(scale: number): void;
|
|
155
|
+
abstract panTo(pos: math.Coord2D): void;
|
|
156
|
+
abstract panZoomScale(pos: math.Coord2D, scale: number): void;
|
|
157
|
+
abstract zoomToExtent(extent: math.RectArea): void;
|
|
158
|
+
abstract handleMouseLClick(clickFunc: (mapPos: math.Coord2D, scnPos: math.Coord2D)=>void): void;
|
|
159
|
+
abstract handleMouseMove(moveFunc: (mapPos: math.Coord2D)=>void): void;
|
|
160
|
+
abstract handlePosChange(posFunc: (mapPos: math.Coord2D)=>void): void;
|
|
161
|
+
abstract map2ScnPos(mapPos: math.Coord2D): math.Coord2D;
|
|
162
|
+
abstract scn2MapPos(scnPos: math.Coord2D): math.Coord2D;
|
|
163
|
+
|
|
164
|
+
abstract createMarker(mapPos: math.Coord2D, imgURL: string, imgWidth: number, imgHeight: number, options?: MarkerOptions): MarkerInfo;
|
|
165
|
+
abstract layerAddMarker(markerLayer: any, marker: MarkerInfo): void;
|
|
166
|
+
abstract layerRemoveMarker(markerLayer: any, marker: MarkerInfo): void;
|
|
167
|
+
abstract layerClearMarkers(markerLayer: any): void;
|
|
168
|
+
abstract layerMoveMarker(markerLayer: any, marker: MarkerInfo, mapPos: math.Coord2D): MarkerInfo;
|
|
169
|
+
abstract markerUpdateIcon(markerLayer: any, marker: MarkerInfo, url: string): MarkerInfo;
|
|
170
|
+
abstract markerIsOver(marker: MarkerInfo, scnPos: math.Coord2D): boolean;
|
|
171
|
+
abstract markerShowPopup(marker: MarkerInfo, content: string, w?: number, h?: number): void;
|
|
172
|
+
abstract hidePopup();
|
|
173
|
+
|
|
174
|
+
abstract createGeometry(geom: geometry.Vector2D, options: GeometryOptions): any;
|
|
175
|
+
abstract layerAddGeometry(geometryLayer: any, geom: any): void;
|
|
176
|
+
abstract layerRemoveGeometry(geometryLayer: any, geom: any): void;
|
|
177
|
+
abstract layerClearGeometries(geometryLayer: any): void;
|
|
168
178
|
}
|
|
169
179
|
|
|
170
180
|
declare class OWSSpatialReference
|
package/olayer2.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export class Olayer2Map extends map.MapControl
|
|
|
29
29
|
posFunc: (lat: number, lon: number)=>void;
|
|
30
30
|
|
|
31
31
|
constructor(mapId: string);
|
|
32
|
+
getDiv(): HTMLDivElement;
|
|
33
|
+
sizeUpdated(): void;
|
|
32
34
|
createLayer(layer: map.LayerInfo, options?: map.LayerOptions): any;
|
|
33
35
|
createMarkerLayer(name: string, options?: map.LayerOptions): any;
|
|
34
36
|
createGeometryLayer(name: string, options?: map.LayerOptions): any;
|
|
@@ -47,11 +49,15 @@ export class Olayer2Map extends map.MapControl
|
|
|
47
49
|
map2ScnPos(mapPos: math.Coord2D): math.Coord2D;
|
|
48
50
|
scn2MapPos(scnPos: math.Coord2D): math.Coord2D;
|
|
49
51
|
|
|
50
|
-
createMarker(mapPos: math.Coord2D, imgURL: string, imgWidth: number, imgHeight: number, options?: map.MarkerOptions):
|
|
51
|
-
layerAddMarker(markerLayer: any, marker:
|
|
52
|
-
layerRemoveMarker(markerLayer: any, marker:
|
|
52
|
+
createMarker(mapPos: math.Coord2D, imgURL: string, imgWidth: number, imgHeight: number, options?: map.MarkerOptions): map.MarkerInfo;
|
|
53
|
+
layerAddMarker(markerLayer: any, marker: map.MarkerInfo): void;
|
|
54
|
+
layerRemoveMarker(markerLayer: any, marker: map.MarkerInfo): void;
|
|
53
55
|
layerClearMarkers(markerLayer: any): void;
|
|
54
|
-
|
|
56
|
+
layerMoveMarker(markerLayer: any, marker: MarkerInfo, mapPos: math.Coord2D): MarkerInfo;
|
|
57
|
+
markerUpdateIcon(markerLayer: any, marker: MarkerInfo, url: string): MarkerInfo;
|
|
58
|
+
markerIsOver(marker: map.MarkerInfo, scnPos: math.Coord2D): boolean;
|
|
59
|
+
markerShowPopup(marker: MarkerInfo, content: string, w?: number, h?: number): void;
|
|
60
|
+
hidePopup();
|
|
55
61
|
|
|
56
62
|
createGeometry(geom: geometry.Vector2D, options: map.GeometryOptions): any;
|
|
57
63
|
layerAddGeometry(geometryLayer: any, geom: any): void;
|
package/olayer2.js
CHANGED
|
@@ -235,6 +235,7 @@ export class Olayer2Map extends map.MapControl
|
|
|
235
235
|
this.initY = 22.4;
|
|
236
236
|
this.initLev = 12;
|
|
237
237
|
this.mapId = mapId;
|
|
238
|
+
this.currMarkerPopup = null;
|
|
238
239
|
let dom = document.getElementById(mapId);
|
|
239
240
|
if (dom)
|
|
240
241
|
{
|
|
@@ -288,6 +289,16 @@ export class Olayer2Map extends map.MapControl
|
|
|
288
289
|
this.currMarkerPopupObj = null;
|
|
289
290
|
}
|
|
290
291
|
|
|
292
|
+
getDiv()
|
|
293
|
+
{
|
|
294
|
+
return web.getDivElement(this.mapId);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
sizeUpdated()
|
|
298
|
+
{
|
|
299
|
+
this.map.updateSize();
|
|
300
|
+
}
|
|
301
|
+
|
|
291
302
|
/**
|
|
292
303
|
* @param {map.LayerInfo} layer
|
|
293
304
|
* @param {object} options
|
|
@@ -374,6 +385,9 @@ export class Olayer2Map extends map.MapControl
|
|
|
374
385
|
}
|
|
375
386
|
}
|
|
376
387
|
|
|
388
|
+
/**
|
|
389
|
+
* @param {kml.KMLFile | kml.Feature} feature
|
|
390
|
+
*/
|
|
377
391
|
addKML(feature)
|
|
378
392
|
{
|
|
379
393
|
createFromKML(feature, {map: this.map, objProjection: this.mapProjection, mapProjection: this.map.getProjectionObject()}).then((layer)=>{this.addLayer(layer);});
|
|
@@ -496,17 +510,82 @@ export class Olayer2Map extends map.MapControl
|
|
|
496
510
|
markerLayer.clearMarkers();
|
|
497
511
|
}
|
|
498
512
|
|
|
513
|
+
/**
|
|
514
|
+
* @param {OpenLayers.Layer.Markers} markerLayer
|
|
515
|
+
* @param {OpenLayers.Marker} marker
|
|
516
|
+
* @param {math.Coord2D} mapPos
|
|
517
|
+
*/
|
|
518
|
+
layerMoveMarker(markerLayer, marker, mapPos)
|
|
519
|
+
{
|
|
520
|
+
let newIcon = new OpenLayers.Icon(marker.icon.url, marker.icon.size, marker.icon.offset);
|
|
521
|
+
if (marker.icon.imageDiv.style.zIndex)
|
|
522
|
+
{
|
|
523
|
+
newIcon.imageDiv.style.zIndex = marker.icon.imageDiv.style.zIndex;
|
|
524
|
+
}
|
|
525
|
+
let newMarker = new OpenLayers.Marker(new OpenLayers.LonLat(mapPos.x, mapPos.y).transform(this.mapProjection, this.map.getProjectionObject()), newIcon);
|
|
526
|
+
markerLayer.removeMarker(marker);
|
|
527
|
+
markerLayer.addMarker(newMarker);
|
|
528
|
+
marker.destroy();
|
|
529
|
+
return newMarker;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* @param {OpenLayers.Layer.Markers} markerLayer
|
|
534
|
+
* @param {OpenLayers.Marker} marker
|
|
535
|
+
* @param {string} url
|
|
536
|
+
*/
|
|
537
|
+
markerUpdateIcon(markerLayer, marker, url)
|
|
538
|
+
{
|
|
539
|
+
let newIcon = new OpenLayers.Icon(url, marker.icon.size, marker.icon.offset);
|
|
540
|
+
if (marker.icon.imageDiv.style.zIndex)
|
|
541
|
+
{
|
|
542
|
+
newIcon.imageDiv.style.zIndex = marker.icon.imageDiv.style.zIndex;
|
|
543
|
+
}
|
|
544
|
+
let newMarker = new OpenLayers.Marker(marker.lonlat, newIcon);
|
|
545
|
+
markerLayer.removeMarker(marker);
|
|
546
|
+
markerLayer.addMarker(newMarker);
|
|
547
|
+
marker.destroy();
|
|
548
|
+
return newMarker;
|
|
549
|
+
}
|
|
550
|
+
|
|
499
551
|
markerIsOver(marker, scnPos)
|
|
500
552
|
{
|
|
501
553
|
let icon = marker.icon;
|
|
502
|
-
|
|
503
|
-
|
|
554
|
+
let ofst = marker.map.layerContainerOriginPx;
|
|
555
|
+
let ofstX = ofst.x + icon.offset.x;
|
|
556
|
+
let ofstY = ofst.y + icon.offset.y;
|
|
557
|
+
if (icon.px == null)
|
|
558
|
+
return false;
|
|
559
|
+
if ((scnPos.x < icon.px.x + ofstX) || (scnPos.y < icon.px.y + ofstY))
|
|
504
560
|
return false;
|
|
505
|
-
if ((icon.px.x +
|
|
561
|
+
if ((icon.px.x + ofstX + icon.size.w <= scnPos.x) || (icon.px.y + ofstY + icon.size.h <= scnPos.y))
|
|
506
562
|
return false;
|
|
507
563
|
return true;
|
|
508
564
|
}
|
|
509
565
|
|
|
566
|
+
markerShowPopup(marker, content, w, h)
|
|
567
|
+
{
|
|
568
|
+
let popup = new OpenLayers.Popup("marker", marker.lonlat, new OpenLayers.Size(w, h), content, false);
|
|
569
|
+
if (this.currMarkerPopup)
|
|
570
|
+
{
|
|
571
|
+
this.currMarkerPopup.hide();
|
|
572
|
+
}
|
|
573
|
+
this.currMarkerPopup = popup;
|
|
574
|
+
popup.autoSize = true;
|
|
575
|
+
this.map.addPopup(popup);
|
|
576
|
+
popup.show();
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
hidePopup()
|
|
580
|
+
{
|
|
581
|
+
if (this.currMarkerPopup)
|
|
582
|
+
{
|
|
583
|
+
this.currMarkerPopup.hide();
|
|
584
|
+
this.map.removePopup(this.currMarkerPopup);
|
|
585
|
+
this.currMarkerPopup = null;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
510
589
|
/**
|
|
511
590
|
* @param {geometry.Vector2D} geom
|
|
512
591
|
* @param {map.GeometryOptions} options
|
package/package.json
CHANGED
package/parser.js
CHANGED
|
@@ -980,6 +980,25 @@ async function parseJpg(reader, sourceName)
|
|
|
980
980
|
return null;
|
|
981
981
|
}
|
|
982
982
|
|
|
983
|
+
/**
|
|
984
|
+
* @param {data.ByteReader} reader
|
|
985
|
+
* @param {string} sourceName
|
|
986
|
+
*/
|
|
987
|
+
async function parsePng(reader, sourceName)
|
|
988
|
+
{
|
|
989
|
+
if (!(reader instanceof data.ByteReader))
|
|
990
|
+
return null;
|
|
991
|
+
if (reader.getLength() < 20)
|
|
992
|
+
return null;
|
|
993
|
+
if (reader.readUInt32(0, false) != 0x89504e47 || reader.readUInt32(4, false) != 0x0d0a1a0a)
|
|
994
|
+
return null;
|
|
995
|
+
let buff = reader.getArrayBuffer();
|
|
996
|
+
let b = new Blob([buff], {type: "image/png"});
|
|
997
|
+
let img = await media.loadImageFromBlob(b);
|
|
998
|
+
let simg = new media.StaticImage(img, sourceName, "image/png");
|
|
999
|
+
return simg;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
983
1002
|
/**
|
|
984
1003
|
* @param {data.ByteReader} reader
|
|
985
1004
|
* @param {string} sourceName
|
|
@@ -1300,6 +1319,7 @@ export async function parseFile(file)
|
|
|
1300
1319
|
{
|
|
1301
1320
|
let view = new data.ByteReader(await file.arrayBuffer());
|
|
1302
1321
|
let obj;
|
|
1322
|
+
if (obj = await parsePng(view, file.name)) return obj;
|
|
1303
1323
|
if (obj = await parseJpg(view, file.name)) return obj;
|
|
1304
1324
|
if (obj = await parseWebp(view, file.name)) return obj;
|
|
1305
1325
|
if (obj = parseX509(view, file.name, t)) return obj;
|
package/text.d.ts
CHANGED
|
@@ -56,6 +56,9 @@ export function replaceAll(s: string, replaceFrom: string, replaceTo: string): s
|
|
|
56
56
|
export function getEncList(): TextBinEnc[];
|
|
57
57
|
export function b64Enc(s: string, cs?: Base64Charset): string;
|
|
58
58
|
export function b64Dec(b64Str: string): string;
|
|
59
|
+
export function isDataURL(url: string): boolean;
|
|
60
|
+
export function escapeXhtml(s: string): string;
|
|
61
|
+
export function svgStringToDataURI(svg: string): string;
|
|
59
62
|
|
|
60
63
|
export class TextBinEnc
|
|
61
64
|
{
|
package/text.js
CHANGED
|
@@ -617,6 +617,30 @@ export function b64Dec(b64Str)
|
|
|
617
617
|
return dec.decode(b64.decodeBin(b64Str));
|
|
618
618
|
}
|
|
619
619
|
|
|
620
|
+
/**
|
|
621
|
+
* @param {string} url
|
|
622
|
+
*/
|
|
623
|
+
export function isDataURL(url)
|
|
624
|
+
{
|
|
625
|
+
return url.startsWith("data:");
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* @param {string} s
|
|
630
|
+
*/
|
|
631
|
+
export function escapeXhtml(s)
|
|
632
|
+
{
|
|
633
|
+
return s.replace(/#/g, '%23').replace(/\n/g, '%0A');
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* @param {string} svg
|
|
638
|
+
*/
|
|
639
|
+
export function svgStringToDataURI(svg)
|
|
640
|
+
{
|
|
641
|
+
return 'data:image/svg+xml;charset=utf-8,' + svg;
|
|
642
|
+
}
|
|
643
|
+
|
|
620
644
|
export class TextBinEnc
|
|
621
645
|
{
|
|
622
646
|
constructor(name)
|
package/web.d.ts
CHANGED
|
@@ -12,6 +12,14 @@ declare class ImageInfo
|
|
|
12
12
|
height: number;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
declare class PrintOptions
|
|
16
|
+
{
|
|
17
|
+
pageBorderTopHTML?: string;
|
|
18
|
+
pageBorderBottomHTML?: string;
|
|
19
|
+
overlayHTML?: string;
|
|
20
|
+
pageTitle?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
15
23
|
export enum OSType
|
|
16
24
|
{
|
|
17
25
|
Unknown,
|
|
@@ -88,6 +96,12 @@ export enum BrowserType
|
|
|
88
96
|
MiBrowser
|
|
89
97
|
}
|
|
90
98
|
|
|
99
|
+
export enum PaperOrientation
|
|
100
|
+
{
|
|
101
|
+
Landscape,
|
|
102
|
+
Portrait
|
|
103
|
+
}
|
|
104
|
+
|
|
91
105
|
declare class BrowserInfo
|
|
92
106
|
{
|
|
93
107
|
os: OSType;
|
|
@@ -118,6 +132,10 @@ export function getDivElement(id: string): HTMLDivElement;
|
|
|
118
132
|
export function getSpanElement(id: string): HTMLSpanElement;
|
|
119
133
|
export function getCanvasElement(id: string): HTMLCanvasElement;
|
|
120
134
|
export function getImgElement(id: string): HTMLImageElement;
|
|
135
|
+
export function canvasToBlob(canvas: HTMLCanvasElement): Promise<Blob|null>;
|
|
136
|
+
export function elementToSVGString(node: Element, width: string | number, height: string | number): string;
|
|
137
|
+
export function genPrintWindowHTML(imgDataURL: string, orientation: PaperOrientation, paperSize?: string, options: PrintOptions): string;
|
|
138
|
+
export function printImageData(imgDataURL: string, orientation: PaperOrientation, paperSize?: string, options: PrintOptions): void;
|
|
121
139
|
export function getBrowserInfo(): Promise<BrowserInfo>;
|
|
122
140
|
export function parseUserAgent(userAgent: string): BrowserInfo;
|
|
123
141
|
|
package/web.js
CHANGED
|
@@ -76,6 +76,11 @@ export const BrowserType = {
|
|
|
76
76
|
MiBrowser: "MiBrowser"
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
export const PaperOrientation = {
|
|
80
|
+
Landscape: "landscape",
|
|
81
|
+
Portrait: "portrait"
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
export function getRequestURLBase()
|
|
80
85
|
{
|
|
81
86
|
let url = document.location.href;
|
|
@@ -1057,6 +1062,101 @@ export function getImgElement(id)
|
|
|
1057
1062
|
throw new Error("Element with id \""+id+"\" is not an img");
|
|
1058
1063
|
}
|
|
1059
1064
|
|
|
1065
|
+
/**
|
|
1066
|
+
* @param {HTMLCanvasElement} canvas
|
|
1067
|
+
* @returns {Promise<Blob|null>}
|
|
1068
|
+
*/
|
|
1069
|
+
export async function canvasToBlob(canvas)
|
|
1070
|
+
{
|
|
1071
|
+
if (canvas.toBlob)
|
|
1072
|
+
{
|
|
1073
|
+
return await new Promise(function (resolve) {
|
|
1074
|
+
canvas.toBlob(resolve);
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
return data.dataURI2Blob(canvas.toDataURL());
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* @param {Element} node
|
|
1082
|
+
* @param {string | number} width
|
|
1083
|
+
* @param {string | number} height
|
|
1084
|
+
*/
|
|
1085
|
+
export function elementToSVGString(node, width, height)
|
|
1086
|
+
{
|
|
1087
|
+
node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
1088
|
+
let xhtml = text.escapeXhtml(new XMLSerializer().serializeToString(node));
|
|
1089
|
+
let foreignObject = '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>';
|
|
1090
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' + foreignObject + '</svg>';
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* @param {string} imgDataURL
|
|
1095
|
+
* @param {string} orientation
|
|
1096
|
+
* @param {string | null | undefined} paperSize
|
|
1097
|
+
* @param {{ pageBorderTopHTML?: string; pageBorderBottomHTML?: string; overlayHTML?: string; pageTitle?: string; }} options
|
|
1098
|
+
*/
|
|
1099
|
+
export function genPrintWindowHTML(imgDataURL, orientation, paperSize, options)
|
|
1100
|
+
{
|
|
1101
|
+
let strs = new Array();
|
|
1102
|
+
strs.push("<html><head>");
|
|
1103
|
+
if (options.pageTitle)
|
|
1104
|
+
{
|
|
1105
|
+
strs.push("<title>"+text.toHTMLText(options.pageTitle)+"</title>");
|
|
1106
|
+
}
|
|
1107
|
+
strs.push(`<style>@media print {
|
|
1108
|
+
img { max-width: 98%!important; max-height: 98%!important; }
|
|
1109
|
+
@page { size: ` + (paperSize?paperSize:'')+' '+ orientation + `;}}
|
|
1110
|
+
</style>
|
|
1111
|
+
<script>function step1(){
|
|
1112
|
+
setTimeout('step2()', 10);}
|
|
1113
|
+
function step2(){window.print();window.close()}
|
|
1114
|
+
</script></head><body onload='step1()' style="margin: 0px;">`);
|
|
1115
|
+
if (options.pageBorderTopHTML || options.pageBorderBottomHTML)
|
|
1116
|
+
{
|
|
1117
|
+
strs.push("<table border=\"0\" width=\"100%\" height=\"100%\">");
|
|
1118
|
+
if (options.pageBorderTopHTML)
|
|
1119
|
+
{
|
|
1120
|
+
strs.push("<tr><td>"+options.pageBorderTopHTML+"</td></tr>");
|
|
1121
|
+
}
|
|
1122
|
+
strs.push(`<tr><td>`);
|
|
1123
|
+
if (options.overlayHTML)
|
|
1124
|
+
strs.push(options.overlayHTML);
|
|
1125
|
+
strs.push(`<img src="` + imgDataURL + `" style="display:block; margin:auto;"></td></tr>`);
|
|
1126
|
+
if (options.pageBorderBottomHTML)
|
|
1127
|
+
{
|
|
1128
|
+
strs.push("<tr><td>"+options.pageBorderBottomHTML+"</td></tr>");
|
|
1129
|
+
}
|
|
1130
|
+
strs.push("</table>");
|
|
1131
|
+
}
|
|
1132
|
+
else
|
|
1133
|
+
{
|
|
1134
|
+
if (options.overlayHTML)
|
|
1135
|
+
strs.push(options.overlayHTML);
|
|
1136
|
+
strs.push(`<img src="` + imgDataURL + `" style="display:block; margin:auto;">`);
|
|
1137
|
+
}
|
|
1138
|
+
strs.push(`</body></html>`);
|
|
1139
|
+
return strs.join("");
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* @param {string} imgDataURL
|
|
1144
|
+
* @param {string} orientation
|
|
1145
|
+
* @param {string | null | undefined} paperSize
|
|
1146
|
+
* @param {{ pageBorderTopHTML?: string; pageBorderBottomHTML?: string; overlayHTML?: string }} options
|
|
1147
|
+
*/
|
|
1148
|
+
export function printImageData(imgDataURL, orientation, paperSize, options)
|
|
1149
|
+
{
|
|
1150
|
+
let page = window.open("", "_blank", 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10, top=10, width=600, height=800, visible=none');
|
|
1151
|
+
if (page == null)
|
|
1152
|
+
return false;
|
|
1153
|
+
let pageContent = genPrintWindowHTML(imgDataURL, orientation, paperSize, options);
|
|
1154
|
+
page.document.body.innerHTML = ''
|
|
1155
|
+
page.document.write(pageContent);
|
|
1156
|
+
page.document.close();
|
|
1157
|
+
return true;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1060
1160
|
/**
|
|
1061
1161
|
* @returns {Promise<{os: String,osVer?:string,browser: String,browserVer?: string,devName?:string}>}
|
|
1062
1162
|
*/
|