浏览代码

fix window size issue when scale factor is not 1

/main
fzhangtj 6 年前
当前提交
c9411b85
共有 4 个文件被更改,包括 4 次插入4 次删除
  1. 2
      Editor/editor/UIWidgetsPanelEditor.cs
  2. 6
      Runtime/engine/UIWidgetsPanel.cs
  3. 0
      /Editor/editor/UIWidgetsPanelEditor.cs.meta
  4. 0
      /Editor/editor/UIWidgetsPanelEditor.cs

2
Editor/editor/UIWidgetsPanelEditor.cs


namespace Unity.UIWidgets.Editor {
[CustomEditor(typeof(UIWidgetsPanel), true)]
[CanEditMultipleObjects]
public class WidgetCanvasEditor : RawImageEditor {
public class UIWidgetsPanelEditor : RawImageEditor {
public override void OnInspectorGUI() {
base.OnInspectorGUI();
var pixelRatioProperty = this.serializedObject.FindProperty("devicePixelRatioOverride");

6
Runtime/engine/UIWidgetsPanel.cs


}
protected override Vector2 queryWindowSize() {
var rect = RectTransformUtility.PixelAdjustRect(this._uiWidgetsPanel.rectTransform,
this._uiWidgetsPanel.canvas);
var size = new Vector2(rect.width, rect.height) / this._uiWidgetsPanel.devicePixelRatio;
var rect = this._uiWidgetsPanel.rectTransform.rect;
var size = new Vector2(rect.width,rect.height) *
this._uiWidgetsPanel.canvas.scaleFactor / this._uiWidgetsPanel.devicePixelRatio;
size.x = Mathf.Round(size.x);
size.y = Mathf.Round(size.y);
return size;

/Editor/editor/WidgetCanvasEditor.cs.meta → /Editor/editor/UIWidgetsPanelEditor.cs.meta

/Editor/editor/WidgetCanvasEditor.cs → /Editor/editor/UIWidgetsPanelEditor.cs

正在加载...
取消
保存