# Xui.ToolKit.UI.Layer

Assembly: **Xui.ToolKit.UI** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`struct PressFeedbackLayer<TView>`](#api-d2a137a17ee1fdc6)

<a id="api-d2a137a17ee1fdc6"></a>

## `struct PressFeedbackLayer<TView>`

Delayed press feedback and bounded, overlapping ripples. The host owns gesture capture and calls Begin/End when a press starts, commits or is cancelled. One layer can paint many logical cells by selecting a Target before arranging/rendering; it never allocates per-cell state.

```csharp
public struct PressFeedbackLayer<TView> : ILayer<TView> where TView : class, ILayerHost
{
    public int Target;
    public Color Background;
    public Color RippleColor;
    public CornerRadius CornerRadius;
    public static bool ShouldDelay(TView view, ref PointerEventRef e);
    public void Begin(TView view, Point position, bool delay);
    public void End(TView view, bool tapped);
    public void HoldReleasedFeedback();
    public void Activate(TView view);
    public readonly bool IsPressVisible { get; }
    public nfloat FeedbackOpacity { get; }

    public Size Measure(TView view, Size availableSize, IMeasureContext context);
    public void Arrange(TView view, Rect rect, IMeasureContext context);
    public void SetBounds(Rect rect);
    public void Render(TView view, IContext context);
    public void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
    public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(TView view, ref KeyEventRef e);
    public void OnChar(TView view, ref KeyEventRef e);
    public void OnFocus(TView view);
    public void OnBlur(TView view);
}
```

<a id="api-6e4ab5fc22fc291e"></a>

### [`void PressFeedbackLayer<TView>.Activate(TView view)`](#api-6e4ab5fc22fc291e)


```csharp
public void Activate(TView view);
```

Resumes completed feedback after reparenting, or clears it if the clock changed.

<a id="api-51130d2066237e99"></a>

### [`void PressFeedbackLayer<TView>.Animate(TView view, TimeSpan previousTime, TimeSpan currentTime)`](#api-51130d2066237e99)


```csharp
public void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-e2a2a9d61e84359c"></a>

### [`void PressFeedbackLayer<TView>.Arrange(TView view, Rect rect, IMeasureContext context)`](#api-e2a2a9d61e84359c)


```csharp
public void Arrange(TView view, Rect rect, IMeasureContext context);
```

Finalises position and size within `rect`.

<a id="api-d070b7143ab11687"></a>

### [`Color PressFeedbackLayer<TView>.Background`](#api-d070b7143ab11687)


```csharp
public Color Background;
```

Optional pressed background; transparent by default.

<a id="api-6b67b1d22d2fae51"></a>

### [`void PressFeedbackLayer<TView>.Begin(TView view, Point position, bool delay)`](#api-6b67b1d22d2fae51)


```csharp
public void Begin(TView view, Point position, bool delay);
```

Starts feedback at a point in the same coordinate space as the arranged bounds.

<a id="api-cb00a614804d021e"></a>

### [`CornerRadius PressFeedbackLayer<TView>.CornerRadius`](#api-cb00a614804d021e)


```csharp
public CornerRadius CornerRadius;
```

Outline used to clip feedback to the arranged bounds.

<a id="api-08b62b6c860bb50d"></a>

### [`void PressFeedbackLayer<TView>.End(TView view, bool tapped)`](#api-08b62b6c860bb50d)


```csharp
public void End(TView view, bool tapped);
```

Quick taps show immediately and hold for 200ms; early scroll cancellation stays invisible.

<a id="api-d16e7cc58cbcbdd3"></a>

### [`NFloat PressFeedbackLayer<TView>.FeedbackOpacity`](#api-d16e7cc58cbcbdd3)


```csharp
public nfloat FeedbackOpacity { get; }
```

Current background strength for Target, for hosts that blend their own themed fill.

<a id="api-adedcfc48ecc9906"></a>

### [`void PressFeedbackLayer<TView>.HoldReleasedFeedback()`](#api-adedcfc48ecc9906)


```csharp
public void HoldReleasedFeedback();
```

Keeps the most recently committed tap visible while its host awaits the first highlighted render.

<a id="api-a858909d349a8f7b"></a>

### [`readonly bool PressFeedbackLayer<TView>.IsPressVisible`](#api-a858909d349a8f7b)


```csharp
public readonly bool IsPressVisible { get; }
```

Whether the current press has reached its highlight recognition time.

<a id="api-c2c659f1577d7c11"></a>

### [`Size PressFeedbackLayer<TView>.Measure(TView view, Size availableSize, IMeasureContext context)`](#api-c2c659f1577d7c11)


```csharp
public Size Measure(TView view, Size availableSize, IMeasureContext context);
```

Returns the desired border-edge size given the available space.

<a id="api-43c1a459bcd3409b"></a>

### [`void PressFeedbackLayer<TView>.OnBlur(TView view)`](#api-43c1a459bcd3409b)


```csharp
public void OnBlur(TView view);
```

Called when the host view loses keyboard focus.

<a id="api-45ec10982be8dcca"></a>

### [`void PressFeedbackLayer<TView>.OnChar(TView view, ref KeyEventRef e)`](#api-45ec10982be8dcca)


```csharp
public void OnChar(TView view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-8c0c09bde6b9cb49"></a>

### [`void PressFeedbackLayer<TView>.OnFocus(TView view)`](#api-8c0c09bde6b9cb49)


```csharp
public void OnFocus(TView view);
```

Called when the host view gains keyboard focus.

<a id="api-7736b49adfe6a3ca"></a>

### [`void PressFeedbackLayer<TView>.OnKeyDown(TView view, ref KeyEventRef e)`](#api-7736b49adfe6a3ca)


```csharp
public void OnKeyDown(TView view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-41de0fb31d5ba47e"></a>

### [`void PressFeedbackLayer<TView>.OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase)`](#api-41de0fb31d5ba47e)


```csharp
public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-673c51e3768f9071"></a>

### [`void PressFeedbackLayer<TView>.Render(TView view, IContext context)`](#api-673c51e3768f9071)


```csharp
public void Render(TView view, IContext context);
```

Draws content. Called after Arrange.

<a id="api-20ec4f7795326750"></a>

### [`Color PressFeedbackLayer<TView>.RippleColor`](#api-20ec4f7795326750)


```csharp
public Color RippleColor;
```

Ripple color, rendered at twelve percent opacity.

<a id="api-8de18b993d7ef28b"></a>

### [`void PressFeedbackLayer<TView>.SetBounds(Rect rect)`](#api-8de18b993d7ef28b)


```csharp
public void SetBounds(Rect rect);
```

Sets bounds before input, without requiring a drawing/measurement context.

<a id="api-33167526d3e47dcc"></a>

### [`bool PressFeedbackLayer<TView>.ShouldDelay(TView view, ref PointerEventRef e)`](#api-33167526d3e47dcc)


```csharp
public static bool ShouldDelay(TView view, ref PointerEventRef e);
```

Whether a competing ancestor drag gesture warrants a touch recognition delay.

<a id="api-d3f9bbfd5e770ad1"></a>

### [`int PressFeedbackLayer<TView>.Target`](#api-d3f9bbfd5e770ad1)


```csharp
public int Target;
```

Logical cell to begin or render. Leave at zero for a single button.

