This commit is contained in:
yanran200730
2022-04-22 14:13:01 +08:00
parent cce3c47466
commit 03d990f8b5
4 changed files with 20 additions and 13 deletions

View File

@@ -80,7 +80,7 @@
this.isHide = false
if (!this.isChoose) return
this.x = e.clientX - canvasInfo.left - 4
this.x = e.clientX - canvasInfo.left
this.ratioW = this.x / this.canvasWidth
} else {
this.isHide = true
@@ -91,10 +91,11 @@
const canvasInfo = document.querySelector(`#${this.id}`).getBoundingClientRect()
if (e.clientY - canvasInfo.top < 29) {
this.x = e.clientX - canvasInfo.left - 4
this.x = e.clientX - canvasInfo.left
clearInterval(this.timer)
this.timer = null
const time = this.secTotime((24 * 60 * 60) / this.canvasWidth * this.x)
this.$emit('replay', time)
}
},
@@ -185,11 +186,12 @@
drawLine(ctx, options) {
const { beginX, beginY, endX, endY, lineColor, lineWidth } = options
ctx.beginPath()
ctx.lineWidth = lineWidth
ctx.strokeStyle = lineColor
ctx.beginPath()
ctx.moveTo(beginX, beginY)
ctx.lineTo(endX, endY)
ctx.strokeStyle = lineColor
ctx.closePath()
ctx.stroke()
},
@@ -240,6 +242,10 @@
}
}
}
if (!this.times.length) {
ctx.stroke()
}
}
}
}
@@ -259,6 +265,7 @@
user-select: none;
cursor: e-resize;
-webkit-user-drag: none;
// transform: translateX(-50%);
}
.time-scale {