浏览代码

Fix issue introduced by moving queryWindowSize to update.

/main
Yuncong Zhang 6 年前
当前提交
f80cd249
共有 2 个文件被更改,包括 30 次插入23 次删除
  1. 8
      Runtime/editor/editor_window.cs
  2. 45
      Runtime/engine/UIWidgetsPanel.cs

8
Runtime/editor/editor_window.cs


public void OnEnable() {
this._devicePixelRatio = this.queryDevicePixelRatio();
this._antiAliasing = this.queryAntiAliasing();
var size = this.queryWindowSize();
this._lastWindowWidth = size.x;
this._lastWindowHeight = size.y;
this._physicalSize = new Size(
this._lastWindowWidth * this._devicePixelRatio,
this._lastWindowHeight * this._devicePixelRatio);
this.updateSafeArea();
D.assert(this._surface == null);

}
public void Update() {
if (this._physicalSize == null) {
if (this._physicalSize == null || this._physicalSize.isEmpty) {
var size = this.queryWindowSize();
this._lastWindowWidth = size.x;
this._lastWindowHeight = size.y;

45
Runtime/engine/UIWidgetsPanel.cs


protected override float queryDevicePixelRatio() {
return this._uiWidgetsPanel.devicePixelRatio;
}
protected override int queryAntiAliasing() {
return this._uiWidgetsPanel.antiAliasing;
}

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;
if (!ReferenceEquals(this._uiWidgetsPanel.canvas, null)) {
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;
}
return new Vector2(0, 0);
}
public Offset windowPosToScreenPos(Offset windowPos) {

this._displayMetrics = DisplayMetricsProvider.provider();
this._displayMetrics.OnEnable();
this._enteredPointers.Clear();
if (_repaintEvent == null) {

: this._displayMetrics.devicePixelRatio;
}
}
get {
return this.antiAliasingOverride >= 0 ? this.antiAliasingOverride : QualitySettings.antiAliasing;
}
get { return this.antiAliasingOverride >= 0 ? this.antiAliasingOverride : QualitySettings.antiAliasing; }
}
public WindowPadding viewPadding {

get { return this._displayMetrics.viewInsets; }
}
protected override void OnDisable() {
D.assert(this._windowAdapter != null);
this._windowAdapter.OnDisable();
this._windowAdapter = null;
base.OnDisable();
protected override void OnDisable() {
D.assert(this._windowAdapter != null);
this._windowAdapter.OnDisable();
this._windowAdapter = null;
base.OnDisable();
public void recreateWidget() {
Widget root;
using (this._windowAdapter.getScope()) {

protected virtual void Update() {
this._displayMetrics.Update();
UIWidgetsMessageManager.ensureUIWidgetsMessageManagerIfNeeded();
this._windowAdapter.withBinding(() => {
WidgetsBinding.instance.handlePopRoute();
});
this._windowAdapter.withBinding(() => { WidgetsBinding.instance.handlePopRoute(); });
}
#endif

break;
}
}
return InputUtils.getMouseButtonKey(defaultKey);
}

正在加载...
取消
保存