Explorar el Código

Merge pull request #2914 from tovarisch/patch-1

Method to use parent coordinates
David Catuhe hace 7 años
padre
commit
ce61ac4917
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10 1
      gui/src/controls/control.ts

+ 10 - 1
gui/src/controls/control.ts

@@ -442,6 +442,15 @@ module BABYLON.GUI {
             return this;
         }
 
+        public getParentLocalCoordinates(globalCoordinates: Vector2): Vector2 {
+            var result = Vector2.Zero();
+
+            result.x = globalCoordinates.x - this._cachedParentMeasure.left;
+            result.y = globalCoordinates.y - this._cachedParentMeasure.top;
+
+            return result;
+        }
+        
         public moveToVector3(position: Vector3, scene: Scene): void {
             if (!this._host || this._root !== this._host._rootContainer) {
                 Tools.Error("Cannot move a control to a vector3 if the control is not at root level");
@@ -998,4 +1007,4 @@ module BABYLON.GUI {
             
         }
     }    
-}
+}