PropertyItem 수정 중
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -86,4 +86,5 @@ crashlytics-build.properties
|
||||
|
||||
|
||||
.DS_Store
|
||||
.idea/
|
||||
.idea/
|
||||
.vscode/
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user