소스 검색

ADT: added Image

David Catuhe 8 년 전
부모
커밋
f8809ca57a

+ 2 - 2
Tools/Gulp/config.json

@@ -1219,10 +1219,10 @@
                     "../../gui/src/measure.ts",
                     "../../gui/src/valueAndUnit.ts",
                     "../../gui/src/controls/control.ts",
-                    "../../gui/src/controls/contentControl.ts",
                     "../../gui/src/controls/container.ts",
                     "../../gui/src/controls/rectangle.ts",
-                    "../../gui/src/controls/textBlock.ts"
+                    "../../gui/src/controls/textBlock.ts",
+                    "../../gui/src/controls/image.ts"
                 ],
                 "output": "babylon.gui.js"
             }

+ 22 - 16
dist/preview release/gui/babylon.gui.d.ts

@@ -16,6 +16,7 @@ declare module BABYLON.GUI {
         private _checkUpdate();
         private _render();
         static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number): AdvancedDynamicTexture;
+        static CreateFullscreenUI(name: string, foreground: boolean, scene: Scene): AdvancedDynamicTexture;
     }
 }
 
@@ -80,6 +81,8 @@ declare module BABYLON.GUI {
         private _marginRight;
         private _marginTop;
         private _marginBottom;
+        private _left;
+        private _top;
         horizontalAlignment: number;
         verticalAlignment: number;
         width: string;
@@ -93,6 +96,8 @@ declare module BABYLON.GUI {
         marginRight: string;
         marginTop: string;
         marginBottom: string;
+        left: string;
+        top: string;
         constructor(name: string);
         protected _markAsDirty(): void;
         _link(root: Container, host: AdvancedDynamicTexture): void;
@@ -126,34 +131,23 @@ declare module BABYLON.GUI {
 
 /// <reference path="../../../dist/preview release/babylon.d.ts" />
 declare module BABYLON.GUI {
-    class ContentControl extends Control {
-        name: string;
-        private _child;
-        protected _measureForChild: Measure;
-        child: Control;
-        constructor(name: string);
-        protected _localDraw(context: CanvasRenderingContext2D): void;
-        _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
-        protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
-    }
-}
-
-/// <reference path="../../../dist/preview release/babylon.d.ts" />
-declare module BABYLON.GUI {
     class Container extends Control {
         name: string;
         private _children;
+        protected _measureForChildren: Measure;
         constructor(name: string);
         addControl(control: Control): Container;
         removeControl(control: Control): Container;
         _reOrderControl(control: Control): void;
+        protected _localDraw(context: CanvasRenderingContext2D): void;
         _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
+        protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
     }
 }
 
 /// <reference path="../../../dist/preview release/babylon.d.ts" />
 declare module BABYLON.GUI {
-    class Rectangle extends ContentControl {
+    class Rectangle extends Container {
         name: string;
         private _thickness;
         private _background;
@@ -181,10 +175,22 @@ declare module BABYLON.GUI {
         textHorizontalAlignment: number;
         textVerticalAlignment: number;
         constructor(name: string, text: string);
-        protected _measure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
         private _drawText(text, textWidth, y, context);
         _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
         protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
         protected _renderLines(context: CanvasRenderingContext2D): void;
     }
 }
+
+/// <reference path="../../../dist/preview release/babylon.d.ts" />
+declare module BABYLON.GUI {
+    class Image extends Control {
+        name: string;
+        private _domImage;
+        private _imageWidth;
+        private _imageHeight;
+        private _loaded;
+        constructor(name: string, url: string);
+        _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
+    }
+}

+ 117 - 77
dist/preview release/gui/babylon.gui.js

@@ -112,6 +112,14 @@ var BABYLON;
                 mesh.material = material;
                 return result;
             };
+            AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene) {
+                if (foreground === void 0) { foreground = true; }
+                var result = new AdvancedDynamicTexture(name, 0, 0, scene);
+                // Display
+                var layer = new BABYLON.Layer(name + "_layer", null, scene, !foreground);
+                layer.texture = result;
+                return result;
+            };
             return AdvancedDynamicTexture;
         }(BABYLON.DynamicTexture));
         GUI.AdvancedDynamicTexture = AdvancedDynamicTexture;
@@ -279,6 +287,8 @@ var BABYLON;
                 this._marginRight = new GUI.ValueAndUnit(0);
                 this._marginTop = new GUI.ValueAndUnit(0);
                 this._marginBottom = new GUI.ValueAndUnit(0);
+                this._left = new GUI.ValueAndUnit(0);
+                this._top = new GUI.ValueAndUnit(0);
                 this.fontFamily = "Arial";
             }
             Object.defineProperty(Control.prototype, "horizontalAlignment", {
@@ -451,6 +461,30 @@ var BABYLON;
                 enumerable: true,
                 configurable: true
             });
