From 01d3c4362ac90787f154579139beb603665b6751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B4=9B=E5=B8=8C=E9=9B=85?= Date: Fri, 10 May 2024 14:53:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8E=9F=E5=A7=8B=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=8C=89=E9=92=AE=E5=88=87=E6=8D=A2=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mqtt/index.vue | 124 +++++++++++++++++++++++++++------------ 1 file changed, 88 insertions(+), 36 deletions(-) diff --git a/src/views/mqtt/index.vue b/src/views/mqtt/index.vue index 19957b3..0619c08 100644 --- a/src/views/mqtt/index.vue +++ b/src/views/mqtt/index.vue @@ -42,6 +42,7 @@ const publish = reactive({ percentage: 0, pause: false, rawTime: true, + forceRawTime: false, range: { start: 0, end: 0 @@ -178,22 +179,39 @@ async function doPublish() { publish.performance = performance.now() - perStartTime }, 100) } +/** 尝试关闭原始时间模式,这在强制使用原始时间模式开关打开时不生效 */ +function triggerDisableRawTime() { + if (publish.forceRawTime) return + publish.rawTime = false +} function pause() { publish.pause = true - publish.rawTime = false + triggerDisableRawTime() } function reverse() { publish.timeTicking = -1 - publish.rawTime = false + triggerDisableRawTime() } function move(tick: number) { - publish.rawTime = false + triggerDisableRawTime() publish.index += tick publish.timeOffset -= tick * 100 } + +watch( + () => publish.forceRawTime, + (it) => { + if (it) { + publish.rawTime = true + publish.timeOffset = 0 + } else if (publish.pause) { + publish.rawTime = false + } + } +)