@gradio/model3d 0.4.12 → 0.4.13

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @gradio/model3d
2
2
 
3
+ ## 0.4.13
4
+
5
+ ### Fixes
6
+
7
+ - [#6871](https://github.com/gradio-app/gradio/pull/6871) [`d361a0f`](https://github.com/gradio-app/gradio/commit/d361a0f179752d9e849ec420fc67c8b4060fc154) - Ensure camera settings only update when necessary in Model3D. Thanks [@hannahblair](https://github.com/hannahblair)!
8
+
3
9
  ## 0.4.12
4
10
 
5
11
  ### Patch Changes
@@ -248,4 +254,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
248
254
 
249
255
  - Updated dependencies []:
250
256
  - @gradio/atoms@0.0.2
251
- - @gradio/upload@0.0.2
257
+ - @gradio/upload@0.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/model3d",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -10,12 +10,13 @@
10
10
  "@types/babylon": "^6.16.6",
11
11
  "babylonjs": "^4.2.1",
12
12
  "babylonjs-loaders": "^4.2.1",
13
+ "dequal": "^2.0.2",
13
14
  "@gradio/atoms": "^0.4.1",
14
- "@gradio/client": "^0.9.4",
15
+ "@gradio/client": "^0.10.0",
16
+ "@gradio/icons": "^0.3.2",
15
17
  "@gradio/statustracker": "^0.4.3",
16
- "@gradio/upload": "^0.5.7",
17
- "@gradio/utils": "^0.2.0",
18
- "@gradio/icons": "^0.3.2"
18
+ "@gradio/upload": "^0.5.8",
19
+ "@gradio/utils": "^0.2.0"
19
20
  },
20
21
  "main_changeset": true,
21
22
  "main": "./Index.svelte",
@@ -7,6 +7,7 @@
7
7
  import * as BABYLON from "babylonjs";
8
8
  import * as BABYLON_LOADERS from "babylonjs-loaders";
9
9
  import type { I18nFormatter } from "@gradio/utils";
10
+ import { dequal } from "dequal";
10
11
 
11
12
  export let value: FileData | null;
12
13
  export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
@@ -15,7 +16,6 @@
15
16
  export let i18n: I18nFormatter;
16
17
  export let zoom_speed = 1;
17
18
  export let pan_speed = 1;
18
-
19
19
  // alpha, beta, radius
20
20
  export let camera_position: [number | null, number | null, number | null] = [
21
21
  null,
@@ -23,6 +23,8 @@
23
23
  null
24
24
  ];
25
25
 
26
+ let current_settings = { camera_position, zoom_speed, pan_speed };
27
+
26
28
  $: {
27
29
  if (
28
30
  BABYLON_LOADERS.OBJFileLoader != undefined &&
@@ -80,8 +82,17 @@
80
82
  reset_camera_position(scene, camera_position, zoom_speed, pan_speed);
81
83
  }
82
84
 
83
- $: if (scene)
84
- reset_camera_position(scene, camera_position, zoom_speed, pan_speed);
85
+ $: {
86
+ if (
87
+ scene &&
88
+ (!dequal(current_settings.camera_position, camera_position) ||
89
+ current_settings.zoom_speed !== zoom_speed ||
90
+ current_settings.pan_speed !== pan_speed)
91
+ ) {
92
+ reset_camera_position(scene, camera_position, zoom_speed, pan_speed);
93
+ current_settings = { camera_position, zoom_speed, pan_speed };
94
+ }
95
+ }
85
96
  </script>
86
97
 
87
98
  <BlockLabel