Esempio n. 1
0
        void SetSlidersValues(SliderItem si)
        {
            switch (si.SliderType)
            {
            case SliderTypeEnum.RGB:
                hueSlider.Value   = si.PatternPoint.H;
                satSlider.Value   = si.PatternPoint.S;
                lightSlider.Value = si.PatternPoint.L;
                UpdateSlidersInfo(si.PatternPoint);
                break;

            case SliderTypeEnum.W:
                whiteSlider.Value = si.PatternPoint.WhiteD;
                UpdateSlidersInfo(si.PatternPoint);
                break;

            case SliderTypeEnum.WT:
                whiteSlider.Value = si.PatternPoint.WhiteD;
                tempSlider.Value  = si.PatternPoint.Temp;
                UpdateSlidersInfo(si.PatternPoint);
                break;

            case SliderTypeEnum.Warm:
                warmSlider.Value = si.PatternPoint.WarmD;
                UpdateSlidersInfo(si.PatternPoint);
                break;

            case SliderTypeEnum.Cold:
                coldSlider.Value = si.PatternPoint.ColdD;
                UpdateSlidersInfo(si.PatternPoint);
                break;
            }
        }
Esempio n. 2
0
        SliderItem CreateSlider(int value, int max, PatternPoint point)
        {
            SliderItem si = new SliderItem();

            si.PatternPoint   = point;
            si.Minimum        = 1;
            si.Maximum        = max;
            si.SelectionStart = 1;
            si.SelectionEnd   = max;
            si.Value          = value;
            return(si);
        }
Esempio n. 3
0
        private static void SelectedSliderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ColorRange rangeToSelect = null;
            ColorPanel panel         = null;

            if (d != null)
            {
                panel = (ColorPanel)d;
                SliderItem si = panel.SelectedSlider;

                if (si != null)
                {
                    if (si.SliderType == SliderTypeEnum.RGB)
                    {   // Установка указателя на цветовой диапазоно
                        foreach (ColorRange cr in panel.ColorRangeList)
                        {
                            cr.IsSelected = false;
                            if (cr.HueMinimum <= si.PatternPoint.H)
                            {
                                if (rangeToSelect == null)
                                {
                                    rangeToSelect            = cr;
                                    rangeToSelect.IsSelected = true;
                                }
                            }
                        }
                        panel.SelectedRange = rangeToSelect;
                        panel.hueSlider.UpdateScaleGradient(panel.SelectedRange);
                    }

                    panel.blockChangePoint = true;

                    panel.SetSlidersValues(si);
                    panel.PrepareSliderBehaviors(si);

                    panel.blockChangePoint = false;
                }
                else
                {
                    panel.hueSlider.IsEnabled   = false;
                    panel.satSlider.IsEnabled   = false;
                    panel.lightSlider.IsEnabled = false;
                    panel.whiteSlider.IsEnabled = false;
                    panel.tempSlider.IsEnabled  = false;
                    panel.warmSlider.IsEnabled  = false;
                    panel.coldSlider.IsEnabled  = false;
                }
            }
        }
Esempio n. 4
0
        void PrepareSliderBehaviors(SliderItem si)
        {
            si.WheelVariableChanged += UpdateSlidersFromWheel;

            switch (si.SliderType)
            {
            case SliderTypeEnum.RGB:
                if (si.Variant != PointVariant.Lightness)
                {
                    hueSlider.IsEnabled   = true;
                    satSlider.IsEnabled   = true;
                    lightSlider.IsEnabled = true;
                }
                else
                {
                    hueSlider.IsEnabled   = false;
                    satSlider.IsEnabled   = false;
                    lightSlider.IsEnabled = true;
                }
                break;

            case SliderTypeEnum.W:
                whiteSlider.IsEnabled = true;
                break;

            case SliderTypeEnum.WT:
                if (si.Variant != PointVariant.Lightness)
                {
                    whiteSlider.IsEnabled = true;
                    tempSlider.IsEnabled  = true;
                }
                else
                {
                    whiteSlider.IsEnabled = true;
                    tempSlider.IsEnabled  = false;
                }
                break;

            case SliderTypeEnum.Cold:
                coldSlider.IsEnabled = true;
                warmSlider.IsEnabled = false;
                break;

            case SliderTypeEnum.Warm:
                warmSlider.IsEnabled = true;
                coldSlider.IsEnabled = false;
                break;
            }
        }
