@epigraph/solutions 0.0.1-alpha → 0.0.4-alpha

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.
@@ -0,0 +1,12 @@
1
+ import "./HotspotsManager-mmFi8qV9.js";
2
+ import { E as g } from "./epigraph-viewer-7qd24J-r.js";
3
+ import "./epg-button-view-in-your-space-29ehH_AX.js";
4
+ import "./dimensions-manager.js";
5
+ import "./three.module-CYfxkCtM.js";
6
+ import "./epigraph-threed-core-oXi9QFHJ.js";
7
+ import "./baseUiComponent-_PPHqnvV.js";
8
+ import "./AppHelpers-DdbyrHJf.js";
9
+ import "./ObjectTransforms-D_d0xJKX.js";
10
+ export {
11
+ g as EpigraphViewer
12
+ };
@@ -0,0 +1,6 @@
1
+ import "./three.module-CYfxkCtM.js";
2
+ import { H as a } from "./HotspotsManager-mmFi8qV9.js";
3
+ import "./baseUiComponent-_PPHqnvV.js";
4
+ export {
5
+ a as HotspotsManager
6
+ };
@@ -0,0 +1,90 @@
1
+ import { C as c } from "./ObjectTransforms-D_d0xJKX.js";
2
+ import { A as i } from "./AppHelpers-DdbyrHJf.js";
3
+ import { bx as h } from "./three.module-CYfxkCtM.js";
4
+ class f extends h {
5
+ constructor(e) {
6
+ super({ appWcRef: e }), this._loggerContext = "SCREENSHOTS MANAGER", this._screenshots = /* @__PURE__ */ new Map(), window.epigraph.logger.info({
7
+ title: "Initialising...",
8
+ contextOverride: this._loggerContext
9
+ });
10
+ }
11
+ /**
12
+ * Clears out all existing screenshots from memory.
13
+ * TODO: Make sure this even deletes all references of the blobs moving forward.
14
+ */
15
+ clearAllScreenshots() {
16
+ for (const e of this._screenshots.values())
17
+ URL.revokeObjectURL(e);
18
+ this._screenshots.clear();
19
+ }
20
+ /**
21
+ * Converts and return a Blob URL for a given data URL.
22
+ *
23
+ * @param {string} dataurl The raw data url that has a valid mime type within.
24
+ * @returns {string} Generated Blob Url.
25
+ */
26
+ dataURLtoBlob(e) {
27
+ const s = e.split(","), n = s[0].match(/:(.*?);/);
28
+ if (!n)
29
+ return "";
30
+ const t = n[1], r = atob(s[1]);
31
+ let a = r.length;
32
+ const o = new Uint8Array(a);
33
+ for (; a--; )
34
+ o[a] = r.charCodeAt(a);
35
+ return new Blob([o], { type: t });
36
+ }
37
+ /**
38
+ * Gets a screenshot of the scene from the current view.
39
+ *
40
+ * @returns {string} An in memory URL of the screenshot that was generated from the scene.
41
+ */
42
+ getScreenshotForCamera() {
43
+ let e = "";
44
+ if (!this._appWcRef.renderEngine.screenshotRenderer)
45
+ return e;
46
+ const { width: s, height: n } = this._appWcRef.getCanvasSize();
47
+ this._appWcRef.renderEngine.screenshotRenderer.setSize(s, n), this._appWcRef.renderScreenshotCanvasFrame();
48
+ const t = this._appWcRef.renderEngine.screenshotRenderer.domElement.toDataURL(
49
+ "image/png"
50
+ ), r = this.dataURLtoBlob(t);
51
+ return r && (e = URL.createObjectURL(r)), e;
52
+ }
53
+ /**
54
+ * Loops over every camera config provided unser experienceSettings.screenshotCameras
55
+ * and returns a URL for each one of them.
56
+ *
57
+ * @returns {IScreenshotsCollection} A collections of all URLs generated for the screenshots.
58
+ */
59
+ async getAllPredefinedScreenshots(e) {
60
+ if (e) {
61
+ this.clearAllScreenshots();
62
+ for (const [s, n] of Object.entries(e)) {
63
+ const t = new c(n);
64
+ if (!t.getPosition() || !t.getTarget())
65
+ continue;
66
+ await this._appWcRef.cameraManager.moveCameraToLocation({
67
+ newCameraTransforms: t
68
+ }), this._appWcRef.cameraManager.screenshotCameraControls.update(
69
+ this._appWcRef.renderEngine.getClockDelta()
70
+ ), await i.wait(20);
71
+ const r = this.getScreenshotForCamera();
72
+ this._screenshots.set(s, r);
73
+ }
74
+ return this._screenshots;
75
+ }
76
+ }
77
+ /**
78
+ * Return all the screenshots currently available in memory.
79
+ * This could be used, if the scene hasn't changed
80
+ * but we still need the last generated screenshot for a use case.
81
+ *
82
+ * @returns {IScreenshotsCollection} A collections of all URLs generated for the screenshots.
83
+ */
84
+ getAllScreenshots() {
85
+ return this._screenshots;
86
+ }
87
+ }
88
+ export {
89
+ f as ScreenshotsManager
90
+ };