Bläddra i källkod

Merge pull request #7955 from BabylonJS/master

Nightly
mergify[bot] 5 år sedan
förälder
incheckning
641517b526

+ 1 - 0
dist/preview release/babylon.d.ts

@@ -15683,6 +15683,7 @@ declare module BABYLON {
          * @param mesh defines the mesh to bind the material to
          */
         bind(world: Matrix, mesh?: Mesh): void;
+        protected _afterBind(mesh?: Mesh): void;
         /**
          * Gets the active textures from the material
          * @returns an array of textures

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
dist/preview release/babylon.js


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

@@ -16077,6 +16077,7 @@ declare module "babylonjs/Materials/shaderMaterial" {
          * @param mesh defines the mesh to bind the material to
          */
         bind(world: Matrix, mesh?: Mesh): void;
+        protected _afterBind(mesh?: Mesh): void;
         /**
          * Gets the active textures from the material
          * @returns an array of textures
@@ -89989,6 +89990,7 @@ declare module BABYLON {
          * @param mesh defines the mesh to bind the material to
          */
         bind(world: Matrix, mesh?: Mesh): void;
+        protected _afterBind(mesh?: Mesh): void;
         /**
          * Gets the active textures from the material
          * @returns an array of textures

+ 3 - 0
dist/preview release/documentation.d.ts

@@ -15683,6 +15683,7 @@ declare module BABYLON {
          * @param mesh defines the mesh to bind the material to
          */
         bind(world: Matrix, mesh?: Mesh): void;
+        protected _afterBind(mesh?: Mesh): void;
         /**
          * Gets the active textures from the material
          * @returns an array of textures
@@ -74197,6 +74198,8 @@ declare module BABYLON.GUI {
         private _barImageHeight;
         private _horizontalBarImageHeight;
         private _verticalBarImageHeight;
+        private _oldWindowContentsWidth;
+        private _oldWindowContentsHeight;
         /**
          * Gets the horizontal scrollbar
          */

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

@@ -3057,6 +3057,8 @@ declare module BABYLON.GUI {
         private _barImageHeight;
         private _horizontalBarImageHeight;
         private _verticalBarImageHeight;
+        private _oldWindowContentsWidth;
+        private _oldWindowContentsHeight;
         /**
          * Gets the horizontal scrollbar
          */

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


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

@@ -3186,6 +3186,8 @@ declare module "babylonjs-gui/2D/controls/scrollViewers/scrollViewer" {
         private _barImageHeight;
         private _horizontalBarImageHeight;
         private _verticalBarImageHeight;
+        private _oldWindowContentsWidth;
+        private _oldWindowContentsHeight;
         /**
          * Gets the horizontal scrollbar
          */
@@ -7426,6 +7428,8 @@ declare module BABYLON.GUI {
         private _barImageHeight;
         private _horizontalBarImageHeight;
         private _verticalBarImageHeight;
+        private _oldWindowContentsWidth;
+        private _oldWindowContentsHeight;
         /**
          * Gets the horizontal scrollbar
          */

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

@@ -16077,6 +16077,7 @@ declare module "babylonjs/Materials/shaderMaterial" {
          * @param mesh defines the mesh to bind the material to
          */
         bind(world: Matrix, mesh?: Mesh): void;
+        protected _afterBind(mesh?: Mesh): void;
         /**
          * Gets the active textures from the material
          * @returns an array of textures
@@ -89989,6 +89990,7 @@ declare module BABYLON {
          * @param mesh defines the mesh to bind the material to
          */
         bind(world: Matrix, mesh?: Mesh): void;
+        protected _afterBind(mesh?: Mesh): void;
         /**
          * Gets the active textures from the material
          * @returns an array of textures

+ 13 - 1
gui/src/2D/controls/scrollViewers/scrollViewer.ts

@@ -44,6 +44,9 @@ export class ScrollViewer extends Rectangle {
     private _barImageHeight: number = 1;
     private _horizontalBarImageHeight: number = 1;
     private _verticalBarImageHeight: number = 1;
+    private _oldWindowContentsWidth: number = 0;
+    private _oldWindowContentsHeight: number = 0;
+
     /**
      * Gets the horizontal scrollbar
      */
@@ -261,6 +264,8 @@ export class ScrollViewer extends Rectangle {
         super._postMeasure();
 
         this._updateScroller();
+
+        this._setWindowPosition(false);
     }
 
     /**
@@ -556,11 +561,18 @@ export class ScrollViewer extends Rectangle {
         vb.backgroundImage = value;
     }
 
-    private _setWindowPosition(): void {
+    private _setWindowPosition(force = true): void {
         let ratio = this.host.idealRatio;
         let windowContentsWidth = this._window._currentMeasure.width;
         let windowContentsHeight = this._window._currentMeasure.height;
 
+        if (!force && this._oldWindowContentsWidth === windowContentsWidth && this._oldWindowContentsHeight === windowContentsHeight) {
+            return;
+        }
+
+        this._oldWindowContentsWidth = windowContentsWidth;
+        this._oldWindowContentsHeight = windowContentsHeight;
+
         const _endLeft = this._clientWidth - windowContentsWidth;
         const _endTop = this._clientHeight - windowContentsHeight;
 

+ 5 - 0
src/Materials/shaderMaterial.ts

@@ -759,6 +759,11 @@ export class ShaderMaterial extends Material {
         this._afterBind(mesh);
     }
 
+    protected _afterBind(mesh?: Mesh): void {
+        super._afterBind(mesh);
+        this.getScene()._cachedEffect = this._effect;
+    }
+
     /**
      * Gets the active textures from the material
      * @returns an array of textures