File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 1
1
import { NativeAdapter } from "./adapter/native.adapter.class" ;
2
+ import { MovementApi } from "./movement-api.interface" ;
2
3
import { Point } from "./point.class" ;
3
4
import { LineHelper } from "./util/linehelper.class" ;
4
5
5
- export const createMovementApi = ( native : NativeAdapter , lineHelper : LineHelper ) => {
6
+ export const createMovementApi = ( native : NativeAdapter , lineHelper : LineHelper ) : MovementApi => {
6
7
return ( {
7
8
down : async ( px : number ) : Promise < Point [ ] > => {
8
9
const pos = await native . currentMousePosition ( ) ;
You can’t perform that action at this time.
0 commit comments