@vived/app 2.46.2 → 2.47.1

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.
@@ -6,6 +6,21 @@ export interface ScenePick {
6
6
  worldPickPoint?: Vector3;
7
7
  objectPickMeta?: object;
8
8
  }
9
+ export interface IScreenshotSize {
10
+ /**
11
+ * number in pixels for canvas height
12
+ */
13
+ height?: number;
14
+ /**
15
+ * multiplier allowing render at a higher or lower resolution
16
+ * If value is defined then height and width will be ignored and taken from camera
17
+ */
18
+ precision?: number;
19
+ /**
20
+ * number in pixels for canvas width
21
+ */
22
+ width?: number;
23
+ }
9
24
  export interface Babylon {
10
25
  engine: unknown;
11
26
  scene: unknown;
@@ -18,6 +33,7 @@ export interface Babylon {
18
33
  scenePixelPick: (pixelPos: Vector2) => ScenePick | undefined;
19
34
  sceneObjectRayPick: (ray: ParametricLine) => string | undefined;
20
35
  sceneObjectPixelPick: (pixelPos: Vector2) => string | undefined;
36
+ captureScreenshot: (size: IScreenshotSize | number) => Promise<Blob>;
21
37
  makeSceneObjectMeta: (id: string) => object;
22
38
  updateCanvasSize: () => void;
23
39
  submitRenderCanvas: (canvas: HTMLCanvasElement) => void;
@@ -80,6 +80,9 @@ class BabylonImp {
80
80
  this.sceneRayPick = (ray) => {
81
81
  throw new Error("Scene ray pick has not been injected");
82
82
  };
83
+ this.captureScreenshot = (size = 512) => {
84
+ throw new Error("CaptureScreenshot has not been injected");
85
+ };
83
86
  this.sceneObjectRayPick = (ray) => {
84
87
  try {
85
88
  const pick = this.sceneRayPick(ray);
@@ -0,0 +1,15 @@
1
+ import { SceneModelRepo } from "../../Entities";
2
+ import { PresentionManager } from "../PresentationManager";
3
+ export interface SceneModelVM {
4
+ activeSceneModelID: string;
5
+ isLoading: boolean;
6
+ }
7
+ export declare class SceneModelPM extends PresentionManager {
8
+ private sceneModelRepo;
9
+ private updateView;
10
+ private previousVM?;
11
+ doUpdateView: () => void;
12
+ private vmHasChanged;
13
+ constructor(sceneModelRepo: SceneModelRepo, updateView: (vm: SceneModelVM) => void);
14
+ }
15
+ export declare const defaultSceneModelVM: SceneModelVM;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultSceneModelVM = exports.SceneModelPM = void 0;
4
+ const PresentationManager_1 = require("../PresentationManager");
5
+ class SceneModelPM extends PresentationManager_1.PresentionManager {
6
+ constructor(sceneModelRepo, updateView) {
7
+ super(sceneModelRepo);
8
+ this.sceneModelRepo = sceneModelRepo;
9
+ this.updateView = updateView;
10
+ this.doUpdateView = () => {
11
+ const sceneModelID = this.sceneModelRepo.activeModelID;
12
+ const vm = {
13
+ activeSceneModelID: sceneModelID,
14
+ isLoading: this.sceneModelRepo.isLoadingSceneModel,
15
+ };
16
+ if (!this.vmHasChanged(vm))
17
+ return;
18
+ this.updateView(vm);
19
+ this.previousVM = vm;
20
+ };
21
+ this.doUpdateView();
22
+ }
23
+ vmHasChanged(vm) {
24
+ if (this.previousVM === undefined)
25
+ return true;
26
+ if (this.previousVM.activeSceneModelID !== vm.activeSceneModelID ||
27
+ this.previousVM.isLoading !== vm.isLoading)
28
+ return true;
29
+ return false;
30
+ }
31
+ }
32
+ exports.SceneModelPM = SceneModelPM;
33
+ exports.defaultSceneModelVM = {
34
+ isLoading: false,
35
+ activeSceneModelID: "",
36
+ };
@@ -0,0 +1 @@
1
+ export * from "./SceneModelPM";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./SceneModelPM"), exports);
@@ -6,6 +6,7 @@ export * from "./ShowBabylonInspectorPM";
6
6
  export * from "./HasRedoPM";
7
7
  export * from "./HasUndoPM";
8
8
  export * from "./QuestionChallenge";
9
+ export * from "./SceneModel";
9
10
  export * from "./SceneObject";
10
11
  export * from "./ToolPM";
11
12
  export * from "./TransformNodePM";
@@ -18,6 +18,7 @@ __exportStar(require("./ShowBabylonInspectorPM"), exports);
18
18
  __exportStar(require("./HasRedoPM"), exports);
19
19
  __exportStar(require("./HasUndoPM"), exports);
20
20
  __exportStar(require("./QuestionChallenge"), exports);
21
+ __exportStar(require("./SceneModel"), exports);
21
22
  __exportStar(require("./SceneObject"), exports);
22
23
  __exportStar(require("./ToolPM"), exports);
23
24
  __exportStar(require("./TransformNodePM"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "2.46.2",
3
+ "version": "2.47.1",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",