<!-- Source: https://medius.k4tech.net/library/move -->
# Move

_Cursor motion and scroll_

One field-generic verb, [`move_axis`](/library/move.md#move), drives the relative axes. [`move_rel`](/library/move.md#move-rel) and [`wheel`](/library/move.md#wheel) are thin wrappers over it. Each call queues one [fire-and-forget](/native/injection.md#fire-and-forget) [`MOVE`](/native/commands/move.md#move) frame.

| You want | Method | Same as |
| --- | --- | --- |
| move the cursor | [`move_rel(dx, dy)`](/library/move.md#move-rel) | `move_axis(Motion::Cursor { dx, dy })` |
| scroll the wheel | [`wheel(delta)`](/library/move.md#wheel) | `move_axis(Motion::Wheel(dz))` |

## move_axis

_Field-generic motion verb_

```text
fn move_axis(&self, motion: Motion) -> Result<()>
```

_Fire-and-forget_

`motion` is a [`Motion`](/library/types/enums.md#motion): `Cursor { dx, dy }` for pointer movement or `Wheel(dz)` for scroll. Backs the [`MOVE`](/native/commands/move.md#move) command.

#### EXAMPLE

```rust
use medius::Motion;

device.move_axis(Motion::Cursor { dx: 20, dy: 20 })?; // right and down
device.move_axis(Motion::Wheel(1))?;                  // one notch up
```

## move_rel

_Relative cursor movement_

```text
fn move_rel(&self, dx: i16, dy: i16) -> Result<()>
```

_Fire-and-forget_

A wrapper over [`move_axis`](/library/move.md#move) with `Motion::Cursor`.

#### PARAMETERS

| Parameter | Type | Description |
| --- | --- | --- |
| `dx` | `i16` | Horizontal offset in mouse counts. Positive moves right, negative moves left. |
| `dy` | `i16` | Vertical offset in mouse counts. Positive moves down, negative moves up (screen-style, not math-style). |

Offsets are mouse counts, not pixels, scaled by the OS pointer-speed and acceleration curve. Both span the full `i16` range (`-32768 to 32767`).

#### EXAMPLE

```rust
device.move_rel(20, 20)?;  // right and down
device.move_rel(-40, 0)?;  // left
device.move_rel(0, -10)?;  // up
```

## wheel

_Wheel scroll_

```text
fn wheel(&self, delta: i16) -> Result<()>
```

_Fire-and-forget_

A wrapper over [`move_axis`](/library/move.md#move) with `Motion::Wheel`.

#### PARAMETERS

| Parameter | Type | Description |
| --- | --- | --- |
| `delta` | `i16` | Scroll steps. Positive scrolls up, negative scrolls down. |

`delta` spans the full `i16` range (`-32768 to 32767`) and feeds the same [accumulator](/native/injection.md#state) as cursor motion, pacing large values across reports.

#### EXAMPLE

```rust
device.wheel(3)?;   // up three notches
device.wheel(-1)?;  // down one notch
```

## On AsyncDevice

_Movement stays synchronous_

[`AsyncDevice`](/library/features/async.md) keeps `move_axis`, `move_rel`, and `wheel` synchronous: no `.await`, same signatures. The [`block_on`](https://docs.rs/futures/latest/futures/executor/fn.block_on.html) pattern is only for async queries.

#### EXAMPLE

```rust
let dev = Device::find()?.into_async();
dev.move_rel(40, 0)?;  // no .await
dev.wheel(1)?;
```
