Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

avoid mark viewMetrics dirty in update, which will potentially leads … #243

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Runtime/editor/editor_utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public void Update() {
public void OnEnable() {
this._lastDevicePixelRatio = GameViewUtil.getGameViewDevicePixelRatio();
}

public void onViewMetricsChanged() {

}

public float devicePixelRatio {
get { return this._lastDevicePixelRatio; }
Expand Down
6 changes: 5 additions & 1 deletion Runtime/engine/DisplayMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public interface DisplayMetrics {
void OnEnable();
void OnGUI();
void Update();
void onViewMetricsChanged();

float devicePixelRatio { get; }

Expand All @@ -46,11 +47,14 @@ public void OnGUI() {
}

public void Update() {

}

public void onViewMetricsChanged() {
//view metrics marks dirty
this._viewMetrics = null;
}


public float devicePixelRatio {
get {
if (this._devicePixelRatio > 0) {
Expand Down
2 changes: 1 addition & 1 deletion Runtime/engine/UIWidgetsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool _mouseEntered {

void _handleViewMetricsChanged(string method, List<JSONNode> args) {
this._windowAdapter.onViewMetricsChanged();
this._displayMetrics.Update();
this._displayMetrics.onViewMetricsChanged();
}

protected override void OnEnable() {
Expand Down