jmapcloud-ng-types 1.0.10 → 1.0.11

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/index.ts CHANGED
@@ -357,7 +357,7 @@ export interface JAppPrintService {
357
357
  getFileType(): JAPP_PRINT_FILE_TYPES
358
358
  setHiResolution(isHiResolution: boolean): void
359
359
  getHiResolution(): boolean
360
- takeCapture(): void
360
+ takeCapture(returnAsScreenCaptureResult?: boolean): Promise<void | JAppPrintCaptureResult>
361
361
  }
362
362
 
363
363
  export interface JAppLayerService {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-types",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG types and interfaces",
5
5
  "main": "src/app.ts",
6
6
  "scripts": {
package/public/app.d.ts CHANGED
@@ -2407,15 +2407,37 @@ declare namespace JMap {
2407
2407
  /**
2408
2408
  * **JMap.Application.Print.takeCapture**
2409
2409
  *
2410
- * Builds print image and launches downwnload of the file
2410
+ * Builds a screen capture of the map and launches the download of the file, or returns the screen capture as a data url embeded in a {@link JAppPrintCaptureResult}
2411
+ * @param returnAsScreenCaptureResult if true, the method will resolve with a {@link JAppPrintCaptureResult} that you can use to embed the image in an HTML page, otherwise the method will resolve with no result
2412
+ *
2413
+ * When passing `returnAsScreenCaptureResult = true`, The screen capture process will take into account all Print parameters defined in the Print panel, including page format, scale, North arrow, title, sub-title, etc, but with the following limitations:
2414
+ *
2415
+ * * the image format returned will always be PNG
2416
+ * * If you want the Print panel overlays be present in the screen capture, you must programaticaly switch to the Print panel before calling JMap.Application.Print.takeCapture(true), otherwise only the map will be captured
2417
+ *
2411
2418
  *
2412
2419
  * @example
2413
2420
  * ```ts
2414
- * // build print image and launch downwnload of the file
2421
+ * // build print image and launch download of the file
2415
2422
  * JMap.Application.Print.takeCapture()
2423
+ *
2424
+ * // add an image to a document with the print result
2425
+ * JMap.Application.Print.takeCapture(true).then(
2426
+ * printCaptureResult => {
2427
+ * const img = document.createElement("img")
2428
+ * img.src = printCaptureResult.dataUrl
2429
+ * img.style.position = "absolute"
2430
+ * img.width = printCaptureResult.width / 4
2431
+ * img.height = printCaptureResult.height / 4
2432
+ * img.style.top = "10px"
2433
+ * img.style.left = "10px"
2434
+ * img.style.zIndex = 1000
2435
+ * document.body.appendChild(img)
2436
+ * }
2437
+ * )
2416
2438
  * ```
2417
2439
  */
2418
- function takeCapture(): void
2440
+ function takeCapture(returnAsScreenCaptureResult?: boolean): Promise<void | JAppPrintCaptureResult>
2419
2441
  }
2420
2442
 
2421
2443
  /**
package/public/print.d.ts CHANGED
@@ -25,3 +25,9 @@ declare interface JAppPaperFormat {
25
25
  height: number
26
26
  ratio: number
27
27
  }
28
+
29
+ declare interface JAppPrintCaptureResult {
30
+ height: number
31
+ width: number
32
+ dataUrl: string
33
+ }