Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问一下怎么让中间的线移动,就是时间走的时候不移动时间轴 #14

Open
LoveCodingOnGithub opened this issue Jul 10, 2023 · 9 comments

Comments

@LoveCodingOnGithub
Copy link

No description provided.

@wanglin2
Copy link
Owner

不支持哈,可以自己二次开发

@LoveCodingOnGithub
Copy link
Author

好的,谢谢啦

@gitboyzcf
Copy link

gitboyzcf commented Oct 30, 2023

这个问题你解决了吗 兄弟 @LoveCodingOnGithub

@LoveCodingOnGithub
Copy link
Author

@gitboyzcf 解决了,把源码改了一下

@a0124569873
Copy link

代码可以分享一下么

@LoveCodingOnGithub
Copy link
Author

这个仅做参考,我这边的需求是只显示一天的时间
加一个画当前时间线的函数
image

然后在draw函数里面调用
image

@a0124569873

@gitboyzcf
Copy link

@a0124569873 我这边是移动时间轴中间线不走 根据起始时间和结束时间时间段 利用定时器为时间轴增加时间 使用时间轴暴露出的setTime方法设置

let timer = null
let interval = 1000 // 间隔时间
let startTime = 0 // 起始时间
let endTime = 0 // 结束时间
let current = 0

// 定义定时器函数
const incrementTime = () => {
if (startTime >= endTime) {
if (current >= timeSegments.value.length - 1) {
clearInterval(timer) // 结束定时器
console.log('已经到达结束时间')
return
}
current += 1
startTime = +timeSegments.value[current].beginTime
endTime = +timeSegments.value[current].endTime
clearInterval(timer)
timer = setInterval(incrementTime, interval)
} else {
// 执行递增操作(示例中是每秒加1秒)
startTime += interval
TimeLineRef.value.setTime(startTime)
}
}

@fpd3210
Copy link

fpd3210 commented Nov 10, 2023

@LoveCodingOnGithub 按照你源代码里面的方法,改变this.time之后中间的线还是在中间,刻度会自动移动

@LoveCodingOnGithub
Copy link
Author

哦哦,setTime方法要改一下,时间有点久了,忘了
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants