Skip to content

Commit 4756dda

Browse files
committed
feat(monkey): expand mouse interaction grid from 3x2 to 7x5
- Add GRID_COLUMN and GRID_ROW constants for 7x5 grid layout - Extend ACTION_GRID_MAP to cover larger interaction areas - Update useMouseWatcher to use new grid dimensions - Improve grid layout documentation with visual representation
1 parent 4c18c0f commit 4756dda

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

src/monkey/copymanga-enhance/scripts/newPage/constant.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,28 @@ export enum PageType {
1111
WHITE_PAGE = 'white_page',
1212
}
1313

14+
/**
15+
* ```markdown
16+
* |1 |2 |3 |4 |5 |6 |7 |
17+
* |8 |9 |10|11|12|13|14|
18+
* |15|16|17|18|19|20|21|
19+
* |22|23|24|25|26|27|28|
20+
* |29|30|31|32|33|34|35|
21+
* ```
22+
*/
23+
export const GRID_COLUMN = 7
24+
export const GRID_ROW = 5
1425
export const ACTION_GRID_MAP = {
15-
PREV: [1, 3, 4],
16-
NEXT: [6],
26+
PREV: [
27+
1, 2, 3, 4, 5, 6, 7,
28+
8, 9, 10, 11, 12, 13, 14,
29+
15, 16, 17,
30+
22, 23, 24,
31+
29, 30, 31,
32+
],
33+
NEXT: [
34+
19, 20, 21,
35+
26, 27, 28,
36+
33, 34, 35,
37+
],
1738
}

src/monkey/copymanga-enhance/scripts/newPage/hooks/useMouseWatcher.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ACTION_GRID_MAP } from "../constant";
1+
import { ACTION_GRID_MAP, GRID_COLUMN, GRID_ROW } from "../constant";
22
import { onMounted, readonly, ref, unref } from "../vue";
33
import useMouseGrid from "./useMouseGrid";
44
import useScrollBy from "./useScrollBy";
@@ -10,15 +10,9 @@ export default function useMouseWatcher () {
1010
const appBody = document.querySelector('.app-body') as HTMLElement | null
1111
if (!appBody) return
1212

13-
/**
14-
* ```markdown
15-
* |1|2|3|
16-
* |4|5|6|
17-
* ```
18-
*/
1913
const getGridIndex = (x: number, y: number) => {
20-
const COUNT_COLUMN = 3
21-
const COUNT_ROW = 2
14+
const COUNT_COLUMN = GRID_COLUMN
15+
const COUNT_ROW = GRID_ROW
2216
const rect = appBody.getBoundingClientRect()
2317
if (x < rect.left || x > rect.right || y < rect.top || y > rect.bottom) return -1
2418
const colWidth = rect.width / COUNT_COLUMN

0 commit comments

Comments
 (0)