Browse Source

Added support for fontstyle in GUI

David Catuhe 8 years ago
parent
commit
c28507613a

File diff suppressed because it is too large
+ 10773 - 10773
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 10773 - 10773
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 729 - 729
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 729 - 729
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 2 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -127,6 +127,7 @@ declare module BABYLON.GUI {
         _host: AdvancedDynamicTexture;
         _currentMeasure: Measure;
         private _fontFamily;
+        private _fontStyle;
         private _fontSize;
         private _font;
         _width: ValueAndUnit;
@@ -213,6 +214,7 @@ declare module BABYLON.GUI {
         width: string | number;
         height: string | number;
         fontFamily: string;
+        fontStyle: string;
         fontSize: string | number;
         color: string;
         zIndex: number;

+ 16 - 1
dist/preview release/gui/babylon.gui.js

@@ -699,6 +699,7 @@ var BABYLON;
                 this._zIndex = 0;
                 this._currentMeasure = GUI.Measure.Empty();
                 this._fontFamily = "Arial";
+                this._fontStyle = "";
                 this._fontSize = new GUI.ValueAndUnit(18, GUI.ValueAndUnit.UNITMODE_PIXEL, false);
                 this._width = new GUI.ValueAndUnit(1, GUI.ValueAndUnit.UNITMODE_PERCENTAGE, false);
                 this._height = new GUI.ValueAndUnit(1, GUI.ValueAndUnit.UNITMODE_PERCENTAGE, false);
@@ -934,6 +935,20 @@ var BABYLON;
                 enumerable: true,
                 configurable: true
             });
+            Object.defineProperty(Control.prototype, "fontStyle", {
+                get: function () {
+                    return this._fontStyle;
+                },
+                set: function (value) {
+                    if (this._fontStyle === value) {
+                        return;
+                    }
+                    this._fontStyle = value;
+                    this._fontSet = true;
+                },
+                enumerable: true,
+                configurable: true
+            });
             Object.defineProperty(Control.prototype, "fontSize", {
                 get: function () {
                     return this._fontSize.toString(this._host);
@@ -1484,7 +1499,7 @@ var BABYLON;
                 if (!this._font && !this._fontSet) {
                     return;
                 }
-                this._font = this._fontSize.getValue(this._host) + "px " + this._fontFamily;
+                this._font = this._fontStyle + " " + this._fontSize.getValue(this._host) + "px " + this._fontFamily;
                 this._fontOffset = Control._GetFontOffset(this._font);
             };
             Control.prototype.dispose = function () {

File diff suppressed because it is too large
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


+ 2 - 0
dist/preview release/gui/babylon.gui.module.d.ts

@@ -127,6 +127,7 @@ declare module BABYLON.GUI {
         _host: AdvancedDynamicTexture;
         _currentMeasure: Measure;
         private _fontFamily;
+        private _fontStyle;
         private _fontSize;
         private _font;
         _width: ValueAndUnit;
@@ -213,6 +214,7 @@ declare module BABYLON.GUI {
         width: string | number;
         height: string | number;
         fontFamily: string;
+        fontStyle: string;
         fontSize: string | number;
         color: string;
         zIndex: number;

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

@@ -9,6 +9,7 @@ module BABYLON.GUI {
         public _host: AdvancedDynamicTexture;
         public _currentMeasure = Measure.Empty();
         private _fontFamily = "Arial";
+        private _fontStyle = "";
         private _fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);
         private _font: string;
         public _width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
@@ -244,6 +245,19 @@ module BABYLON.GUI {
             this._fontSet = true;
         }
 
+        public get fontStyle(): string {
+            return this._fontStyle;
+        }
+
+        public set fontStyle(value: string) {
+            if (this._fontStyle === value) {
+                return;
+            }
+
+            this._fontStyle = value;
+            this._fontSet = true;
+        }        
+
         public get fontSize(): string | number  {
             return this._fontSize.toString(this._host);
         }
@@ -855,7 +869,7 @@ module BABYLON.GUI {
                 return;
             }
 
-            this._font = this._fontSize.getValue(this._host) + "px " + this._fontFamily;
+            this._font = this._fontStyle + " " + this._fontSize.getValue(this._host) + "px " + this._fontFamily;
         
             this._fontOffset = Control._GetFontOffset(this._font);
         }