@3dsource/metabox-front-api 1.2.1-dev.5 → 1.2.2-dev.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/README.md +68 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,19 +5,20 @@ This package provides an API for interacting with the Metabox Basic Configurator
|
|
|
5
5
|
### Installation (for using with frameworks like Angular, React, etc.) This is the recommended method
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install @3dsource/metabox-front-api@^1.2.1 --save
|
|
8
|
+
npm install @3dsource/metabox-front-api@^1.2.1-dev.5 --save
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
then
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { FromMetaboxApiAction,
|
|
14
|
+
import { FromMetaboxApiAction, GetScreenshot, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
**OR** work with direct import from `NPM` using `CDN` network `unpkg.com` or `jsdelivr.net` (you can also download
|
|
17
|
+
**OR** work with direct import from `NPM` using `CDN` network `unpkg.com` or `jsdelivr.net` (you can also download
|
|
18
|
+
package and use it locally):
|
|
18
19
|
|
|
19
20
|
```javascript
|
|
20
|
-
import { FromMetaboxApiAction,
|
|
21
|
+
import { FromMetaboxApiAction, GetScreenshot, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.1-dev.5';
|
|
21
22
|
```
|
|
22
23
|
|
|
23
24
|
## Usage
|
|
@@ -25,7 +26,8 @@ import { FromMetaboxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImag
|
|
|
25
26
|
### 1. Create HTML Structure
|
|
26
27
|
|
|
27
28
|
Ensure your HTML page has the following structure, where the Metabox Configurator will be integrated.
|
|
28
|
-
You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your
|
|
29
|
+
You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your
|
|
30
|
+
own.
|
|
29
31
|
|
|
30
32
|
```html
|
|
31
33
|
<div id="embed3DSource">
|
|
@@ -45,7 +47,7 @@ HTML:
|
|
|
45
47
|
|
|
46
48
|
```html
|
|
47
49
|
<script type="module">
|
|
48
|
-
import { integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu,
|
|
50
|
+
import { integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetScreenshot, GetPdf, saveImage, Communicator, FromMetaboxApiAction } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.1-dev.5';
|
|
49
51
|
|
|
50
52
|
class JsIntegrator {
|
|
51
53
|
constructor() {
|
|
@@ -75,7 +77,7 @@ HTML:
|
|
|
75
77
|
api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
|
|
76
78
|
api.sendCommandToMetaBox(new ShowOverlayInterface(false));
|
|
77
79
|
api.sendCommandToMetaBox(new GetPdf());
|
|
78
|
-
api.sendCommandToMetaBox(new
|
|
80
|
+
api.sendCommandToMetaBox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
|
|
@@ -86,7 +88,7 @@ HTML:
|
|
|
86
88
|
TypeScript:
|
|
87
89
|
|
|
88
90
|
```typescript
|
|
89
|
-
import { ConfiguratorEnvelope, UniversalConfigurator, integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu,
|
|
91
|
+
import { ConfiguratorEnvelope, UniversalConfigurator, integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetScreenshot, GetPdf, saveImage, Communicator, FromMetaboxApiAction } from '@3dsource/metabox-front-api';
|
|
90
92
|
|
|
91
93
|
class TsIntegrator {
|
|
92
94
|
constructor() {
|
|
@@ -116,7 +118,7 @@ class TsIntegrator {
|
|
|
116
118
|
api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
|
|
117
119
|
api.sendCommandToMetaBox(new ShowOverlayInterface(false));
|
|
118
120
|
api.sendCommandToMetaBox(new GetPdf());
|
|
119
|
-
api.sendCommandToMetaBox(new
|
|
121
|
+
api.sendCommandToMetaBox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
|
|
@@ -188,13 +190,13 @@ new TsIntegrator();
|
|
|
188
190
|
api.sendCommandToMetaBox(new ShowOverlayInterface(visible: boolean));
|
|
189
191
|
```
|
|
190
192
|
|
|
191
|
-
#### `
|
|
193
|
+
#### `GetScreenshot`
|
|
192
194
|
|
|
193
|
-
- **Description**: Retrieves a
|
|
195
|
+
- **Description**: Retrieves a screenshot/render of the current view.
|
|
194
196
|
- **Usage**:
|
|
195
197
|
|
|
196
198
|
```typescript
|
|
197
|
-
api.sendCommandToMetaBox(new
|
|
199
|
+
api.sendCommandToMetaBox(new GetScreenshot(mimeType: string, size?: { x: number, y: number }));
|
|
198
200
|
```
|
|
199
201
|
|
|
200
202
|
#### `GetPdf`
|
|
@@ -214,3 +216,57 @@ new TsIntegrator();
|
|
|
214
216
|
```typescript
|
|
215
217
|
saveImage(renderData: string, fileName: string): void;
|
|
216
218
|
```
|
|
219
|
+
|
|
220
|
+
#### `ResetCamera`
|
|
221
|
+
|
|
222
|
+
- **Description**: Resets the camera to its default position and rotation.
|
|
223
|
+
- **Usage**:
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
api.sendCommandToMetaBox(new ResetCamera());
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### `ApplyZoom`
|
|
230
|
+
|
|
231
|
+
- **Description**: Applies zoom to the camera view.
|
|
232
|
+
- **Usage**:
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
api.sendCommandToMetaBox(new ApplyZoom(zoom: number));
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### `InitShowcase`
|
|
239
|
+
|
|
240
|
+
- **Description**: Initializes a showcase with the given showcase ID.
|
|
241
|
+
- **Usage**:
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
api.sendCommandToMetaBox(new InitShowcase(showcaseId: string));
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### `PlayShowcase`
|
|
248
|
+
|
|
249
|
+
- **Description**: Plays the currently loaded showcase.
|
|
250
|
+
- **Usage**:
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
api.sendCommandToMetaBox(new PlayShowcase());
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### `PauseShowcase`
|
|
257
|
+
|
|
258
|
+
- **Description**: Pauses the currently playing showcase.
|
|
259
|
+
- **Usage**:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
api.sendCommandToMetaBox(new PauseShowcase());
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### `StopShowcase`
|
|
266
|
+
|
|
267
|
+
- **Description**: Stops the currently playing showcase.
|
|
268
|
+
- **Usage**:
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
api.sendCommandToMetaBox(new StopShowcase());
|
|
272
|
+
```
|