This commit is contained in:
MuHua-123
2025-01-13 16:19:03 +08:00
parent 8f387837db
commit 4f7a5d76ca
42 changed files with 328 additions and 83 deletions
@@ -106,21 +106,15 @@ namespace MuHua {
tracker.style.width = CurrentPosition;
UpdateFloatField();
}
internal void UpdateFloatField(ChangeEvent<float> evt) {
float value = Mathf.Clamp(evt.newValue, MinValue, MaxValue);
slidingValue = (value - MinValue) / (MaxValue - MinValue);
tracker.style.width = CurrentPosition;
SlidingValueChanged?.Invoke(Value);
}
internal void UpdateFloatField(bool value) {
isDisplayInput = value;
floatField.style.display = isDisplayInput ? DisplayStyle.Flex : DisplayStyle.None;
}
internal void UpdateFloatField() {
floatField.SetValueWithoutNotify(Value);
floatField.value = Value;
}
internal float UpdateValue() {
float value = Mathf.Lerp(MinValue, MaxValue, SlidingValue);
float value = (MaxValue - MinValue) * SlidingValue;
if (dataType == RoundDataType.) { value = (float)Math.Round(value, 2); }
if (dataType == RoundDataType.) { value = Mathf.FloorToInt(value); }
return Mathf.Clamp(value, MinValue, MaxValue);
@@ -171,8 +165,6 @@ namespace MuHua {
dragger.RegisterCallback<PointerUpEvent>((evt) => isDragger = false);
dragger.RegisterCallback<PointerLeaveEvent>((evt) => isDragger = false);
floatField.RegisterCallback<ChangeEvent<float>>(UpdateFloatField);
container.RegisterCallback<PointerDownEvent>(ContainerDown);
}
private void DraggerDown(PointerDownEvent evt) {