@archvisioninc/canvas 2.4.6 → 2.4.7

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.
@@ -1,7 +1,8 @@
1
+ /* eslint-disable */
1
2
  import * as BABYLON from 'babylonjs';
2
3
 
3
- // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused...
4
- // eslint-disable-next-line
4
+ // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused.
5
+ // eslint-disable-next-line no-unused-vars
5
6
  import { GLTFFileLoader } from 'babylonjs-loaders';
6
7
  import { reactProps as props } from '../Canvas';
7
8
  import { DRAG_DROP_FORMATS } from '../enums';
@@ -219,7 +220,21 @@ export const loadFromDragDrop = () => {
219
220
  const onProgress = null;
220
221
  const additionalRenderLoopLogic = null;
221
222
  const textureLoading = null;
222
- const startingProcessingFiles = () => checkSupportedFileTypes();
223
+ const startingProcessingFiles = () => {
224
+ const hasGuid = !_.isEmpty(props.guidURL);
225
+ if (hasGuid) {
226
+ const message = "This model has published data that can't be updated from a drag and drop operation. Use Create from gLTF to start a new file.";
227
+ const config = {
228
+ type: MESSAGE_TYPES.warning
229
+ };
230
+ props.addNotification?.([{
231
+ message,
232
+ config
233
+ }], clearExisting);
234
+ throw new Error(message);
235
+ }
236
+ checkSupportedFileTypes();
237
+ };
223
238
  const onReload = null;
224
239
  const onError = (file, scene, error) => {
225
240
  const missingBin = error.includes('.bin');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "2.4.6",
3
+ "version": "2.4.7",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -1,7 +1,8 @@
1
+ /* eslint-disable */
1
2
  import * as BABYLON from 'babylonjs';
2
3
 
3
- // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused...
4
- // eslint-disable-next-line
4
+ // GLTFFileLoader needs to be declared for the GLTF loader to work -- even if unused.
5
+ // eslint-disable-next-line no-unused-vars
5
6
  import { GLTFFileLoader } from 'babylonjs-loaders';
6
7
 
7
8
  import { reactProps as props } from '../Canvas';
@@ -235,15 +236,29 @@ let filesInput;
235
236
 
236
237
  export const loadFromDragDrop = () => {
237
238
  const handleCloseLoading = () => props.clearNotifications?.();
239
+
238
240
  const sceneLoaded = (file, newScene) => {
239
241
  const fileName = file.name.split('.').shift();
240
242
  initSceneFromFile(newScene, fileName);
241
243
  modelToOrigin();
242
244
  };
245
+
243
246
  const onProgress = null;
244
247
  const additionalRenderLoopLogic = null;
245
248
  const textureLoading = null;
246
- const startingProcessingFiles = () => checkSupportedFileTypes();
249
+ const startingProcessingFiles = () => {
250
+ const hasGuid = !_.isEmpty(props.guidURL);
251
+
252
+ if (hasGuid) {
253
+ const message = "This model has published data that can't be updated from a drag and drop operation. Use Create from gLTF to start a new file.";
254
+ const config = { type: MESSAGE_TYPES.warning };
255
+
256
+ props.addNotification?.([ { message, config } ], clearExisting);
257
+ throw new Error(message);
258
+ }
259
+
260
+ checkSupportedFileTypes();
261
+ };
247
262
  const onReload = null;
248
263
 
249
264
  const onError = (file, scene, error) => {