From cbbdc3897ff9f3e8c20b5b6c05b00c77df41f12b Mon Sep 17 00:00:00 2001 From: Ashley Rogers Date: Tue, 30 Jan 2024 13:33:29 -0500 Subject: [PATCH] Use Delayed input fields for georeference editor --- Editor/CesiumGeoreferenceEditor.cs | 6 ++++-- Editor/CesiumInspectorGUI.cs | 13 ++++++++++--- Runtime/CesiumGeoreference.cs | 6 +++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Editor/CesiumGeoreferenceEditor.cs b/Editor/CesiumGeoreferenceEditor.cs index f24c17fa..b216095c 100644 --- a/Editor/CesiumGeoreferenceEditor.cs +++ b/Editor/CesiumGeoreferenceEditor.cs @@ -140,7 +140,8 @@ private void DrawLongitudeLatitudeHeightProperties() this._latitude, -90.0, 90.0, - latitudeContent); + latitudeContent, + delayed: true); GUIContent longitudeContent = new GUIContent( "Longitude", @@ -149,7 +150,8 @@ private void DrawLongitudeLatitudeHeightProperties() this._longitude, -180.0, 180.0, - longitudeContent); + longitudeContent, + delayed: true); GUIContent heightContent = new GUIContent( "Height", diff --git a/Editor/CesiumInspectorGUI.cs b/Editor/CesiumInspectorGUI.cs index df221f21..fd38a970 100644 --- a/Editor/CesiumInspectorGUI.cs +++ b/Editor/CesiumInspectorGUI.cs @@ -1,6 +1,5 @@  using System; -using System.Text.RegularExpressions; using Unity.Mathematics; using UnityEditor; using UnityEngine; @@ -139,13 +138,21 @@ public static void ClampedFloatField( } public static void ClampedDoubleField( - SerializedProperty property, double min, double max, GUIContent label) + SerializedProperty property, double min, double max, GUIContent label, bool delayed = false) { // SerializedPropertyType.Float is used for both float and double; // SerializedPropertyType.Double does not exist. if (property.propertyType == SerializedPropertyType.Float) { - double value = EditorGUILayout.DoubleField(label, property.doubleValue); + double value; + if (delayed) + { + value = EditorGUILayout.DelayedDoubleField(label, property.doubleValue); + } + else + { + value = EditorGUILayout.DoubleField(label, property.doubleValue); + } property.doubleValue = Math.Clamp(value, min, max); } else diff --git a/Runtime/CesiumGeoreference.cs b/Runtime/CesiumGeoreference.cs index fac9c9ff..22371522 100644 --- a/Runtime/CesiumGeoreference.cs +++ b/Runtime/CesiumGeoreference.cs @@ -1,6 +1,6 @@ +using Reinterop; using System; using System.Collections.Generic; -using Reinterop; using Unity.Mathematics; using UnityEngine; @@ -76,15 +76,19 @@ public partial class CesiumGeoreference : MonoBehaviour private double _longitude = -105.25737; [SerializeField] + [Delayed] private double _height = 2250.0; [SerializeField] + [Delayed] private double _ecefX = 6378137.0; [SerializeField] + [Delayed] private double _ecefY = 0.0; [SerializeField] + [Delayed] private double _ecefZ = 0.0; [SerializeField]