+            Object.defineProperty(Control.prototype, "left", {
+                get: function () {
+                    return this._left.toString();
+                },
+                set: function (value) {
+                    if (this._left.fromString(value)) {
+                        this._markAsDirty();
+                    }
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(Control.prototype, "top", {
+                get: function () {
+                    return this._top.toString();
+                },
+                set: function (value) {
+                    if (this._top.fromString(value)) {
+                        this._markAsDirty();
+                    }
+                },
+                enumerable: true,
+                configurable: true
+            });
             Control.prototype._markAsDirty = function () {
                 this._isDirty = true;
                 if (!this._host) {
@@ -531,27 +565,43 @@ var BABYLON;
                 }
                 if (this._marginLeft.isPixel) {
                     this._currentMeasure.left += this._marginLeft.value;
+                    this._currentMeasure.width -= this._marginRight.value;
                 }
                 else {
                     this._currentMeasure.left += parentWidth * this._marginLeft.value;
+                    this._currentMeasure.width -= parentWidth * this._marginLeft.value;
                 }
                 if (this._marginRight.isPixel) {
-                    this._currentMeasure.left -= this._marginRight.value;
+                    this._currentMeasure.width -= this._marginRight.value;
                 }
                 else {
-                    this._currentMeasure.left -= parentWidth * this._marginRight.value;
+                    this._currentMeasure.width -= parentWidth * this._marginRight.value;
                 }
                 if (this._marginTop.isPixel) {
                     this._currentMeasure.top += this._marginTop.value;
+                    this._currentMeasure.height -= this._marginTop.value;
                 }
                 else {
-                    this._currentMeasure.top += parentWidth * this._marginTop.value;
+                    this._currentMeasure.top += parentHeight * this._marginTop.value;
+                    this._currentMeasure.height -= parentHeight * this._marginTop.value;
                 }
                 if (this._marginBottom.isPixel) {
-                    this._currentMeasure.top -= this._marginBottom.value;
+                    this._currentMeasure.height -= this._marginBottom.value;
                 }
                 else {
-                    this._currentMeasure.top -= parentWidth * this._marginBottom.value;
+                    this._currentMeasure.height -= parentHeight * this._marginBottom.value;
+                }
+                if (this._left.isPixel) {
+                    this._currentMeasure.left += this._left.value;
+                }
+                else {
+                    this._currentMeasure.left += parentWidth * this._left.value;
+                }
+                if (this._top.isPixel) {
+                    this._currentMeasure.top += this._top.value;
+                }
+                else {
+                    this._currentMeasure.top += parentHeight * this._top.value;
                 }
                 this._currentMeasure.left += x;
                 this._currentMeasure.top += y;
@@ -674,75 +724,13 @@ var BABYLON;
 (function (BABYLON) {
     var GUI;
     (function (GUI) {
-        var ContentControl = (function (_super) {
-            __extends(ContentControl, _super);
-            function ContentControl(name) {
-                var _this = _super.call(this, name) || this;
-                _this.name = name;
-                _this._measureForChild = GUI.Measure.Empty();
-                return _this;
-            }
-            Object.defineProperty(ContentControl.prototype, "child", {
-                get: function () {
-                    return this._child;
-                },
-                set: function (control) {
-                    if (this._child === control) {
-                        return;
-                    }
-                    this._child = control;
-                    control._link(this._root, this._host);
-                    this._markAsDirty();
-                },
-                enumerable: true,
-                configurable: true
-            });
-            ContentControl.prototype._localDraw = function (context) {
-                // Implemented by child to be injected inside main draw
-            };
-            ContentControl.prototype._draw = function (parentMeasure, context) {
-                context.save();
-                _super.prototype._processMeasures.call(this, parentMeasure, context);
-                this.applyStates(context);
-                this._localDraw(context);
-                if (this._child) {
-                    this._child._draw(this._measureForChild, context);
-                }
-                context.restore();
-            };
-            ContentControl.prototype._additionalProcessing = function (parentMeasure, context) {
-                _super.prototype._additionalProcessing.call(this, parentMeasure, context);
-                this._measureForChild.copyFrom(this._currentMeasure);
-            };
-            return ContentControl;
-        }(GUI.Control));
-        GUI.ContentControl = ContentControl;
-    })(GUI = BABYLON.GUI || (BABYLON.GUI = {}));
-})(BABYLON || (BABYLON = {}));
-
-//# sourceMappingURL=contentControl.js.map
-
-/// <reference path="../../../dist/preview release/babylon.d.ts"/>
-var __extends = (this && this.__extends) || (function () {
-    var extendStatics = Object.setPrototypeOf ||
-        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
-        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
-    return function (d, b) {
-        extendStatics(d, b);
-        function __() { this.constructor = d; }
-        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-    };
-})();
-var BABYLON;
-(function (BABYLON) {
-    var GUI;
-    (function (GUI) {
         var Container = (function (_super) {
             __extends(Container, _super);
             function Container(name) {
                 var _this = _super.call(this, name) || this;
                 _this.name = name;
                 _this._children = new Array();
+                _this._measureForChildren = GUI.Measure.Empty();
                 return _this;
             }
             Container.prototype.addControl = function (control) {
@@ -774,16 +762,24 @@ var BABYLON;
                 this._children.push(control);
                 this._markAsDirty();
             };
+            Container.prototype._localDraw = function (context) {
+                // Implemented by child to be injected inside main draw
+            };
             Container.prototype._draw = function (parentMeasure, context) {
                 context.save();
                 _super.prototype._processMeasures.call(this, parentMeasure, context);
                 this.applyStates(context);
+                this._localDraw(context);
                 for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                     var child = _a[_i];
-                    child._draw(this._currentMeasure, context);
+                    child._draw(this._measureForChildren, context);
                 }
                 context.restore();
             };
+            Container.prototype._additionalProcessing = function (parentMeasure, context) {
+                _super.prototype._additionalProcessing.call(this, parentMeasure, context);
+                this._measureForChildren.copyFrom(this._currentMeasure);
+            };
             return Container;
         }(GUI.Control));
         GUI.Container = Container;
@@ -860,13 +856,13 @@ var BABYLON;
             };
             Rectangle.prototype._additionalProcessing = function (parentMeasure, context) {
                 _super.prototype._additionalProcessing.call(this, parentMeasure, context);
-                this._measureForChild.width -= 2 * this._thickness;
-                this._measureForChild.height -= 2 * this._thickness;
-                this._measureForChild.left += this._thickness;
-                this._measureForChild.top += this._thickness;
+                this._measureForChildren.width -= 2 * this._thickness;
+                this._measureForChildren.height -= 2 * this._thickness;
+                this._measureForChildren.left += this._thickness;
+                this._measureForChildren.top += this._thickness;
             };
             return Rectangle;
-        }(GUI.ContentControl));
+        }(GUI.Container));
         GUI.Rectangle = Rectangle;
     })(GUI = BABYLON.GUI || (BABYLON.GUI = {}));
 })(BABYLON || (BABYLON = {}));
