浏览代码

Merge pull request #7554 from Popov72/scrollviewer-idealwidth-bug

ScrollViewer: Missing a fix when idealXXX used
David Catuhe 5 年之前
父节点
当前提交
246e146876
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      gui/src/2D/controls/scrollViewers/scrollViewer.ts

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

@@ -244,8 +244,10 @@ export class ScrollViewer extends Rectangle {
     }
 
     private _buildClientSizes() {
-        this._window.parentClientWidth = this._currentMeasure.width - (this._verticalBar.isVisible || this.forceVerticalBar ? this._barSize : 0) - 2 * this.thickness;
-        this._window.parentClientHeight = this._currentMeasure.height - (this._horizontalBar.isVisible || this.forceHorizontalBar ? this._barSize : 0) - 2 * this.thickness;
+        let ratio = this.host.idealRatio;
+
+        this._window.parentClientWidth = this._currentMeasure.width - (this._verticalBar.isVisible || this.forceVerticalBar ? this._barSize * ratio : 0) - 2 * this.thickness;
+        this._window.parentClientHeight = this._currentMeasure.height - (this._horizontalBar.isVisible || this.forceHorizontalBar ? this._barSize * ratio : 0) - 2 * this.thickness;
 
         this._clientWidth = this._window.parentClientWidth;
         this._clientHeight = this._window.parentClientHeight;