Beispiel #1
0
 //SelectableComponentModel
 void OnSliderChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     ColorChangeSource = ColorChangeSourceType.SliderMove;
     if (ProcessSliderEvents)
     {
         ProcessSliderEvents = false;
         Color = SelectedComponent.ColorAtPoint(SelectionPoint, (int)e.NewValue).WithAlpha(PART_AlphaSlider.Alpha);
         UpdatePlane(SelectedComponent.GetValue(Color).Round().ToInt32());
         ProcessSliderEvents = true;
     }
     ColorChangeSource = ColorChangeSourceType.ColorPropertySet;
 }
Beispiel #2
0
        void OnPlaneMouseDown(Point selectionPoint)
        {
            if (SelectedComponent != null)
            {
                SelectionPoint = selectionPoint;

                double w = PART_ColorPlane.ActualWidth / 2, h = PART_ColorPlane.ActualHeight / 2;

                SelectionTransform.X = (SelectionPoint.X - w).Coerce(w, -w);
                SelectionTransform.Y = (SelectionPoint.Y - h).Coerce(h, -h);

                SelectionPoint = new Point(SelectionPoint.X.Coerce(255d), SelectionPoint.Y.Coerce(255d));

                var NewColor = SelectedComponent.ColorAtPoint(SelectionPoint, (int)PART_Slider.Value);
                if (!SelectedComponent.IsUniform)
                {
                    SelectedComponent.UpdateSlider(NormalPane, NewColor);
                }

                Color = NewColor.WithAlpha(PART_AlphaSlider.Alpha);
            }
        }