@@ -955,9 +951,6 @@ var BABYLON;
                 enumerable: true,
                 configurable: true
             });
-            TextBlock.prototype._measure = function (parentMeasure, context) {
-                _super.prototype._measure;
-            };
             TextBlock.prototype._drawText = function (text, textWidth, y, context) {
                 var width = this._currentMeasure.width;
                 var x = 0;
@@ -1041,3 +1034,50 @@ var BABYLON;
 })(BABYLON || (BABYLON = {}));
 
 //# sourceMappingURL=textBlock.js.map
+
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+var __extends = (this && this.__extends) || (function () {
+    var extendStatics = Object.setPrototypeOf ||
+        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+    return function (d, b) {
+        extendStatics(d, b);
+        function __() { this.constructor = d; }
+        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+    };
+})();
+var BABYLON;
+(function (BABYLON) {
+    var GUI;
+    (function (GUI) {
+        var Image = (function (_super) {
+            __extends(Image, _super);
+            function Image(name, url) {
+                var _this = _super.call(this, name) || this;
+                _this.name = name;
+                _this._loaded = false;
+                _this._domImage = new HTMLImageElement();
+                _this._domImage.onload = function () {
+                    _this._imageWidth = _this._domImage.width;
+                    _this._imageHeight = _this._domImage.height;
+                    _this._loaded = true;
+                };
+                _this._domImage.src = url;
+                return _this;
+            }
+            Image.prototype._draw = function (parentMeasure, context) {
+                context.save();
+                this.applyStates(context);
+                _super.prototype._processMeasures.call(this, parentMeasure, context);
+                if (this._loaded) {
+                    context.drawImage(this._domImage, 0, 0, this._imageWidth, this._imageHeight, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
+                }
+                context.restore();
+            };
+            return Image;
+        }(GUI.Control));
+        GUI.Image = Image;
+    })(GUI = BABYLON.GUI || (BABYLON.GUI = {}));
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=image.js.map

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


+ 9 - 0
gui/src/advancedDynamicTexture.ts

@@ -118,5 +118,14 @@ module BABYLON.GUI {
             return result;
         }
 
+        public static CreateFullscreenUI(name: string, foreground: boolean = true, scene: Scene): AdvancedDynamicTexture {
+            var result = new AdvancedDynamicTexture(name, 0, 0, scene);
+
+            // Display
+            var layer = new BABYLON.Layer(name + "_layer", null, scene, !foreground);
+            layer.texture = result;
+
+            return result;
+        }
     }    
 }

+ 14 - 1
gui/src/controls/container.ts

@@ -3,6 +3,7 @@
 module BABYLON.GUI {
     export class Container extends Control {
         private _children = new Array<Control>();
+        protected _measureForChildren = Measure.Empty();     
 
         constructor(public name: string) {
             super(name);
@@ -48,16 +49,28 @@ module BABYLON.GUI {
             this._markAsDirty();
         }
 
+        protected _localDraw(context: CanvasRenderingContext2D): void {
+            // Implemented by child to be injected inside main draw
+        }
+
         public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
             context.save();
             super._processMeasures(parentMeasure, context);
            
             this.applyStates(context);
 
+            this._localDraw(context);
+
             for (var child of this._children) {
-                child._draw(this._currentMeasure, context);
+                child._draw(this._measureForChildren, context);
             }
             context.restore();
         }
+
+        protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void {  
+            super._additionalProcessing(parentMeasure, context);
+
+            this._measureForChildren.copyFrom(this._currentMeasure);
+        }
     }    
 }

+ 0 - 52
gui/src/controls/contentControl.ts

@@ -1,52 +0,0 @@
-/// <reference path="../../../dist/preview release/babylon.d.ts"/>
-
-module BABYLON.GUI {
-    export class ContentControl extends Control {
-        private _child: Control;  
-        protected _measureForChild = Measure.Empty();     
-
-        public get child(): Control {
-            return this._child;
-        }
-
-        public set child(control: Control) {
-            if (this._child === control) {
-                return;
-            }
-
-            this._child = control;
-            control._link(this._root, this._host);
-
-            this._markAsDirty();
-        }
-
-        constructor(public name: string) {
-            super(name);
-        }
-
-        protected _localDraw(context: CanvasRenderingContext2D): void {
-            // Implemented by child to be injected inside main draw
-        }
-
-        public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
-            context.save();
-
-            super._processMeasures(parentMeasure, context);
-           
-            this.applyStates(context);
-
-            this._localDraw(context);
-
-            if (this._child) {
-                this._child._draw(this._measureForChild, context);
-            }
-            context.restore();
-        }
-
-        protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void {  
-            super._additionalProcessing(parentMeasure, context);
-
-            this._measureForChild.copyFrom(this._currentMeasure);
-        }
-    }    
-}

