Exemplo n.º 1
0
        public Slider(
            float val,
            float min,
            float max,
            EventCallback <float> valueCB,
            EventCallback <float> minCB,
            EventCallback <float> maxCB
            )
        {
            ValueCallback = valueCB;
            MinCallback   = minCB;
            MaxCallback   = maxCB;

            Value = val;

            contentContainer.AddToClassList("bounded-float");
            contentContainer.AddToClassList("range");

            Range = new SliderFloat {
                highValue = max,
                lowValue  = min,
                value     = val
            };

            Min = new FloatField {
                value = min
            };
            Current = new FloatField {
                value = val
            };
            Max = new FloatField {
                value = max
            };

            Min.AddToClassList("min-value");
            Current.AddToClassList("current-value");
            Max.AddToClassList("max-value");

            var Fields = new VisualElement();

            Fields.AddToClassList("input-fields");

            Fields.Add(Min);
            Fields.Add(Current);
            Fields.Add(Max);

            contentContainer.Add(Range);
            contentContainer.Add(Fields);

            Range.RegisterValueChangedCallback(CurrentChanged);
            Min.RegisterValueChangedCallback(MinChanged);
            Current.RegisterValueChangedCallback(CurrentChanged);
            Max.RegisterValueChangedCallback(MaxChanged);
        }