瀏覽代碼

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

David Catuhe 8 年之前
父節點
當前提交
30c6f6d99c

文件差異過大導致無法顯示
+ 800 - 800
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 4 - 4
dist/preview release/babylon.js


+ 6 - 3
dist/preview release/babylon.max.js

@@ -35140,7 +35140,10 @@ var BABYLON;
             this.setValue(currentValue);
             // Check events
             for (var index = 0; index < this._events.length; index++) {
-                if (currentFrame >= this._events[index].frame) {
+                // Make sure current frame has passed event frame and that event frame is within the current range
+                // Also, handle both forward and reverse animations
+                if ((range > 0 && currentFrame >= this._events[index].frame && this._events[index].frame >= from) ||
+                    (range < 0 && currentFrame <= this._events[index].frame && this._events[index].frame <= from)) {
                     var event = this._events[index];
                     if (!event.isDone) {
                         // If event should be done only once, remove it.
@@ -56031,7 +56034,7 @@ var BABYLON;
             selects one of the cube map face's 2D mipmap sets based on the largest magnitude coordinate direction
             the major axis direction). The target column in the table below explains how the major axis direction
             maps to the 2D image of a particular cube map target.
-    
+    
             major axis
             direction     target                              sc     tc    ma
             ----------    ---------------------------------   ---    ---   ---
@@ -56041,7 +56044,7 @@ var BABYLON;
             -ry          GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT   +rx    -rz   ry
             +rz          GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT   +rx    -ry   rz
             -rz          GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT   -rx    -ry   rz
-    
+    
             Using the sc, tc, and ma determined by the major axis direction as specified in the table above,
             an updated (s,t) is calculated as follows
             s   =   ( sc/|ma| + 1 ) / 2

文件差異過大導致無法顯示
+ 800 - 800
dist/preview release/babylon.module.d.ts


文件差異過大導致無法顯示
+ 4 - 4
dist/preview release/babylon.worker.js


+ 42 - 30
gui/src/controls/textBlock.ts

@@ -46,7 +46,7 @@ module BABYLON.GUI {
 
             this._textHorizontalAlignment = value;
             this._markAsDirty();
-        } 
+        }
 
         public get textVerticalAlignment(): number {
             return this._textVerticalAlignment;
@@ -59,7 +59,7 @@ module BABYLON.GUI {
 
             this._textVerticalAlignment = value;
             this._markAsDirty();
-        } 
+        }
 
         constructor(public name?: string, text: string = "") {
             super(name);
@@ -69,7 +69,7 @@ module BABYLON.GUI {
 
         protected _getTypeName(): string {
             return "TextBlock";
-        }              
+        }
 
         private _drawText(text: string, textWidth: number, y: number, context: CanvasRenderingContext2D): void {
             var width = this._currentMeasure.width;
@@ -87,14 +87,14 @@ module BABYLON.GUI {
             }
 
             context.fillText(text, this._currentMeasure.left + x, y);
-        }      
+        }
 
         public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
             context.save();
 
             this._applyStates(context);
 
-            if (this._processMeasures(parentMeasure, context)) {            
+            if (this._processMeasures(parentMeasure, context)) {
                 // Render lines
                 this._renderLines(context);
             }
@@ -103,38 +103,50 @@ module BABYLON.GUI {
 
         protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void {
             this._lines = [];
+            var _lines = this.text.split("\n");
 
             if (this._textWrapping) {
-                var words = this.text.split(' ');
-                var line = '';
-
-                var width = this._currentMeasure.width;
-                var lineWidth = 0;
-
-                for(var n = 0; n < words.length; n++) {
-                    var testLine = n > 0 ? line + " " + words[n] : words[0];
-                    var metrics = context.measureText(testLine);
-                    var testWidth = metrics.width;
-                    if (testWidth > width && n > 0) {
-                        this._lines.push({text: line, width: lineWidth});
-                        line = words[n];
-                        lineWidth = context.measureText(line).width;
-                    }
-                    else {
-                        lineWidth = testWidth;
-                        line = testLine;
-                    }
+                for(var _line of _lines) {
+                    this._lines.push(this._parseLineWithTextWrapping(_line, context));
                 }
-                this._lines.push({text: line, width: lineWidth});
             } else {
-                this._lines.push({text: this.text, width: context.measureText(this.text).width});
+                for(var _line of _lines) {
+                    this._lines.push(this._parseLine(_line, context));
+                }
             }
         }
 
+        protected _parseLine(line: string='', context: CanvasRenderingContext2D): object {
+          return {text: line, width: context.measureText(line).width};
+        }
+
+        protected _parseLineWithTextWrapping(line: string='', context: CanvasRenderingContext2D): object {
+          var words = line.split(' ');
+          var width = this._currentMeasure.width;
+          var lineWidth = 0;
+
+          for(var n = 0; n < words.length; n++) {
+              var testLine = n > 0 ? line + " " + words[n] : words[0];
+              var metrics = context.measureText(testLine);
+              var testWidth = metrics.width;
+              if (testWidth > width && n > 0) {
+                  this._lines.push({text: line, width: lineWidth});
+                  line = words[n];
+                  lineWidth = context.measureText(line).width;
+              }
+              else {
+                  lineWidth = testWidth;
+                  line = testLine;
+              }
+          }
+
+          return {text: line, width: lineWidth};
+        }
+
         protected _renderLines(context: CanvasRenderingContext2D): void {
             var width = this._currentMeasure.width;
             var height = this._currentMeasure.height;
-            
+
             if (!this._fontOffset) {
                 this._fontOffset = Control._GetFontOffset(context.font);
             }
@@ -156,7 +168,7 @@ module BABYLON.GUI {
             for (var line of this._lines) {
                 this._drawText(line.text, line.width, rootY, context);
                 rootY += this._fontOffset.height;
-            }       
+            }
         }
-    }    
-}
+    }
+}