+ 44 - 6
gui/src/controls/control.ts

@@ -22,6 +22,8 @@ module BABYLON.GUI {
         private _marginRight = new ValueAndUnit(0);
         private _marginTop = new ValueAndUnit(0);
         private _marginBottom = new ValueAndUnit(0);        
+        private _left = new ValueAndUnit(0);
+        private _top = new ValueAndUnit(0);
         
         // Properties
         public get horizontalAlignment(): number {
@@ -172,7 +174,27 @@ module BABYLON.GUI {
             if (this._marginBottom.fromString(value)) {
                 this._markAsDirty();
             }
-        }                
+        }     
+
+        public get left(): string {
+            return this._left.toString();
+        }
+
+        public set left(value: string) {
+            if (this._left.fromString(value)) {
+                this._markAsDirty();
+            }
+        }  
+
+        public get top(): string {
+            return this._top.toString();
+        }
+
+        public set top(value: string) {
+            if (this._top.fromString(value)) {
+                this._markAsDirty();
+            }
+        }                   
 
         // Functions
         constructor(public name: string) {
@@ -273,28 +295,44 @@ module BABYLON.GUI {
             
             if (this._marginLeft.isPixel) {
                 this._currentMeasure.left += this._marginLeft.value;
+                this._currentMeasure.width -= this._marginRight.value;
             } else {
                 this._currentMeasure.left += parentWidth * this._marginLeft.value;
+                this._currentMeasure.width -= parentWidth * this._marginLeft.value;
             }
 
             if (this._marginRight.isPixel) {
-                this._currentMeasure.left -= this._marginRight.value;
+                this._currentMeasure.width -= this._marginRight.value;
             } else {
-                this._currentMeasure.left -= parentWidth * this._marginRight.value;
+                this._currentMeasure.width -= parentWidth * this._marginRight.value;
             }
 
             if (this._marginTop.isPixel) {
                 this._currentMeasure.top += this._marginTop.value;
+                this._currentMeasure.height -= this._marginTop.value;
             } else {
-                this._currentMeasure.top += parentWidth * this._marginTop.value;
+                this._currentMeasure.top += parentHeight * this._marginTop.value;
+                this._currentMeasure.height -= parentHeight * this._marginTop.value;
             }
 
             if (this._marginBottom.isPixel) {
-                this._currentMeasure.top -= this._marginBottom.value;
+                this._currentMeasure.height -= this._marginBottom.value;
             } else {
-                this._currentMeasure.top -= parentWidth * this._marginBottom.value;
+                this._currentMeasure.height -= parentHeight * this._marginBottom.value;
             }            
 
+            if (this._left.isPixel) {
+                this._currentMeasure.left += this._left.value;
+            } else {
+                this._currentMeasure.left += parentWidth * this._left.value;
+            }
+
+            if (this._top.isPixel) {
+                this._currentMeasure.top += this._top.value;
+            } else {
+                this._currentMeasure.top += parentHeight * this._top.value;
+            }
+
             this._currentMeasure.left += x;
             this._currentMeasure.top += y;            
         }

+ 89 - 0
gui/src/controls/image.ts

@@ -0,0 +1,89 @@
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
+var DOMImage = Image;
+
+module BABYLON.GUI {
+    export class Image extends Control {
+        private _domImage: HTMLImageElement;
+        private _imageWidth: number;
+        private _imageHeight: number;
+        private _loaded = false;
+        private _stretch = Image.STRETCH_FILL;
+
+        public get stretch(): number {
+            return this._stretch;
+        }
+
+        public set stretch(value: number) {
+            if (this._stretch === value) {
+                return;
+            }
+
+            this._stretch = value;
+
+            this._markAsDirty();
+        }
+
+        constructor(public name: string, url: string) {
+            super(name);
+
+            this._domImage = new DOMImage();
+            
+            this._domImage.onload = () => {
+                this._imageWidth = this._domImage.width;
+                this._imageHeight = this._domImage.height;
+                this._loaded = true;
+                this._markAsDirty();
+            }
+            
+            this._domImage.src = url;
+        }
+
+        public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
+            context.save();
+
+            this.applyStates(context);
+            super._processMeasures(parentMeasure, context);
+
+            if (this._loaded) {
+                switch (this._stretch) {
+                    case Image.STRETCH_NONE:
+                        context.drawImage(this._domImage, this._currentMeasure.left, this._currentMeasure.top);
+                        break;
+                    case Image.STRETCH_FILL:
+                        context.drawImage(this._domImage, 0, 0, this._imageWidth, this._imageHeight, 
+                                                          this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
+                        break;
+                    case Image.STRETCH_UNIFORM:
+                        var hRatio = this._currentMeasure.width  / this._imageWidth;
+                        var vRatio =  this._currentMeasure.height / this._imageHeight;
+                        var ratio = Math.min(hRatio, vRatio);
+                        var centerX = (this._currentMeasure.width - this._imageWidth * ratio) / 2;
+                        var centerY = (this._currentMeasure.height - this._imageHeight * ratio) / 2; 
+
+                        context.drawImage(this._domImage, 0, 0, this._imageWidth, this._imageHeight,
+                                                          this._currentMeasure.left + centerX, this._currentMeasure.top + centerY, this._imageWidth * ratio, this._imageHeight * ratio);
+                        break;
+                }
+            }
+            context.restore();
+        }
+
+        // Static
+        private static _STRETCH_NONE = 0;
+        private static _STRETCH_FILL = 1;
+        private static _STRETCH_UNIFORM = 2;
+
+        public static get STRETCH_NONE(): number {
+            return Image._STRETCH_NONE;
+        }
+
+        public static get STRETCH_FILL(): number {
+            return Image._STRETCH_FILL;
+        }       
+
+        public static get STRETCH_UNIFORM(): number {
+            return Image._STRETCH_UNIFORM;
+        }              
+    }    
+}

+ 5 - 5
gui/src/controls/rectangle.ts

@@ -1,7 +1,7 @@
 /// <reference path="../../../dist/preview release/babylon.d.ts"/>
 
 module BABYLON.GUI {
-    export class Rectangle extends ContentControl {
+    export class Rectangle extends Container {
         private _thickness = 1;
         private _background: string;
         
@@ -58,10 +58,10 @@ module BABYLON.GUI {
         protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void {  
             super._additionalProcessing(parentMeasure, context);
 
-            this._measureForChild.width -= 2 * this._thickness;
-            this._measureForChild.height -= 2 * this._thickness;
-            this._measureForChild.left += this._thickness;
-            this._measureForChild.top += this._thickness;            
+            this._measureForChildren.width -= 2 * this._thickness;
+            this._measureForChildren.height -= 2 * this._thickness;
+            this._measureForChildren.left += this._thickness;
+            this._measureForChildren.top += this._thickness;            
         }
     }    
 }

+ 0 - 4
gui/src/controls/textBlock.ts

@@ -67,10 +67,6 @@ module BABYLON.GUI {
             this.text = text;
         }
 
-        protected _measure(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
-            super._measure
-        }
-
         private _drawText(text: string, textWidth: number, y: number, context: CanvasRenderingContext2D): void {
             var width = this._currentMeasure.width;
             var x = 0;