Skip to content

Commit

Permalink
QtScrcpyKeymap 备份
Browse files Browse the repository at this point in the history
  • Loading branch information
lb091188 committed Jun 7, 2024
1 parent cd9cb6d commit 287bb2a
Show file tree
Hide file tree
Showing 5 changed files with 551 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@types/highlight.js": "^10.1.0",
"dayjs": "^1.11.10",
"element-plus": "^2.2.17",
"highlight.js": "^11.7.0",
Expand All @@ -20,6 +19,7 @@
"xfe-ajax-ts": "^1.2.1"
},
"devDependencies": {
"@types/highlight.js": "^10.1.0",
"@types/node": "^16.11.56",
"@vitejs/plugin-vue": "^3.0.3",
"@vue/tsconfig": "^0.1.3",
Expand Down
5 changes: 5 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ const router = createRouter({
name: "countDown",
component: () => import("@/views/apps/countDown.vue"),
},
{
path: "qt-scrcpy-keymap",
name: "QtScrcpyKeymap",
component: () => import("@/views/apps/QtScrcpyKeymap.vue"),
},
],
},
],
Expand Down
87 changes: 87 additions & 0 deletions src/util/QtScrcpyKeymap/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
export enum ClickType {
/** 单击 */
KMT_CLICK,
/** 双击 */
KMT_CLICK_TWICE,
/** 连击 */
KMT_CLICK_MULTI,
/** 拖拽 */
KMT_DRAG,
/** 方向 */
KMT_STEER_WHEEL,
}

/** 注释 */
export type Comment = string;

/** 坐标对象 */
export interface Pos {
/** 横坐标,相对值,最大为1 */
x: number;
/** 纵坐标,相对值,最大为1 */
y: number;
}

export interface KMT_CLICK {
comment: Comment;
type: "KMT_CLICK";
key: string;
pos: Pos;
switchMap: boolean;
}
export interface KMT_CLICK_TWICE {
comment: Comment;
type: "KMT_CLICK_TWICE";
key: string;
pos: Pos;
}
export interface KMT_CLICK_MULTI {
comment: Comment;
type: "KMT_CLICK_MULTI";
key: string;
pos: Pos;
delay: number;
}
export interface KMT_DRAG {
comment: Comment;
type: "KMT_DRAG";
key: string;
startPos: Pos;
endPos: Pos;
}

export interface KMT_STEER_WHEEL {
comment: Comment;
type: "KMT_STEER_WHEEL";
centerPos: Pos;
leftOffset: number;
rightOffset: number;
upOffset: number;
downOffset: number;
leftKey: string;
rightKey: string;
upKey: string;
downKey: string;
}

type KeyMapNode = KMT_CLICK | KMT_CLICK_TWICE | KMT_CLICK_MULTI | KMT_DRAG | KMT_STEER_WHEEL;

/** 鼠标移动映射配置 */
export interface MouseMoveMap {
/** 起点坐标 */
startPos?: Pos;
speedRatio?: number;
speedRatioX?: number;
speedRatioY?: number;
smallEyes?: KMT_CLICK;
}

/** keymap 对象 */
export interface KeyMap {
/** 映射开关 */
switchKey: string;
/** 鼠标移动映射 */
mouseMoveMap: MouseMoveMap;
/** 按键映射 */
keyMapNodes: KeyMapNode[];
}
5 changes: 5 additions & 0 deletions src/views/AppList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ const apps = ref([
description: "用可视化的方式表示时间的流失,助理形成时间观念",
path: "/app/count-down",
},
{
name: "QtScrcpy 按键映射辅助",
description: "根据手机截图用可视化的方式来辅助创建 QtScrcpy 的 keymap.json 文件",
path: "/app/qt-scrcpy-keymap",
},
]);
function goto(app) {
router.push(app.path);
Expand Down
Loading

0 comments on commit 287bb2a

Please sign in to comment.