Procházet zdrojové kódy

Merge pull request #9708 from jasonsturges/doc/gizmos

Gizmos documentation
sebavan před 4 roky
rodič
revize
dcc93388b3

+ 1 - 1
src/Gizmos/axisDragGizmo.ts

@@ -132,7 +132,7 @@ export class AxisDragGizmo extends Gizmo {
                         (this.attachedNode as any).position.addInPlaceFromFloats(event.delta.x, event.delta.y, event.delta.z);
                     }
 
-                    // use _worldMatrix to not force a matrix update when calling GetWorldMatrix especialy with Cameras
+                    // use _worldMatrix to not force a matrix update when calling GetWorldMatrix especially with Cameras
                     this.attachedNode.getWorldMatrix().addTranslationFromFloats(event.delta.x, event.delta.y, event.delta.z);
                     this.attachedNode.updateCache();
                 } else {

+ 1 - 1
src/Gizmos/axisScaleGizmo.ts

@@ -85,7 +85,7 @@ export class AxisScaleGizmo extends Gizmo {
         this._rootMesh.addChild(this._gizmoMesh);
         this._gizmoMesh.scaling.scaleInPlace(1 / 3);
 
-        // Closure of inital prop values for resetting
+        // Closure of initial prop values for resetting
         const nodePosition = arrowMesh.position.clone();
         const linePosition = arrowTail.position.clone();
         const lineScale = arrowTail.scaling.clone();

+ 6 - 6
src/Gizmos/boundingBoxGizmo.ts

@@ -36,7 +36,7 @@ export class BoundingBoxGizmo extends Gizmo {
     private _tmpVector = new Vector3(0, 0, 0);
     private _tmpRotationMatrix = new Matrix();
     /**
-     * If child meshes should be ignored when calculating the boudning box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)
+     * If child meshes should be ignored when calculating the bounding box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)
      */
     public ignoreChildren = false;
     /**
@@ -355,7 +355,7 @@ export class BoundingBoxGizmo extends Gizmo {
 
         // Update bounding box positions
         this._renderObserver = this.gizmoLayer.originalScene.onBeforeRenderObservable.add(() => {
-            // Only update the bouding box if scaling has changed
+            // Only update the bounding box if scaling has changed
             if (this.attachedMesh && !this._existingMeshScale.equals(this.attachedMesh.scaling)) {
                 this.updateBoundingBox();
             } else if (this.fixedDragMeshScreenSize || this.fixedDragMeshBoundsSize) {
@@ -363,7 +363,7 @@ export class BoundingBoxGizmo extends Gizmo {
                 this._updateScaleBoxes();
             }
 
-            // If dragg mesh is enabled and dragging, update the attached mesh pose to match the drag mesh
+            // If drag mesh is enabled and dragging, update the attached mesh pose to match the drag mesh
             if (this._dragMesh && this.attachedMesh && this.pointerDragBehavior.dragging) {
                 this._lineBoundingBox.position.rotateByQuaternionToRef(this._rootMesh.rotationQuaternion!, this._tmpVector);
                 this.attachedMesh.setAbsolutePosition(this._dragMesh.position.add(this._tmpVector.scale(-1)));
@@ -412,7 +412,7 @@ export class BoundingBoxGizmo extends Gizmo {
             var originalParent = this.attachedMesh.parent;
             this.attachedMesh.setParent(null);
 
-            // Store original skelton override mesh
+            // Store original skeleton override mesh
             var originalSkeletonOverrideMesh = null;
             if (this.attachedMesh.skeleton) {
                 originalSkeletonOverrideMesh = this.attachedMesh.skeleton.overrideMesh;
@@ -560,7 +560,7 @@ export class BoundingBoxGizmo extends Gizmo {
     public setEnabledScaling(enable: boolean, homogeneousScaling = false) {
         this._scaleBoxesParent.getChildMeshes().forEach((m, i) => {
             let enableMesh = enable;
-            // Disable heterogenous scale handles if requested.
+            // Disable heterogeneous scale handles if requested.
             if (homogeneousScaling && m.metadata === true) {
                 enableMesh = false;
             }
@@ -616,7 +616,7 @@ export class BoundingBoxGizmo extends Gizmo {
         };
         makeNotPickable(mesh);
 
-        // Reset position to get boudning box from origin with no rotation
+        // Reset position to get bounding box from origin with no rotation
         if (!mesh.rotationQuaternion) {
             mesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(mesh.rotation.y, mesh.rotation.x, mesh.rotation.z);
         }

+ 4 - 4
src/Gizmos/gizmo.ts

@@ -19,15 +19,15 @@ import { LinesMesh } from '../Meshes/linesMesh';
  * Cache built by each axis. Used for managing state between all elements of gizmo for enhanced UI
  */
 export interface GizmoAxisCache {
-    /** Mesh used to runder the Gizmo */
+    /** Mesh used to render the Gizmo */
     gizmoMeshes: Mesh[];
     /** Mesh used to detect user interaction with Gizmo */
     colliderMeshes: Mesh[];
-    /** Material used to inicate color of gizmo mesh */
+    /** Material used to indicate color of gizmo mesh */
     material: StandardMaterial;
-    /** Material used to inicate hover state of the Gizmo */
+    /** Material used to indicate hover state of the Gizmo */
     hoverMaterial: StandardMaterial;
-    /** Material used to inicate disabled state of the Gizmo */
+    /** Material used to indicate disabled state of the Gizmo */
     disableMaterial: StandardMaterial;
     /** Used to indicate Active state of the Gizmo */
     active: boolean;

+ 3 - 3
src/Gizmos/gizmoManager.ts

@@ -89,7 +89,7 @@ export class GizmoManager implements IDisposable {
     }
 
     /**
-     * Instatiates a gizmo manager
+     * Instantiates a gizmo manager
      * @param scene the scene to overlay the gizmos on top of
      * @param thickness display gizmo axis thickness
      * @param utilityLayer the layer where gizmos are rendered
@@ -109,10 +109,10 @@ export class GizmoManager implements IDisposable {
 
     /**
      * Subscribes to pointer down events, for attaching and detaching mesh
-     * @param scene The sceme layer the observer will be added to
+     * @param scene The scene layer the observer will be added to
      */
     private _attachToMeshPointerObserver(scene: Scene): Observer<PointerInfo> {
-        // Instatiate/dispose gizmos based on pointer actions
+        // Instantiate/dispose gizmos based on pointer actions
         const pointerObserver = scene.onPointerObservable.add((pointerInfo) => {
             if (!this.usePointerToAttachGizmos) {
                 return;