refactoring

This commit is contained in:
Philipp Kühn
2020-12-05 22:51:18 +01:00
parent 3157e7f763
commit 3a28787d85

View File

@@ -90,24 +90,17 @@ export default {
svg
.on('mousedown', listen)
.on('mouseup', ignore)
.on('mouseleave', ignore)
.on('touchstart', listen)
.on('touchend', ignore)
.on('touchleave', ignore)
.on('mouseup', ignore)
.on('mouseleave', ignore)
// ignore default touch behavior
const touchEvents = ['touchstart', 'touchmove', 'touchend']
touchEvents.forEach(eventName => {
document.body.addEventListener(eventName, e => {
e.preventDefault()
})
})
function onmove(event) {
const point = d3.pointer(event)
event.preventDefault()
const point = d3.pointers(event)[0]
// push a new data point onto the back
ptdata.push({ x: point[0], y: point[1] })
tick()
}