2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-19 04:10:32 +03:00

fix: incorrect pos of adding bar

This commit is contained in:
yicone
2021-02-23 18:46:36 +08:00
parent 0100d60d89
commit c64880696e
+3 -2
View File
@@ -126,8 +126,9 @@ export default {
onDoubleClick(e) {
let barContainer = this.$refs.barContainer.getBoundingClientRect()
let xPos = e.clientX - barContainer.left
let timeDiffFromStart =
Math.round(xPos / barContainer.width * this.getTimeCount())
let timeDiffFromStart = Math.floor(
(xPos / barContainer.width) * this.getTimeCount()
)
let time = moment(this.getChartStart()).add(
timeDiffFromStart,
this.timeUnit