瀏覽代碼

ratio fix

Andrew V Butt Sr 4 年之前
父節點
當前提交
17b6350ce2
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      gui/src/2D/controls/image.ts

+ 2 - 2
gui/src/2D/controls/image.ts

@@ -827,8 +827,8 @@ export class Image extends Control {
         let bottomHeight = this._imageHeight - this._sliceBottom;
         let centerWidth = width - leftWidth - rightWidth;
         let centerHeight = height - topHeight - bottomHeight;
-        let widthFactor = width / this._currentMeasure.width;
-        let heightFactor = height / this._currentMeasure.height;
+        let widthFactor = this._currentMeasure.width / width;
+        let heightFactor = this._currentMeasure.height / height;
         let wfh = widthFactor * 0.5;
         let hfh = heightFactor * 0.5;
         let leftTargetWidth = leftWidth * widthFactor;