Skip to content

Commit

Permalink
feat: allow resetting mouse offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike authored and rsdmike committed Jan 13, 2025
1 parent 755b778 commit 17703e4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/core/AMTIDER.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export declare class AMTIDER {
sectorStats: any;
g_readQueue: any;
g_reset: boolean;
g_media: Blob | null;
g_media: any;
g_dev: number;
g_lba: number;
g_len: number;
Expand Down
1 change: 1 addition & 0 deletions dist/core/Utilities/MouseHelper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export declare class MouseHelper {
mousemove(e: MouseEvent): boolean;
haltEvent(e: any): boolean;
getPositionOfControl(c: HTMLElement | null): number[];
resetOffsets(): void;
}
5 changes: 5 additions & 0 deletions src/core/Utilities/MouseHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@ export class MouseHelper {
}
return Position
}

resetOffsets (): void {
this.topposition = 0
this.leftposition = 0
}
}
12 changes: 12 additions & 0 deletions src/test/mousehelper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,16 @@ describe('Test MouseHelper', () => {
expect(e.screenY).toBe(0)
})

it('Test resetOffsets', () => {
// Input
const comm = new Communicator()
const desktop = new AmtDesktop()
const mousehelper = new MouseHelper(desktop, comm, 0)

// Test resetOffsets
mousehelper.resetOffsets()

expect(mousehelper.leftposition).toBe(0)
expect(mousehelper.topposition).toBe(0)
})
})

0 comments on commit 17703e4

Please sign in to comment.