@archvisioninc/canvas 2.7.2 → 2.7.4

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.
@@ -563,7 +563,11 @@ const billboardScreenshot = view => {
563
563
  };
564
564
  export const takePreviewScreenshots = () => {
565
565
  // BUG: The first item from orthoOptions creates a blank screenshot.
566
- const orthoViews = ['perspective', ...Object.keys(orthoOptions).map(view => view)];
566
+ const orthoViews = Object.keys(orthoOptions).map(view => view);
567
+ const baseView = ['perspective'];
568
+ if (!props.materialMode) {
569
+ baseView.push(...orthoViews);
570
+ }
567
571
  const outerFrame = guiTexture.getControlByName(GUI.outerSafeFrame);
568
572
  const xAxisMesh = scene.getMeshByName('xAxisMesh');
569
573
  const yAxisMesh = scene.getMeshByName('yAxisMesh');
@@ -595,7 +599,7 @@ export const takePreviewScreenshots = () => {
595
599
  };
596
600
  toggleUI();
597
601
  try {
598
- const screenshots = orthoViews.map(async view => {
602
+ const screenshots = baseView.map(async view => {
599
603
  const imageData = await billboardScreenshot(view);
600
604
  return {
601
605
  name: view,
@@ -603,7 +607,7 @@ export const takePreviewScreenshots = () => {
603
607
  };
604
608
  });
605
609
  Promise.all(screenshots).then(screenshots => {
606
- const hasAllScreenshots = screenshots.length === orthoViews.length;
610
+ const hasAllScreenshots = screenshots.length === baseView.length;
607
611
  if (hasAllScreenshots) props.setBillboardImages?.(screenshots);
608
612
  screenshots.forEach(screenshot => {
609
613
  scene.getCameraByName(screenshot.name)?.dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -42,11 +42,11 @@
42
42
  "@testing-library/user-event": "^13.5.0",
43
43
  "@typescript-eslint/eslint-plugin": "^5.48.0",
44
44
  "axios": "^1.2.0",
45
- "babylonjs": "^6.32.1",
46
- "babylonjs-gui": "^6.32.1",
47
- "babylonjs-loaders": "^6.32.1",
48
- "babylonjs-materials": "^6.32.1",
49
- "babylonjs-serializers": "^6.32.1",
45
+ "babylonjs": "^6.33.2",
46
+ "babylonjs-gui": "^6.33.2",
47
+ "babylonjs-loaders": "^6.33.2",
48
+ "babylonjs-materials": "^6.33.2",
49
+ "babylonjs-serializers": "^6.33.2",
50
50
  "eslint-plugin-destructuring": "^2.2.1",
51
51
  "eslint-plugin-etc": "^2.0.2",
52
52
  "eslint-plugin-no-inline-styles": "^1.0.5",
@@ -623,7 +623,12 @@ const billboardScreenshot = view => {
623
623
 
624
624
  export const takePreviewScreenshots = () => {
625
625
  // BUG: The first item from orthoOptions creates a blank screenshot.
626
- const orthoViews = [ 'perspective', ...Object.keys(orthoOptions).map(view => view) ];
626
+ const orthoViews = Object.keys(orthoOptions).map(view => view);
627
+ const baseView = [ 'perspective' ];
628
+
629
+ if (!props.materialMode) {
630
+ baseView.push(...orthoViews);
631
+ }
627
632
 
628
633
  const outerFrame = guiTexture.getControlByName(GUI.outerSafeFrame);
629
634
  const xAxisMesh = scene.getMeshByName('xAxisMesh');
@@ -659,13 +664,13 @@ export const takePreviewScreenshots = () => {
659
664
  toggleUI();
660
665
 
661
666
  try {
662
- const screenshots = orthoViews.map(async view => {
667
+ const screenshots = baseView.map(async view => {
663
668
  const imageData = await billboardScreenshot(view);
664
669
  return { name: view, imageData };
665
670
  });
666
671
 
667
672
  Promise.all(screenshots).then(screenshots => {
668
- const hasAllScreenshots = screenshots.length === orthoViews.length;
673
+ const hasAllScreenshots = screenshots.length === baseView.length;
669
674
  if (hasAllScreenshots) props.setBillboardImages?.(screenshots);
670
675
 
671
676
  screenshots.forEach(screenshot => {
@@ -5,7 +5,7 @@ import { AppContainer, DebugButtons, Button } from './styles';
5
5
  import { theme } from 'static/theme';
6
6
  import { fetchDownloadURL } from 'helpers/fetchHelpers';
7
7
  import { ENVIRONMENTS } from 'constants';
8
- import { updateCamera, updateMaterial, scene } from 'package/helpers';
8
+ import { updateMaterial, scene } from 'package/helpers';
9
9
  import Canvas from 'package/Canvas';
10
10
  import _ from 'lodash';
11
11
 
@@ -84,7 +84,7 @@ const App = () => {
84
84
  const [ previewURL, setPreviewURL ] = useState(null);
85
85
  const [ selectedTheme, setSelectedTheme ] = useState('dark');
86
86
  const [ , setSerializedData ] = useState({});
87
- const [ exportModel ] = useState(false);
87
+ const [ exportModel, setExportModel ] = useState(false);
88
88
  const [ previewImage ] = useState(null);
89
89
  const [ billboardImages ] = useState([]);
90
90
  const guid = window.location.pathname.split('/')[1];
@@ -203,19 +203,10 @@ const App = () => {
203
203
  theme={theme}
204
204
  $selectedTheme={selectedTheme}
205
205
  onClick={() => {
206
- const inboundData = {
207
- payload: {
208
- takeScreenshot: true,
209
- aspectRatio: 1.33,
210
- imageDataOnly: true,
211
- },
212
- };
213
-
214
- updateCamera(inboundData);
215
- console.log({ screenshotData: scene.metadata?.screenshotData });
206
+ setExportModel(true);
216
207
  }}
217
208
  >
218
- Screenshot Data
209
+ Take screenshot
219
210
  </Button>
220
211
 
221
212
  <Button