@gradio/model3d 0.3.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,38 +1,53 @@
1
1
  # @gradio/model3d
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Features
6
+
7
+ - [#6240](https://github.com/gradio-app/gradio/pull/6240) [`dd901c1b0`](https://github.com/gradio-app/gradio/commit/dd901c1b0af73a78fca8b6875b2bb00f84071ac8) - Model3D panning, improved UX. Thanks [@dylanebert](https://github.com/dylanebert)!
8
+ - [#6255](https://github.com/gradio-app/gradio/pull/6255) [`e3ede2ff7`](https://github.com/gradio-app/gradio/commit/e3ede2ff7d4a36fb21bb0b146b8d5ad239c0e086) - Ensure Model 3D updates when attributes change. Thanks [@hannahblair](https://github.com/hannahblair)!
9
+
10
+ ## 0.3.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`2ba14b284`](https://github.com/gradio-app/gradio/commit/2ba14b284f908aa13859f4337167a157075a68eb)]:
15
+ - @gradio/client@0.7.1
16
+ - @gradio/upload@0.3.1
17
+
3
18
  ## 0.3.0
4
19
 
5
20
  ### Features
6
21
 
7
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
8
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Clean root url. Thanks [@pngwn](https://github.com/pngwn)!
9
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
10
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Publish all components to npm. Thanks [@pngwn](https://github.com/pngwn)!
11
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Custom components. Thanks [@pngwn](https://github.com/pngwn)!
12
- - [#6171](https://github.com/gradio-app/gradio/pull/6171) [`28322422c`](https://github.com/gradio-app/gradio/commit/28322422cb9d8d3e471e439ad602959662e79312) - strip dangling svelte imports. Thanks [@pngwn](https://github.com/pngwn)!
22
+ - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
23
+ - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Clean root url. Thanks [@pngwn](https://github.com/pngwn)!
24
+ - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
25
+ - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Publish all components to npm. Thanks [@pngwn](https://github.com/pngwn)!
26
+ - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Custom components. Thanks [@pngwn](https://github.com/pngwn)!
27
+ - [#6171](https://github.com/gradio-app/gradio/pull/6171) [`28322422c`](https://github.com/gradio-app/gradio/commit/28322422cb9d8d3e471e439ad602959662e79312) - strip dangling svelte imports. Thanks [@pngwn](https://github.com/pngwn)!
13
28
 
14
29
  ## 0.3.0-beta.8
15
30
 
16
31
  ### Features
17
32
 
18
- - [#6143](https://github.com/gradio-app/gradio/pull/6143) [`e4f7b4b40`](https://github.com/gradio-app/gradio/commit/e4f7b4b409323b01aa01b39e15ce6139e29aa073) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
19
- - [#6136](https://github.com/gradio-app/gradio/pull/6136) [`667802a6c`](https://github.com/gradio-app/gradio/commit/667802a6cdbfb2ce454a3be5a78e0990b194548a) - JS Component Documentation. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
20
- - [#6094](https://github.com/gradio-app/gradio/pull/6094) [`c476bd5a5`](https://github.com/gradio-app/gradio/commit/c476bd5a5b70836163b9c69bf4bfe068b17fbe13) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
21
- - [#6149](https://github.com/gradio-app/gradio/pull/6149) [`90318b1dd`](https://github.com/gradio-app/gradio/commit/90318b1dd118ae08a695a50e7c556226234ab6dc) - swap `mode` on the frontned to `interactive` to match the backend. Thanks [@pngwn](https://github.com/pngwn)!
33
+ - [#6143](https://github.com/gradio-app/gradio/pull/6143) [`e4f7b4b40`](https://github.com/gradio-app/gradio/commit/e4f7b4b409323b01aa01b39e15ce6139e29aa073) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
34
+ - [#6136](https://github.com/gradio-app/gradio/pull/6136) [`667802a6c`](https://github.com/gradio-app/gradio/commit/667802a6cdbfb2ce454a3be5a78e0990b194548a) - JS Component Documentation. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
35
+ - [#6094](https://github.com/gradio-app/gradio/pull/6094) [`c476bd5a5`](https://github.com/gradio-app/gradio/commit/c476bd5a5b70836163b9c69bf4bfe068b17fbe13) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
36
+ - [#6149](https://github.com/gradio-app/gradio/pull/6149) [`90318b1dd`](https://github.com/gradio-app/gradio/commit/90318b1dd118ae08a695a50e7c556226234ab6dc) - swap `mode` on the frontned to `interactive` to match the backend. Thanks [@pngwn](https://github.com/pngwn)!
22
37
 
23
38
  ## 0.3.0-beta.7
24
39
 
25
40
  ### Features
26
41
 
27
- - [#6016](https://github.com/gradio-app/gradio/pull/6016) [`83e947676`](https://github.com/gradio-app/gradio/commit/83e947676d327ca2ab6ae2a2d710c78961c771a0) - Format js in v4 branch. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
28
- - [#5955](https://github.com/gradio-app/gradio/pull/5955) [`825c9cddc`](https://github.com/gradio-app/gradio/commit/825c9cddc83a09457d8c85ebeecb4bc705572d82) - Fix dev mode model3D. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
42
+ - [#6016](https://github.com/gradio-app/gradio/pull/6016) [`83e947676`](https://github.com/gradio-app/gradio/commit/83e947676d327ca2ab6ae2a2d710c78961c771a0) - Format js in v4 branch. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
43
+ - [#5955](https://github.com/gradio-app/gradio/pull/5955) [`825c9cddc`](https://github.com/gradio-app/gradio/commit/825c9cddc83a09457d8c85ebeecb4bc705572d82) - Fix dev mode model3D. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
29
44
 
30
45
  ## 0.3.0-beta.6
31
46
 
32
47
  ### Features
33
48
 
34
- - [#5960](https://github.com/gradio-app/gradio/pull/5960) [`319c30f3f`](https://github.com/gradio-app/gradio/commit/319c30f3fccf23bfe1da6c9b132a6a99d59652f7) - rererefactor frontend files. Thanks [@pngwn](https://github.com/pngwn)!
35
- - [#5938](https://github.com/gradio-app/gradio/pull/5938) [`13ed8a485`](https://github.com/gradio-app/gradio/commit/13ed8a485d5e31d7d75af87fe8654b661edcca93) - V4: Use beta release versions for '@gradio' packages. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
49
+ - [#5960](https://github.com/gradio-app/gradio/pull/5960) [`319c30f3f`](https://github.com/gradio-app/gradio/commit/319c30f3fccf23bfe1da6c9b132a6a99d59652f7) - rererefactor frontend files. Thanks [@pngwn](https://github.com/pngwn)!
50
+ - [#5938](https://github.com/gradio-app/gradio/pull/5938) [`13ed8a485`](https://github.com/gradio-app/gradio/commit/13ed8a485d5e31d7d75af87fe8654b661edcca93) - V4: Use beta release versions for '@gradio' packages. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
36
51
 
37
52
  ## 0.2.5
38
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/model3d",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -11,10 +11,10 @@
11
11
  "babylonjs": "^4.2.1",
12
12
  "babylonjs-loaders": "^4.2.1",
13
13
  "@gradio/atoms": "^0.2.0",
14
- "@gradio/client": "^0.7.0",
14
+ "@gradio/client": "^0.7.1",
15
15
  "@gradio/icons": "^0.2.0",
16
16
  "@gradio/statustracker": "^0.3.0",
17
- "@gradio/upload": "^0.3.0",
17
+ "@gradio/upload": "^0.3.2",
18
18
  "@gradio/utils": "^0.2.0"
19
19
  },
20
20
  "main_changeset": true,
@@ -14,6 +14,7 @@
14
14
  export let show_label: boolean;
15
15
  export let i18n: I18nFormatter;
16
16
  export let zoom_speed = 1;
17
+ export let pan_speed = 1;
17
18
 
18
19
  // alpha, beta, radius
19
20
  export let camera_position: [number | null, number | null, number | null] = [
@@ -69,14 +70,18 @@
69
70
  value,
70
71
  clear_color,
71
72
  camera_position,
72
- zoom_speed
73
+ zoom_speed,
74
+ pan_speed
73
75
  );
74
76
  }
75
77
  }
76
78
 
77
79
  function handle_undo(): void {
78
- reset_camera_position(scene, camera_position, zoom_speed);
80
+ reset_camera_position(scene, camera_position, zoom_speed, pan_speed);
79
81
  }
82
+
83
+ $: if (scene)
84
+ reset_camera_position(scene, camera_position, zoom_speed, pan_speed);
80
85
  </script>
81
86
 
82
87
  <BlockLabel
@@ -13,6 +13,7 @@
13
13
  export let root: string;
14
14
  export let i18n: I18nFormatter;
15
15
  export let zoom_speed = 1;
16
+ export let pan_speed = 1;
16
17
 
17
18
  // alpha, beta, radius
18
19
  export let camera_position: [number | null, number | null, number | null] = [
@@ -34,7 +35,8 @@
34
35
  value,
35
36
  clear_color,
36
37
  camera_position,
37
- zoom_speed
38
+ zoom_speed,
39
+ pan_speed
38
40
  );
39
41
  }
40
42
 
@@ -71,7 +73,7 @@
71
73
  }
72
74
 
73
75
  async function handle_undo(): Promise<void> {
74
- reset_camera_position(scene, camera_position, zoom_speed);
76
+ reset_camera_position(scene, camera_position, zoom_speed, pan_speed);
75
77
  }
76
78
 
77
79
  const dispatch = createEventDispatcher<{
package/shared/utils.ts CHANGED
@@ -4,7 +4,8 @@ import * as BABYLON from "babylonjs";
4
4
  const create_camera = (
5
5
  scene: BABYLON.Scene,
6
6
  camera_position: [number | null, number | null, number | null],
7
- zoom_speed: number
7
+ zoom_speed: number,
8
+ pan_speed: number
8
9
  ): void => {
9
10
  scene.createDefaultCamera(true, true, true);
10
11
  var helperCamera = scene.activeCamera! as BABYLON.ArcRotateCamera;
@@ -17,11 +18,14 @@ const create_camera = (
17
18
  if (camera_position[2] !== null) {
18
19
  helperCamera.radius = camera_position[2];
19
20
  }
20
- // Disable panning. Adapted from: https://playground.babylonjs.com/#4U6TVQ#3
21
- helperCamera.panningSensibility = 0;
22
- helperCamera.attachControl(false, false, -1);
23
- helperCamera.pinchToPanMaxDistance = 0;
24
- helperCamera.wheelPrecision = 2500 / zoom_speed;
21
+ helperCamera.lowerRadiusLimit = 0.1;
22
+ const updateCameraSensibility = (): void => {
23
+ helperCamera.wheelPrecision = 250 / (helperCamera.radius * zoom_speed);
24
+ helperCamera.panningSensibility = (10000 * pan_speed) / helperCamera.radius;
25
+ };
26
+ updateCameraSensibility();
27
+ helperCamera.attachControl(true);
28
+ helperCamera.onAfterCheckInputsObservable.add(updateCameraSensibility);
25
29
  };
26
30
 
27
31
  export const add_new_model = (
@@ -31,7 +35,8 @@ export const add_new_model = (
31
35
  value: FileData | null,
32
36
  clear_color: [number, number, number, number],
33
37
  camera_position: [number | null, number | null, number | null],
34
- zoom_speed: number
38
+ zoom_speed: number,
39
+ pan_speed: number
35
40
  ): BABYLON.Scene => {
36
41
  if (scene && !scene.isDisposed && engine) {
37
42
  scene.dispose();
@@ -61,7 +66,7 @@ export const add_new_model = (
61
66
  url,
62
67
  "",
63
68
  scene,
64
- () => create_camera(scene, camera_position, zoom_speed),
69
+ () => create_camera(scene, camera_position, zoom_speed, pan_speed),
65
70
  undefined,
66
71
  undefined,
67
72
  "." + value.path.split(".")[1]
@@ -72,8 +77,9 @@ export const add_new_model = (
72
77
  export const reset_camera_position = (
73
78
  scene: BABYLON.Scene,
74
79
  camera_position: [number | null, number | null, number | null],
75
- zoom_speed: number
80
+ zoom_speed: number,
81
+ pan_speed: number
76
82
  ): void => {
77
83
  scene.removeCamera(scene.activeCamera!);
78
- create_camera(scene, camera_position, zoom_speed);
84
+ create_camera(scene, camera_position, zoom_speed, pan_speed);
79
85
  };