|
|
|
|
|
|
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; |
|
|
|
// Here we use ReferenceEquals instead of "==" due to
|
|
|
|
// https://blogs.unity3d.com/2014/05/16/custom-operator-should-we-keep-it/
|
|
|
|
// In short, "==" is overloaded for UnityEngine.Object and will bring performance issues
|
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|