From c64880696e5bc3107cc13afcc606d4c8eda0bba8 Mon Sep 17 00:00:00 2001 From: yicone Date: Tue, 23 Feb 2021 18:46:36 +0800 Subject: [PATCH] fix: incorrect pos of adding bar --- src/GGanttRow.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GGanttRow.vue b/src/GGanttRow.vue index 914d2a8..2f81a11 100644 --- a/src/GGanttRow.vue +++ b/src/GGanttRow.vue @@ -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