From c1f5d2c208c805a00a3e0d215cd6cf4a1bb976c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=95=EC=9D=B8?= Date: Thu, 5 Feb 2026 23:26:35 +0900 Subject: [PATCH] =?UTF-8?q?PropertyItem=20=EC=88=98=EC=A0=95=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- .../UIToolkit/UTKPropertyListWindowSample.cs | 11 ++++-- .../Property/Views/UTKIntPropertyItemView.cs | 38 +++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c9c98177..5c83e899 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,5 @@ crashlytics-build.properties .DS_Store -.idea/ \ No newline at end of file +.idea/ +.vscode/ \ No newline at end of file diff --git a/Assets/Sample/UIToolkit/UTKPropertyListWindowSample.cs b/Assets/Sample/UIToolkit/UTKPropertyListWindowSample.cs index 1293ea7e..ee1b519e 100644 --- a/Assets/Sample/UIToolkit/UTKPropertyListWindowSample.cs +++ b/Assets/Sample/UIToolkit/UTKPropertyListWindowSample.cs @@ -111,11 +111,16 @@ namespace UVC.Sample.UIToolkit entries.Add(roBool); // Int (편집 가능) - entries.Add(new UTKIntPropertyItem("int", "Int", 42, 0, 100, true)); + entries.Add(new UTKIntPropertyItem("int", "Int", 42, 0, 100)); // Int (읽기 전용) - var roInt = new UTKIntPropertyItem("int_ro", "Int (RO)", 99, 0, 100, true, isReadOnly: true); - entries.Add(roInt); + entries.Add(new UTKIntPropertyItem("int_ro", "Int (RO)", 99, 0, 100, isReadOnly: true)); + + // Int (편집 가능) + entries.Add(new UTKIntPropertyItem("int1", "Int", 42, 0, 100, true)); + + // Int (읽기 전용) + entries.Add(new UTKIntPropertyItem("int1_ro", "Int (RO)", 99, 0, 100, true, isReadOnly: true)); // Int stepper (편집 가능) entries.Add(new UTKIntPropertyItem("int2", "Int2", 42, 0, 100, false, true)); diff --git a/Assets/Scripts/UVC/UIToolkit/Property/Views/UTKIntPropertyItemView.cs b/Assets/Scripts/UVC/UIToolkit/Property/Views/UTKIntPropertyItemView.cs index fa0bff3e..1e3e4ad2 100644 --- a/Assets/Scripts/UVC/UIToolkit/Property/Views/UTKIntPropertyItemView.cs +++ b/Assets/Scripts/UVC/UIToolkit/Property/Views/UTKIntPropertyItemView.cs @@ -276,6 +276,15 @@ namespace UVC.UIToolkit private void UpdateModeClass() { + // ReadOnly 상태에서는 무조건 IntegerField만 표시 + if (IsReadOnly) + { + RemoveFromClassList("utk-property-item-view--slider"); + RemoveFromClassList("utk-property-item-view--stepper"); + UpdateControlVisibility(); + return; + } + // 슬라이더 클래스 if (_useSlider) { @@ -295,6 +304,8 @@ namespace UVC.UIToolkit { RemoveFromClassList("utk-property-item-view--stepper"); } + + UpdateControlVisibility(); } #endregion @@ -325,6 +336,33 @@ namespace UVC.UIToolkit { _stepper.IsReadOnly = isReadOnly; } + + // ReadOnly 상태 변경 시 모드 클래스 업데이트 + UpdateModeClass(); + } + + /// 컨트롤 가시성을 업데이트합니다. + private void UpdateControlVisibility() + { + bool isReadOnlyMode = IsReadOnly; + bool showSlider = !isReadOnlyMode && _useSlider; + bool showStepper = !isReadOnlyMode && _useStepper; + bool showIntField = isReadOnlyMode || (!_useSlider && !_useStepper); + + if (_slider != null) + { + _slider.style.display = showSlider ? DisplayStyle.Flex : DisplayStyle.None; + } + + if (_stepper != null) + { + _stepper.style.display = showStepper ? DisplayStyle.Flex : DisplayStyle.None; + } + + if (_intField != null) + { + _intField.style.display = showIntField ? DisplayStyle.Flex : DisplayStyle.None; + } } #endregion