Skip to content

Commit f6d8c6b

Browse files
committed
(#87) Movement API docs
1 parent fa788ce commit f6d8c6b

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

lib/movement-api.interface.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Point } from "./point.class";
2+
3+
/**
4+
* {@link MovementApi} provides helper functions to generate movement paths relative tot he current mouse position
5+
*/
6+
export interface MovementApi {
7+
/**
8+
* {@link down} generates a downward movement path
9+
* @param px Length of the movement path in pixels
10+
*/
11+
down(px: number): Promise<Point[]>;
12+
/**
13+
* {@link left} generates a leftward movement path
14+
* @param px Length of the movement path in pixels
15+
*/
16+
left(px: number): Promise<Point[]>;
17+
/**
18+
* {@link right} generates a rightward movement path
19+
* @param px Length of the movement path in pixels
20+
*/
21+
right(px: number): Promise<Point[]>;
22+
/**
23+
* {@link straightTo} generates a straight movement path to a given target {@link Point}
24+
* @param target The target {@link Point} to move towards
25+
*/
26+
straightTo(target: Point | Promise<Point>): Promise<Point[]>;
27+
/**
28+
* {@link up} generates a upward movement path
29+
* @param px Length of the movement path in pixels
30+
*/
31+
up(px: number): Promise<Point[]>;
32+
}

lib/movement.function.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { NativeAdapter } from "./adapter/native.adapter.class";
2+
import { MovementApi } from "./movement-api.interface";
23
import { Point } from "./point.class";
34
import { LineHelper } from "./util/linehelper.class";
45

5-
export const createMovementApi = (native: NativeAdapter, lineHelper: LineHelper) => {
6+
export const createMovementApi = (native: NativeAdapter, lineHelper: LineHelper): MovementApi => {
67
return ({
78
down: async (px: number): Promise<Point[]> => {
89
const pos = await native.currentMousePosition();

0 commit comments

Comments
 (0)