瀏覽代碼

code review

Falko Schindler 1 年之前
父節點
當前提交
9c52edd4f7

+ 2 - 6
nicegui/elements/scene.js

@@ -249,13 +249,9 @@ export default {
         mesh = new THREE.Group();
         this.gltf_loader.load(
           url,
-          (gltf) => {
-            mesh.add(gltf.scene);
-          },
+          (gltf) => mesh.add(gltf.scene),
           undefined,
-          (error) => {
-            console.error(error);
-          }
+          (error) => console.error(error)
         );
       } else {
         let geometry;

+ 1 - 1
nicegui/elements/scene_objects.py

@@ -182,7 +182,7 @@ class Gltf(Object3D):
                  ) -> None:
         """GLTF
 
-        This element is used to create a mesh from an glTF file.
+        This element is used to create a mesh from a glTF file.
 
         :param url: URL of the glTF file
         """

+ 4 - 4
website/documentation/content/scene_documentation.py

@@ -8,7 +8,7 @@ def main_demo() -> None:
     with ui.scene().classes('w-full h-64') as scene:
         scene.sphere().material('#4488ff')
         scene.cylinder(1, 0.5, 2, 20).material('#ff8800', opacity=0.5).move(-2, 1)
-        scene.extrusion([[0, 0], [0, 1], [1, 0.5]], 0.1).material('#ff8888').move(-2, -2)
+        scene.extrusion([[0, 0], [0, 1], [1, 0.5]], 0.1).material('#ff8888').move(2, -1)
 
         with scene.group().move(z=2):
             scene.box().move(x=2)
@@ -16,17 +16,17 @@ def main_demo() -> None:
             scene.box(wireframe=True).material('#888888').move(x=2, y=2)
 
         scene.line([-4, 0, 0], [-4, 2, 0]).material('#ff0000')
-        scene.curve([-4, 0, 0], [-4, -1, 0], [-3, -1, 0], [-3, -2, 0]).material('#008800')
+        scene.curve([-4, 0, 0], [-4, -1, 0], [-3, -1, 0], [-3, 0, 0]).material('#008800')
 
         logo = 'https://avatars.githubusercontent.com/u/2843826'
         scene.texture(logo, [[[0.5, 2, 0], [2.5, 2, 0]],
-                             [[0.5, 0, 0], [2.5, 0, 0]]]).move(1, -2)
+                             [[0.5, 0, 0], [2.5, 0, 0]]]).move(1, -3)
 
         teapot = 'https://upload.wikimedia.org/wikipedia/commons/9/93/Utah_teapot_(solid).stl'
         scene.stl(teapot).scale(0.2).move(-3, 4)
 
         avocado = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Avocado/glTF-Binary/Avocado.glb'
-        scene.gltf(avocado).scale(40).move(-6, 0)
+        scene.gltf(avocado).scale(40).move(-2, -3, 0.5)
 
         scene.text('2D', 'background: rgba(0, 0, 0, 0.2); border-radius: 5px; padding: 5px').move(z=2)
         scene.text3d('3D', 'background: rgba(0, 0, 0, 0.2); border-radius: 5px; padding: 5px').move(y=-2).scale(.05)