🔨 添加长按操作.
This commit is contained in:
@@ -47,9 +47,6 @@ public class TerminalSessionVncConfig extends VncConnectConfig implements ITermi
|
|||||||
@Schema(description = "logId")
|
@Schema(description = "logId")
|
||||||
private Long logId;
|
private Long logId;
|
||||||
|
|
||||||
@Schema(description = "录屏文件路径")
|
|
||||||
private String recordPath;
|
|
||||||
|
|
||||||
@Schema(description = "宽")
|
@Schema(description = "宽")
|
||||||
private Integer width;
|
private Integer width;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<template>
|
||||||
|
<a-space>
|
||||||
|
<a-tag v-for="item in GuacdKeyboardItems"
|
||||||
|
:key="item.name"
|
||||||
|
:default-checked="session.displayHandler.keyboardDownKeys.includes(item.key)"
|
||||||
|
checkable
|
||||||
|
bordered
|
||||||
|
@check="(checked: boolean) => setChecked(item.key, checked)">
|
||||||
|
{{ item.name }}
|
||||||
|
</a-tag>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'triggerKeyAction'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { IGuacdSession } from '@/views/terminal/interfaces';
|
||||||
|
import { GuacdKeyboardItems } from '@/views/terminal/types/const';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
session: IGuacdSession;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 设置选中
|
||||||
|
const setChecked = (key: number, checked: boolean) => {
|
||||||
|
const keys = props.session.displayHandler.keyboardDownKeys;
|
||||||
|
if (checked) {
|
||||||
|
keys.push(key);
|
||||||
|
} else {
|
||||||
|
const index = keys.findIndex(s => s === key);
|
||||||
|
if (index !== -1) {
|
||||||
|
keys.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
</style>
|
||||||
@@ -86,6 +86,7 @@ export interface IGuacdSessionDisplayHandler {
|
|||||||
displayDpi: number;
|
displayDpi: number;
|
||||||
autoFit: boolean;
|
autoFit: boolean;
|
||||||
localCursor: boolean;
|
localCursor: boolean;
|
||||||
|
keyboardDownKeys: number[];
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
init: () => void;
|
init: () => void;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export default class GuacdSessionDisplayHandler implements IGuacdSessionDisplayH
|
|||||||
public displayDpi: number;
|
public displayDpi: number;
|
||||||
public autoFit: boolean;
|
public autoFit: boolean;
|
||||||
public localCursor: boolean;
|
public localCursor: boolean;
|
||||||
|
public keyboardDownKeys: Array<number>;
|
||||||
|
|
||||||
private display?: Guacamole.Display;
|
private display?: Guacamole.Display;
|
||||||
private sink?: Guacamole.InputSink;
|
private sink?: Guacamole.InputSink;
|
||||||
@@ -28,6 +29,7 @@ export default class GuacdSessionDisplayHandler implements IGuacdSessionDisplayH
|
|||||||
this.displayDpi = 96;
|
this.displayDpi = 96;
|
||||||
this.autoFit = true;
|
this.autoFit = true;
|
||||||
this.localCursor = true;
|
this.localCursor = true;
|
||||||
|
this.keyboardDownKeys = [];
|
||||||
this.focusSink = useDebounceFn(() => this.sink?.focus(), 300).bind(this);
|
this.focusSink = useDebounceFn(() => this.sink?.focus(), 300).bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,6 +189,12 @@ export default class GuacdSessionDisplayHandler implements IGuacdSessionDisplayH
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.session.client.sendKeyEvent(0, key);
|
this.session.client.sendKeyEvent(0, key);
|
||||||
|
// 触发长按键
|
||||||
|
if (this.keyboardDownKeys) {
|
||||||
|
this.keyboardDownKeys.forEach(key => {
|
||||||
|
this.session.client.sendKeyEvent(0, key);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 键盘按下事件
|
// 键盘按下事件
|
||||||
@@ -195,6 +203,12 @@ export default class GuacdSessionDisplayHandler implements IGuacdSessionDisplayH
|
|||||||
if (!this.session.isWriteable()) {
|
if (!this.session.isWriteable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 触发长按键
|
||||||
|
if (this.keyboardDownKeys) {
|
||||||
|
this.keyboardDownKeys.forEach(key => {
|
||||||
|
this.session.client.sendKeyEvent(1, key);
|
||||||
|
});
|
||||||
|
}
|
||||||
this.session.client.sendKeyEvent(1, key);
|
this.session.client.sendKeyEvent(1, key);
|
||||||
// // 处理退格
|
// // 处理退格
|
||||||
// if (key === 65288) {
|
// if (key === 65288) {
|
||||||
|
|||||||
Reference in New Issue
Block a user