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 + } + } +)