Esempio n. 5
0
        private void CW_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            SliderItem si = SelectedSlider;

            if (!blockChangePoint)
            {
                if (si != null)
                {
                    HslSlider slider = (HslSlider)sender;
                    switch (slider.ColorScale)
                    {
                    case SliderScaleEnum.Warm:
                        si.PatternPoint.WarmD        = e.NewValue;
                        si.PatternPoint.InitialWarmD = e.NewValue;

                        if (si.Variant == PointVariant.RangeLeft)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                        }
                        if (si.Variant == PointVariant.RangeRight)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                        }
                        break;

                    case SliderScaleEnum.Cold:
                        si.PatternPoint.ColdD        = e.NewValue;
                        si.PatternPoint.InitialColdD = e.NewValue;

                        if (si.Variant == PointVariant.RangeLeft)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                        }
                        if (si.Variant == PointVariant.RangeRight)
                        {
                            si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                        }
                        break;
                    }

                    si.UpdatePattern();
                }
            }
            UpdateSlidersInfo(si.PatternPoint);
        }
Esempio n. 6
0
        /****************************************************************************/

        #region Mouse Input

        private void colorSelector_MouseDown(object sender, MouseButtonEventArgs e)
        {
            ColorRange cr = (ColorRange)((e.OriginalSource as System.Windows.Shapes.Rectangle).DataContext);

            Console.WriteLine($"HueFrom {cr.HueMinimum}  HueTo {cr.HueMaximum}");
            if (SelectedSlider != null)
            {
                if (SelectedSlider.Variant != PointVariant.Lightness)
                {
                    SliderItem si = SelectedSlider;

                    hueSlider.UpdateScaleGradient(cr);

                    si.PatternPoint.H = cr.HueMiddle;
                    si.PatternPoint.S = si.PatternPoint.S; //= 1.0;
                    si.PatternPoint.L = si.PatternPoint.L; //0.5;
                    si.PatternPoint.SaveLightness();
                    si.PatternPoint.UpdatePoint_RGB();

                    blockChangePoint = true;
                    SetSlidersValues(si);
                    blockChangePoint = false;

                    if (si.Variant == PointVariant.RangeLeft)
                    {
                        si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                    }
                    if (si.Variant == PointVariant.RangeRight)
                    {
                        si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                    }

                    si.PatternPoint.SaveLightness();
                    si.PatternPoint.UpdatePoint_RGB();
                    si.UpdatePattern();
                }
                if (SelectedRange != null)
                {
                    SelectedRange.IsSelected = false;
                }
                cr.IsSelected = true;
                SelectedRange = cr;
            }
        }
Esempio n. 7
0
        /****************************************************************************/

        #region ValueChanged Handlers

        private void hslSliders_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            SliderItem si = SelectedSlider;

            if (!blockChangePoint)
            {
                HslSlider slider = (HslSlider)sender;
                if (slider.ColorScale == SliderScaleEnum.H)
                {
                    si.PatternPoint.H = e.NewValue;
                }
                if (slider.ColorScale == SliderScaleEnum.S)
                {
                    si.PatternPoint.S = e.NewValue;
                }
                if (slider.ColorScale == SliderScaleEnum.L)
                {
                    si.PatternPoint.L = e.NewValue;
                    si.PatternPoint.SaveLightness();
                }

                si.PatternPoint.UpdatePoint_RGB();

                if (si.Variant == PointVariant.RangeLeft)
                {
                    si.PatternPoint.CopyTo(si.Owner[si.Ix + 1].PatternPoint, si.SliderType);
                }
                if (si.Variant == PointVariant.RangeRight)
                {
                    si.PatternPoint.CopyTo(si.Owner[si.Ix - 1].PatternPoint, si.SliderType);
                }

                si.UpdatePattern();
            }
            UpdateSlidersInfo(si.PatternPoint);
        }
