Пример #1
0
 protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) =>
 base.CreateDrawableMenuItem(item).With(drawableItem =>
 {
     float hue = (float)depth / max_depth;
     drawableItem.BackgroundColour      = Colour4.FromHSV(hue, 1, 0.3f);
     drawableItem.BackgroundColourHover = Colour4.FromHSV(hue, 0.6f, 0.5f);
 });
Пример #2
0
            private void updateCurrent()
            {
                if (changeInProgress)
                {
                    return;
                }

                changeInProgress = true;
                Current.Value    = Colour4.FromHSV(Hue.Value, Saturation.Value, Value.Value);
                changeInProgress = false;
            }
Пример #3
0
        public void TestExternalChange()
        {
            const float hue        = 0.34f;
            const float saturation = 0.46f;
            const float value      = 0.84f;
            Colour4     colour     = Colour4.FromHSV(hue, saturation, value);

            AddStep("set colour", () => colourPicker.Current.Value = colour);

            assertHue(hue);
            assertSaturationAndValue(saturation, value);
        }
Пример #4
0
        public void TestExternalChangeWhileNotPresent()
        {
            const float hue        = 0.34f;
            const float saturation = 0.46f;
            const float value      = 0.84f;

            AddStep("hide picker", () => colourPicker.Hide());
            AddStep("set HSV manually", () =>
            {
                colourPicker.SaturationValueControl.Hue.Value        = hue;
                colourPicker.SaturationValueControl.Saturation.Value = saturation;
                colourPicker.SaturationValueControl.Value.Value      = value;
            });

            AddUntilStep("colour is correct", () => colourPicker.Current.Value == Colour4.FromHSV(hue, saturation, value));
        }
Пример #5
0
        public void TestExternalHSVChange()
        {
            const float hue        = 0.34f;
            const float saturation = 0.46f;
            const float value      = 0.84f;

            ColourPicker colourPicker = null;

            AddStep("create picker", () => Child = colourPicker = new BasicColourPicker
            {
                Current = { Value = Colour4.Goldenrod }
            });
            AddStep("hide picker", () => colourPicker.Hide());
            AddStep("set HSV manually", () =>
            {
                var saturationValueControl = this.ChildrenOfType <HSVColourPicker.SaturationValueSelector>().Single();

                saturationValueControl.Hue.Value        = hue;
                saturationValueControl.Saturation.Value = saturation;
                saturationValueControl.Value.Value      = value;
            });

            AddUntilStep("colour is correct", () => colourPicker.Current.Value == Colour4.FromHSV(hue, saturation, value));
        }
Пример #6
0
 public void TestHueUnchangedIfSaturationAlmostZero()
 {
     AddStep("change colour", () => colourPicker.Current.Value = Colour4.FromHSV(0.5f, 0.5f, 0.5f));
     AddStep("set saturation to 0", () => colourPicker.SaturationValueControl.Saturation.Value = 0);
     AddAssert("hue is unchanged", () => colourPicker.HueControl.Hue.Value == 0.5f);
 }
Пример #7
0
 private void hueChanged()
 {
     hueBox.Colour = Colour4.FromHSV(Hue.Value, 1, 1);
     updateCurrent();
 }
Пример #8
0
 protected override void LoadComplete()
 {
     hue.BindValueChanged(h => fill.Colour = Colour4.FromHSV(h.NewValue, 1, 1), true);
 }