2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-24 08:00:33 +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) { onDoubleClick(e) {
let barContainer = this.$refs.barContainer.getBoundingClientRect() let barContainer = this.$refs.barContainer.getBoundingClientRect()
let xPos = e.clientX - barContainer.left let xPos = e.clientX - barContainer.left
let timeDiffFromStart = let timeDiffFromStart = Math.floor(
Math.round(xPos / barContainer.width * this.getTimeCount()) (xPos / barContainer.width) * this.getTimeCount()
)
let time = moment(this.getChartStart()).add( let time = moment(this.getChartStart()).add(
timeDiffFromStart, timeDiffFromStart,
this.timeUnit this.timeUnit