From 3a28787d8549415139a8edd3ac345b4f92499ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sat, 5 Dec 2020 22:51:18 +0100 Subject: [PATCH] refactoring --- docs/src/demos/Examples/Drawing/Component.vue | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/docs/src/demos/Examples/Drawing/Component.vue b/docs/src/demos/Examples/Drawing/Component.vue index 255ce599..5cec9a54 100644 --- a/docs/src/demos/Examples/Drawing/Component.vue +++ b/docs/src/demos/Examples/Drawing/Component.vue @@ -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() }