Vixen
02b45cc4
csharp
public sealed class GradientEditor

Editing a gradient: two rails of stops, a bar, and a picker for whichever is selected.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ Two rails because there are two lists. Colour and alpha are edited separately — see Gradient for why they are stored separately — so the alpha stops sit above the bar and the colour stops below it, which is the arrangement every tool that made the same choice arrived at.

The picker is part of the control rather than something an application wires up. Selecting a colour stop and then having to find where its colour is edited is the whole friction of a gradient editor, and a picker that appears where the selection is removes it. An application that wants its own puts Picker's class in display: none and listens to SelectionChanged.

Fields and properties (11)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public Gradient Gradient

    The gradient being edited.

  • public GradientRail AlphaRail

    The rail of alpha stops, above the bar.

  • public GradientBar Bar

    The strip.

  • public GradientRail ColorRail

    The rail of colour stops, below it.

  • public Select Space

    How the colours are mixed.

  • public ColorPicker Picker

    The picker, shown when a colour stop is selected.

  • public Slider Opacity

    The opacity slider, shown when an alpha stop is selected.

  • public GradientColorStop? SelectedColorStop

    Which colour stop is selected, if one is.

  • public GradientAlphaStop? SelectedAlphaStop

    Which alpha stop is selected, if one is.

Events (2)

  • public Action<GradientEditor>? GradientChanged

    Raised after the gradient changes.

  • public Action<GradientEditor>? SelectionChanged

    Raised when a different stop is selected.

Methods (7)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • public void Select(GradientColorStop? stop)

    Selects a colour stop, and shows the picker for it.

  • public void Select(GradientAlphaStop? stop)

    Selects an alpha stop, and shows the opacity slider for it.

  • public float ToScreen(float position)

    Where a position along the gradient is, in document space.

  • public float ToPosition(float x)

    Which position along the gradient a document-space x is.

  • public GradientColorStop? ColorStopAt(float x, float radius = 9)

    The colour stop nearest a point on the colour rail, if one is within reach.

  • public GradientAlphaStop? AlphaStopAt(float x, float radius = 9)

    The alpha stop nearest a point on the alpha rail, if one is within reach.

Used by (3)

  • GradientBarVixen.Ui.Controls.Advanced
  • GradientEditorTestsVixen.Ui.Controls.Advanced.Tests
  • GradientRailVixen.Ui.Controls.Advanced