# ComplicationSlotBounds

Artifact: [androidx.wear.watchface:watchface-complications](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/ComplicationSlotBounds.kt+class:androidx.wear.watchface.complications.ComplicationSlotBounds) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***


```
public final class ComplicationSlotBounds
```

<br />

*** ** * ** ***

ComplicationSlotBounds are defined by fractional screen space coordinates in unit-square 0..1. These bounds will be subsequently clamped to the unit square and converted to screen space coordinates. NB 0 and 1 are included in the unit square.

One bound is expected per `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` to allow `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`s to change shape depending on the type.

Taps on the watch are tested first against each ComplicationSlot's `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(kotlin.collections.Map,kotlin.collections.Map)` for the relevant `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType`. Its assumed that `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(kotlin.collections.Map,kotlin.collections.Map)` don't overlap. If no intersection was found then taps are checked against `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(kotlin.collections.Map,kotlin.collections.Map)` expanded by `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(kotlin.collections.Map,kotlin.collections.Map)`. Expanded bounds can overlap so the ComplicationSlot with the lowest id that intersects the coordinates, if any, is selected.

## Summary

| ### Public constructors |
|---|
| `[ComplicationSlotBounds](https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#ComplicationSlotBounds(kotlin.collections.Map))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html> perComplicationTypeBounds )` **This method is deprecated.** Use a constructor that specifies perComplicationTypeMargins |
| `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#ComplicationSlotBounds(android.graphics.RectF,android.graphics.RectF)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html bounds, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html margins)` Constructs a ComplicationSlotBounds where all complication types have the same screen space unit-square `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(android.graphics.RectF,android.graphics.RectF)` and `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(android.graphics.RectF,android.graphics.RectF)`. |
| `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#ComplicationSlotBounds(kotlin.collections.Map,kotlin.collections.Map)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html> perComplicationTypeBounds, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html> perComplicationTypeMargins )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html>` | `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#getPerComplicationTypeBounds()()` Per `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` fractional unit-square screen space complication bounds. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html>` | `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#getPerComplicationTypeMargins()()` Per `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` fractional unit-square screen space complication margins for tap detection (doesn't affect rendering). |
| `int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#toString()()` |

## Public constructors

### ComplicationSlotBounds

```
public [ComplicationSlotBounds](https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#ComplicationSlotBounds(kotlin.collections.Map))(
    @NonNull Map<@NonNull ComplicationType, @NonNull RectF> perComplicationTypeBounds
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Use a constructor that specifies perComplicationTypeMargins, use this instead:
>
> ```
> ComplicationSlotBounds(Map<ComplicationType, RectF>, Map<ComplicationType, RectF>)
> ```

### ComplicationSlotBounds

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
public ComplicationSlotBounds(@NonNull RectF bounds, @NonNull RectF margins)
```

Constructs a ComplicationSlotBounds where all complication types have the same screen space unit-square `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(android.graphics.RectF,android.graphics.RectF)` and `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationSlotBounds#(android.graphics.RectF,android.graphics.RectF)`.

### ComplicationSlotBounds

```
public ComplicationSlotBounds(
    @NonNull Map<@NonNull ComplicationType, @NonNull RectF> perComplicationTypeBounds,
    @NonNull Map<@NonNull ComplicationType, @NonNull RectF> perComplicationTypeMargins
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html> perComplicationTypeBounds` | Per `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` fractional unit-square screen space complication bounds. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html> perComplicationTypeMargins` | Per `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` fractional unit-square screen space complication margins for tap detection (doesn't affect rendering). |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getPerComplicationTypeBounds

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

```
public final @NonNull Map<@NonNull ComplicationType, @NonNull RectF> getPerComplicationTypeBounds()
```

Per `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` fractional unit-square screen space complication bounds.

### getPerComplicationTypeMargins

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
public final @NonNull Map<@NonNull ComplicationType, @NonNull RectF> getPerComplicationTypeMargins()
```

Per `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` fractional unit-square screen space complication margins for tap detection (doesn't affect rendering).

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```