zunnzunn / vue-ganttastic

Simple, interactive and highly customizable Gantt chart component for Vue 3
https://zunnzunn.github.io/vue-ganttastic/
565 stars 141 forks source link

The feature has been added in release 2.3.1. #111

Open L-ZJoker opened 4 months ago

L-ZJoker commented 4 months ago
          The feature has been added in release 2.3.1.

Originally posted by @zunnzunn in https://github.com/zunnzunn/vue-ganttastic/issues/92#issuecomment-2008139894

L-ZJoker commented 4 months ago

current-time is static, I think it should be real-time

Pedrocanoas commented 4 months ago

you say the moment marker should move dynamically over time?

L-ZJoker commented 4 months ago

you say the moment marker should move dynamically over time?

yes

Pedrocanoas commented 4 months ago

I tried this on the feature and hoped it would work like that, but apparently, that's not what happened.

const xDist = computed(() => {
  const format = dateFormat.value || "YYYY-MM-DD HH:mm"
  return mapTimeToPosition(dayjs(currentMoment.value, format).format(format))
})

I ran some tests and could only achieve it using the set interval function, and I don't think it's the right way because it can decrease efficiency and processing power.

const xDist = setInterval(() => {
  const format = dateFormat.value || "YYYY-MM-DD HH:mm"
  return mapTimeToPosition(dayjs(currentMoment.value, format).format(format))
}, 1)

I leave it open here for future improvements for anyone who wants to venture, in my case, my knowledge was limited to this haha

L-ZJoker commented 4 months ago

currentMoment

I created a PR, can you see if this solution is feasible?

https://github.com/zunnzunn/vue-ganttastic/pull/114