/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { element = null; // Try get limit attribute for value min/max range setting and slider speed if (Values.Info != null) { var attributes = Values.Info.GetCustomAttributes(true); var range = attributes.FirstOrDefault(x => x is RangeAttribute); if (range != null) { // Use slider var slider = layout.Slider(); slider.SetLimits((RangeAttribute)range); slider.Slider.ValueChanged += () => SetValue(element.Value); element = slider; } var limit = attributes.FirstOrDefault(x => x is LimitAttribute); if (limit != null) { // Use float value editor with limit var floatValue = layout.FloatValue(); floatValue.SetLimits((LimitAttribute)limit); floatValue.FloatValue.ValueChanged += () => SetValue(element.Value); element = floatValue; } } if (element == null) { // Use float value editor var floatValue = layout.FloatValue(); floatValue.FloatValue.ValueChanged += () => SetValue(element.Value); element = floatValue; } }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { _element = null; // Try get limit attribute for value min/max range setting and slider speed var attributes = Values.GetAttributes(); if (attributes != null) { var range = attributes.FirstOrDefault(x => x is RangeAttribute); if (range != null) { // Use slider var slider = layout.Slider(); slider.SetLimits((RangeAttribute)range); slider.Slider.ValueChanged += OnValueChanged; slider.Slider.SlidingEnd += ClearToken; _element = slider; return; } var limit = attributes.FirstOrDefault(x => x is LimitAttribute); if (limit != null) { // Use float value editor with limit var floatValue = layout.FloatValue(); floatValue.SetLimits((LimitAttribute)limit); floatValue.FloatValue.ValueChanged += OnValueChanged; floatValue.FloatValue.SlidingEnd += ClearToken; _element = floatValue; return; } } if (_element == null) { // Use float value editor var floatValue = layout.FloatValue(); floatValue.FloatValue.ValueChanged += OnValueChanged; floatValue.FloatValue.SlidingEnd += ClearToken; _element = floatValue; } }
/// <inheritdoc /> public override void Initialize(LayoutElementsContainer layout) { _element = null; // Try get limit attribute for value min/max range setting and slider speed if (Values.Info != null) { var attributes = Values.Info.GetCustomAttributes(true); var range = attributes.FirstOrDefault(x => x is RangeAttribute); if (range != null) { // Use slider var element = layout.Slider(); element.SetLimits((RangeAttribute)range); element.Slider.ValueChanged += OnValueChanged; element.Slider.SlidingEnd += ClearToken; _element = element; return; } var limit = attributes.FirstOrDefault(x => x is LimitAttribute); if (limit != null) { // Use int value editor with limit var element = layout.IntegerValue(); element.SetLimits((LimitAttribute)limit); element.IntValue.ValueChanged += OnValueChanged; element.IntValue.SlidingEnd += ClearToken; _element = element; return; } } if (_element == null) { // Use int value editor var element = layout.IntegerValue(); element.IntValue.ValueChanged += OnValueChanged; element.IntValue.SlidingEnd += ClearToken; _element = element; } }