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