瀏覽代碼

Moved radius prop to sphere panel

David Catuhe 7 年之前
父節點
當前提交
bfbacb524c
共有 2 個文件被更改,包括 24 次插入24 次删除
  1. 23 3
      gui/src/3D/controls/spherePanel.ts
  2. 1 21
      gui/src/3D/controls/volumeBasedPanel.ts

+ 23 - 3
gui/src/3D/controls/spherePanel.ts

@@ -5,6 +5,26 @@ module BABYLON.GUI {
      * Class used to create a container panel deployed on the surface of a sphere
      */
     export class SpherePanel extends VolumeBasedPanel {
+        private _radius = 4.0;
+
+        /**
+         * Gets or sets the radius of the sphere where to project controls (5 by default)
+         */
+        public get radius(): float {
+            return this._radius;
+        }
+
+        public set radius(value: float) {
+            if (this._radius === value) {
+                return;
+            }
+
+            this._radius = value;
+
+            Tools.SetImmediate(() => {
+                this._arrangeChildren();               
+            });
+        }              
 
         protected _mapGridNode(control: Control3D, nodePosition: Vector3) {            
             let newPos = this._sphericalMapping(nodePosition);
@@ -34,10 +54,10 @@ module BABYLON.GUI {
 
         private _sphericalMapping(source: Vector3)
         {
-            let newPos = new Vector3(0, 0, this.radius);
+            let newPos = new Vector3(0, 0, this._radius);
 
-            let xAngle = (source.y / this.radius);
-            let yAngle = -(source.x / this.radius);
+            let xAngle = (source.y / this._radius);
+            let yAngle = -(source.x / this._radius);
 
             Matrix.RotationYawPitchRollToRef(yAngle, xAngle, 0, Tmp.Matrix[0]);
 

+ 1 - 21
gui/src/3D/controls/volumeBasedPanel.ts

@@ -5,7 +5,6 @@ module BABYLON.GUI {
      * Abstract class used to create a container panel deployed on the surface of a volume
      */
     export abstract class VolumeBasedPanel extends Container3D {
-        private _radius = 5.0;
         private _columns = 10;
         private _rows = 0;
         private _rowThenColum = true;
@@ -41,26 +40,7 @@ module BABYLON.GUI {
             Tools.SetImmediate(() => {
                 this._arrangeChildren();               
             });
-        }   
-         
-        /**
-         * Gets or sets the radius of the sphere where to project controls (5 by default)
-         */
-        public get radius(): float {
-            return this._radius;
-        }
-
-        public set radius(value: float) {
-            if (this._radius === value) {
-                return;
-            }
-
-            this._radius = value;
-
-            Tools.SetImmediate(() => {
-                this._arrangeChildren();               
-            });
-        }        
+        }             
 
         /**
          * Gets or sets the number of columns requested (10 by default).