feat: 增加示波器探测参数显示,增加旋转编码器按下的功能
This commit is contained in:
@@ -176,7 +176,10 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useRotaryEncoder } from "@/stores/Peripherals/RotaryEncoder";
|
||||
import { RotaryEncoderDirection } from "@/utils/signalR/Peripherals.RotaryEncoderClient";
|
||||
import {
|
||||
RotaryEncoderDirection,
|
||||
RotaryEncoderPressStatus,
|
||||
} from "@/utils/signalR/Peripherals.RotaryEncoderClient";
|
||||
import { watch } from "vue";
|
||||
import { watchEffect } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
@@ -185,6 +188,7 @@ const rotataryEncoderStore = useRotaryEncoder();
|
||||
|
||||
interface Props {
|
||||
size?: number;
|
||||
componentId?: string;
|
||||
enableDigitalTwin?: boolean;
|
||||
encoderNumber?: number;
|
||||
}
|
||||
@@ -236,8 +240,16 @@ function handleMouseUp() {
|
||||
// 仅在未发生旋转时才触发按压
|
||||
if (!drag.value.hasRotated) {
|
||||
isPressed.value = true;
|
||||
rotataryEncoderStore.pressOnce(
|
||||
props.encoderNumber,
|
||||
RotaryEncoderPressStatus.Press,
|
||||
);
|
||||
setTimeout(() => {
|
||||
isPressed.value = false;
|
||||
rotataryEncoderStore.pressOnce(
|
||||
props.encoderNumber,
|
||||
RotaryEncoderPressStatus.Release,
|
||||
);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +264,10 @@ function handlePress(pressed: boolean) {
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
rotataryEncoderStore.setEnable(props.enableDigitalTwin);
|
||||
if (!props.enableDigitalTwin) return;
|
||||
|
||||
if (props.componentId)
|
||||
rotataryEncoderStore.setEnable(props.enableDigitalTwin);
|
||||
});
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user