PropertyItem 수정 중

This commit is contained in:
김형인
2026-02-05 23:26:35 +09:00
parent acd430c5d7
commit c1f5d2c208
3 changed files with 48 additions and 4 deletions

3
.gitignore vendored
View File

@@ -86,4 +86,5 @@ crashlytics-build.properties
.DS_Store
.idea/
.idea/
.vscode/

View File

@@ -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));

View File

@@ -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();
}
/// <summary>컨트롤 가시성을 업데이트합니다.</summary>
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