Esempio n. 8
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            List <SliderItem> lightSliders = new List <SliderItem>();
            int        prevIx       = -1;
            int        nextIx       = -1;
            SliderItem activeSlider = null;
            SliderItem secondRange  = null;
            int        ix           = -1;

            base.OnKeyDown(e);

            if (e.Source is MultiSlider)
            {
                if (SelectedSlider != null)
                {
                    if (e.Key == Key.Delete)
                    {
                        ix = SliderList.IndexOf(SelectedSlider);

                        #region Delete Gradient

                        if (SelectedSlider.Variant == PointVariant.Gradient)
                        {
                            if (SliderList.Count != 1)
                            {
                                if (ix == 0)
                                {
                                    // первый слайдер в списке
                                    nextIx = 0;
                                    do // необходимо удалить промежуточные яркостные точки справа
                                    {
                                        nextIx++;
                                        if (SliderList[nextIx].Variant == PointVariant.Lightness)
                                        {
                                            lightSliders.Add(SliderList[nextIx]);
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    } while (nextIx != SliderList.Count - 1);
                                    activeSlider = SliderList[nextIx];
                                    foreach (SliderItem si in lightSliders)
                                    {
                                        SliderList.Remove(si);
                                    }
                                    goto M1;
                                }

                                if (ix == SliderList.Count - 1)
                                {
                                    // последний слайдер в списке
                                    prevIx = SliderList.Count - 1;
                                    do  // удаляем промежуточные яркостные точки слева
                                    {
                                        prevIx--;
                                        if (SliderList[prevIx].Variant == PointVariant.Lightness)
                                        {
                                            SliderList.Remove(SliderList[prevIx]);
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    } while (prevIx != 0);
                                    activeSlider = SliderList[prevIx];
                                    goto M1;
                                }

                                nextIx = ix;
                                do // пропускаем промежуточные яркостные точки справа
                                {
                                    nextIx++;
                                    if (SliderList[nextIx].Variant != PointVariant.Lightness)
                                    {
                                        break;
                                    }
                                } while (nextIx != SliderList.Count - 1);
                                activeSlider = SliderList[nextIx];

M1:

                                SliderList.Remove(SelectedSlider);
                                SelectedSlider.IsSelected = false;
                                ReArrangeSliderItems();

                                if (activeSlider != null)
                                {
                                    activeSlider.IsSelected = true;
                                    SelectedSlider          = activeSlider;
                                    UpdatePatternCommand.Execute(activeSlider);
                                }
                            }
                            return;
                        }

                        #endregion

                        #region Delete Range

                        if (SelectedSlider.Variant == PointVariant.RangeLeft || SelectedSlider.Variant == PointVariant.RangeRight)
                        {
                            if (SliderList.Count != 2)
                            {
                                // первый диапазон в списке
                                if ((SelectedSlider.Variant == PointVariant.RangeLeft && ix == 0) ||
                                    (SelectedSlider.Variant == PointVariant.RangeRight && ix == 1))
                                {
                                    if (SelectedSlider.Variant == PointVariant.RangeLeft)
                                    {
                                        nextIx      = 1;
                                        secondRange = SliderList[nextIx]; // rangeRight
                                    }
                                    else
                                    {
                                        nextIx      = ix;
                                        secondRange = SliderList[nextIx - 1]; // rangeLeft
                                    }

                                    do // необходимо удалить яркостные точки справа
                                    {
                                        nextIx++;
                                        if (SliderList[nextIx].Variant == PointVariant.Lightness)
                                        {
                                            lightSliders.Add(SliderList[nextIx]);
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    } while (nextIx != SliderList.Count - 1);

                                    activeSlider = SliderList[nextIx];

                                    foreach (SliderItem si in lightSliders)
                                    {
                                        SliderList.Remove(si);
                                    }
                                    goto M2;
                                }

                                // последний диапазон в списке
                                if ((SelectedSlider.Variant == PointVariant.RangeRight && ix == SliderList.Count - 1) ||
                                    (SelectedSlider.Variant == PointVariant.RangeLeft && ix == SliderList.Count - 2))
                                {
                                    if (SelectedSlider.Variant == PointVariant.RangeRight)
                                    {
                                        prevIx      = SliderList.Count - 1 - 1; // rangeLeftIx
                                        secondRange = SliderList[prevIx];
                                    }
                                    else
                                    {
                                        prevIx      = ix;
                                        secondRange = SliderList[prevIx + 1];
                                    }

                                    do  // удаляем промежуточные яркостные точки слева
                                    {
                                        prevIx--;
                                        if (SliderList[prevIx].Variant == PointVariant.Lightness)
                                        {
                                            SliderList.Remove(SliderList[prevIx]);
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    } while (prevIx != 0);
                                    activeSlider = SliderList[prevIx];
                                    goto M2;
                                }

                                // диапазон внутри списка

                                if (SelectedSlider.Variant == PointVariant.RangeLeft)
                                {
                                    secondRange = SliderList[ix + 1];
                                    nextIx      = ix + 1;
                                }
                                else
                                {
                                    secondRange = SliderList[ix - 1];
                                    nextIx      = ix;
                                }

                                do // пропускаем промежуточные яркостные точки справа
                                {
                                    nextIx++;
                                    if (SliderList[nextIx].Variant != PointVariant.Lightness)
                                    {
                                        break;
                                    }
                                } while (nextIx != SliderList.Count - 1);
                                activeSlider = SliderList[nextIx];


M2:
                                SliderList.Remove(SelectedSlider);
                                SliderList.Remove(secondRange);
                                ReArrangeSliderItems();
                                if (activeSlider != null)
                                {
                                    activeSlider.IsSelected = true;
                                    SelectedSlider          = activeSlider;
                                    UpdatePatternCommand.Execute(activeSlider);
                                }
                            }
                            return;
                        }

                        #endregion

                        #region Delete Lightness

                        if (SelectedSlider.Variant == PointVariant.Lightness)
                        {
                            activeSlider = SliderList[ix + 1];
                            SliderList.Remove(SelectedSlider);
                            //SelectedSlider.IsSelected = false;
                            ReArrangeSliderItems();
                            activeSlider.IsSelected = true;
                            SelectedSlider          = activeSlider;
                            UpdatePatternCommand.Execute(activeSlider);
                        }

                        #endregion
                    }
                }
            }
        }
Esempio n. 9
0
        private void OnTrackClick(object sender, MouseButtonEventArgs e)
        {
            SliderItem newSlider = null;

            if (e.ClickCount == 2)      // DoubleClick
            {
                if (e.Source is Border && (e.Source as Border).Name == "PART_Track")
                {
                    System.Windows.Point pt = e.GetPosition((UIElement)sender);
                    double halfStep         = (slidersArea.ActualWidth + 2 * Margin.Left) / this.Maxlimit;
                    int    sliderPos        = Convert.ToInt32(pt.X / halfStep) + 1;
                    //Console.WriteLine($"ActualWidth + Margin {slidersArea.ActualWidth + 2 * this.Margin.Left}");
                    //Console.WriteLine($"ptX {pt.X}");
                    //Console.WriteLine($"LedPos: {sliderPos}");
                    //Console.WriteLine($"CurrentMode: {AddMode}");

                    // AddMode = 0 Gradient
                    // AddMode = 1 Range
                    // AddMode = 2 Lightness

                    PatternPoint pp = Pattern[sliderPos - 1];

                    // нельзя добавить слайдер в существующую позицию
                    if (SliderList.FirstOrDefault(p => p.Value == (double)sliderPos) != null)
                    {
                        return;
                    }

                    // если первая точка в Pattern
                    if (sliderPos < SliderList[0].Value)
                    {
                        SliderItem tmpSi = SliderList[0];
                        switch (AddMode)
                        {
                        case 1:       //Range
                            SliderList[0].PatternPoint.CopyTo(pp, SliderList[0].SliderType);
                            SliderItem rangeLeft = CreateSlider(sliderPos, Maxlimit, pp);
                            rangeLeft.Variant = PointVariant.RangeLeft;
                            newSlider         = rangeLeft;
                            SliderItem rangeRight = CreateSlider(sliderPos, Maxlimit, pp);
                            rangeRight.Variant = PointVariant.RangeRight;
                            SliderList.Insert(0, rangeRight);
                            SliderList.Insert(0, rangeLeft);
                            ReArrangeSliderItems();
                            UpdatePatternCommand.Execute(rangeRight);
                            break;

                        case 2:         //Lightness
                            break;

                        default:        //Gradient
                            SliderList[0].PatternPoint.CopyTo(pp, SliderList[0].SliderType);
                            SliderItem gradient = CreateSlider(sliderPos, Maxlimit, pp);
                            newSlider = gradient;
                            SliderList.Insert(0, gradient);
                            ReArrangeSliderItems();
                            UpdatePatternCommand.Execute(gradient);
                            break;
                        }
                        if (newSlider != null)
                        {
                            if (SelectedSlider != null)
                            {
                                SelectedSlider.IsSelected = false;
                            }
                            newSlider.IsSelected = true;
                            SelectedSlider       = newSlider;
                        }
                        return;
                    }

                    // если последняя точка в Pattern
                    if (sliderPos > SliderList[SliderList.Count - 1].Value)
                    {
                        SliderItem lastSi = SliderList[SliderList.Count - 1];
                        switch (AddMode)
                        {
                        case 1:         // Range
                            SliderList[SliderList.Count - 1].PatternPoint.CopyTo(pp, SliderList[0].SliderType);
                            SliderItem rangeLeft = CreateSlider(sliderPos, Maxlimit, pp);
                            rangeLeft.Variant = PointVariant.RangeLeft;
                            SliderItem rangeRight = CreateSlider(sliderPos, Maxlimit, pp);
                            rangeRight.Variant = PointVariant.RangeRight;
                            SliderList.Add(rangeLeft);
                            SliderList.Add(rangeRight);
                            ReArrangeSliderItems();
                            UpdatePatternCommand.Execute(rangeLeft);
                            break;

                        case 2:         //Lightness
                            break;

                        default:        //Gradient
                            SliderList[SliderList.Count - 1].PatternPoint.CopyTo(pp, SliderList[0].SliderType);
                            SliderItem gradient = CreateSlider(sliderPos, Maxlimit, pp);
                            SliderList.Add(gradient);
                            ReArrangeSliderItems();

                            UpdatePatternCommand.Execute(gradient);

                            break;
                        }
                        return;
                    }

                    // точка между PatternPoint
                    SliderItem prevSi   = null;
                    SliderItem nextSi   = null;
                    int        minLeft  = Maxlimit;
                    int        minRight = Maxlimit;
                    foreach (SliderItem si in SliderList)
                    {
                        if (si.Value > sliderPos)
                        {
                            if ((si.Value - sliderPos) < minRight)
                            {
                                minRight = (int)si.Value - sliderPos;
                                nextSi   = si;
                            }
                        }

                        if (si.Value < sliderPos)
                        {
                            if ((sliderPos - si.Value) < minLeft)
                            {
                                minLeft = sliderPos - (int)si.Value;
                                prevSi  = si;
                            }
                        }
                    }
                    // нельзя добавить точку внутри Range
                    if (nextSi.Variant == PointVariant.RangeRight)
                    {
                        return;
                    }

                    newSlider = CreateSlider(sliderPos, Maxlimit, Pattern[sliderPos - 1]);
                    int ix = SliderList.IndexOf(nextSi);
                    if (AddMode == 1)
                    {
                        newSlider.Variant = PointVariant.RangeLeft;
                        SliderItem rangeRight = CreateSlider(sliderPos, Maxlimit, Pattern[sliderPos - 1]);
                        rangeRight.Variant = PointVariant.RangeRight;
                        SliderList.Insert(ix, rangeRight);
                        SliderList.Insert(ix, newSlider);
                        ReArrangeSliderItems();
                        if (newSlider != null)
                        {
                            if (SelectedSlider != null)
                            {
                                SelectedSlider.IsSelected = false;
                            }
                            newSlider.IsSelected = true;
                            SelectedSlider       = newSlider;
                        }
                        return;
                    }
                    if (AddMode == 2)
                    {
                        newSlider.Variant = PointVariant.Lightness;
                        newSlider.PatternPoint.SaveLightness();
                    }
                    SliderList.Insert(ix, newSlider);
                    ReArrangeSliderItems();
                    if (newSlider != null)
                    {
                        if (SelectedSlider != null)
                        {
                            SelectedSlider.IsSelected = false;
                        }
                        newSlider.IsSelected = true;
                        SelectedSlider       = newSlider;
                    }
                }
            }
        }
Esempio n. 10
0
        //int currentIx;
        private void OnSliderPositionChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            SliderItem si = (SliderItem)sender;

            Position = si.Pos;
            int newValue = Convert.ToInt32(e.NewValue);

            PatternPoint pp = Pattern[newValue - 1];

            if (si.Variant == PointVariant.Lightness)
            {
                switch (si.SliderType)
                {
                case SliderTypeEnum.RGB:
                    pp.L = si.PatternPoint.L;
                    pp.SaveLightness();
                    pp.UpdatePoint_RGB();
                    break;

                case SliderTypeEnum.W:
                case SliderTypeEnum.WT:
                    pp.WhiteD        = si.PatternPoint.WhiteD;
                    pp.InitialWhiteD = pp.WhiteD;
                    break;

                case SliderTypeEnum.Warm:
                    pp.WarmD        = si.PatternPoint.WarmD;
                    pp.InitialWarmD = pp.WarmD;
                    break;

                case SliderTypeEnum.Cold:
                    pp.ColdD        = si.PatternPoint.ColdD;
                    pp.InitialColdD = pp.ColdD;
                    break;
                }

                //Console.WriteLine($"DeltaT: {pp.Temp - si.PatternPoint.Temp}");

                si.PatternPoint = pp;
                UpdatePatternCommand.Execute(si);

                // для обновления ColorPanel
                SelectedSlider = null;
                SelectedSlider = si;

                return;
            }
            else
            {
                switch (si.SliderType)
                {
                case SliderTypeEnum.RGB:
                    si.PatternPoint.CopyTo(pp, si.SliderType);
                    break;

                case SliderTypeEnum.W:
                    si.PatternPoint.CopyTo(pp, si.SliderType);
                    break;

                case SliderTypeEnum.WT:
                    si.PatternPoint.CopyTo(pp, si.SliderType);
                    break;

                case SliderTypeEnum.Warm:
                    si.PatternPoint.CopyTo(pp, si.SliderType);
                    break;

                case SliderTypeEnum.Cold:
                    si.PatternPoint.CopyTo(pp, si.SliderType);
                    break;
                }
            }

            si.PatternPoint = pp;
            UpdatePatternCommand.Execute(si);
        }
Esempio n. 11
0
        //bool startMove = false;

        private void SliderItemGotMouseCapture(object sender, MouseEventArgs e)
        {
            if (SelectedSlider != null)
            {
                SelectedSlider.IsSelected = false;
            }
            SliderItem si = sender as SliderItem;

            sliderIx                  = SliderList.IndexOf(si);
            SelectedSlider            = si;
            SelectedSlider.IsSelected = true;

            Position = SelectedSlider.Pos;

            // firtst slider in list
            if (sliderIx == 0)
            {
                si.SelectionStart = 1;
                if (SelectedSlider.Variant == PointVariant.RangeLeft)
                {
                    si.SelectionEnd = SliderList[sliderIx + 1].Value;
                }
                else
                {
                    si.SelectionEnd = SliderList[sliderIx + 1].Value - 1;
                }
                return;
            }

            //last slider in list
            if (sliderIx == SliderList.Count - 1)
            {
                si.SelectionEnd = Maxlimit;
                if (SelectedSlider.Variant == PointVariant.RangeRight)
                {
                    si.SelectionStart = SliderList[sliderIx - 1].Value;
                }
                else
                {
                    si.SelectionStart = SliderList[sliderIx - 1].Value + 1;
                }
                return;
            }

            // internal slider
            if (SelectedSlider.Variant == PointVariant.RangeRight)
            {
                si.SelectionStart = SliderList[sliderIx - 1].Value;
                si.SelectionEnd   = SliderList[sliderIx + 1].Value - 1;
                return;
            }

            if (SelectedSlider.Variant == PointVariant.RangeLeft)
            {
                si.SelectionStart = SliderList[sliderIx - 1].Value + 1;
                si.SelectionEnd   = SliderList[sliderIx + 1].Value;
                return;
            }

            if (SelectedSlider.Variant != PointVariant.RangeLeft && SelectedSlider.Variant != PointVariant.RangeRight)
            {
                si.SelectionStart = SliderList[sliderIx - 1].Value + 1;
                si.SelectionEnd   = SliderList[sliderIx + 1].Value - 1;
                return;
            }
        }
Esempio n. 12
0
 public SliderDuplet(SliderItem leftSlider, SliderItem rightSlider, bool onlyLightness = false)
 {
     LeftSlider    = leftSlider;
     RightSlider   = rightSlider;
     OnlyLightness = onlyLightness;
 }