From d7d333d64bb7314dfdb05613923b8c2d97c19869 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Sun, 20 Dec 2020 14:58:25 -0800 Subject: [PATCH] touch --- css/style.css | 1 + js/creator.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index ecd10091..c8fef97d 100644 --- a/css/style.css +++ b/css/style.css @@ -480,6 +480,7 @@ textarea.input { /*Draggables*/ .draggable { background: #333; + touch-action: none; } .dragging { box-shadow: 0 0px 16px black; diff --git a/js/creator.js b/js/creator.js index 486fe384..23454031 100644 --- a/js/creator.js +++ b/js/creator.js @@ -151,8 +151,8 @@ function dragEnd(event) { } function touchMove(event) { event.preventDefault(); - var clientX = event.clientX; - var clientY = event.clientY; + var clientX = event.touches[0].clientX; + var clientY = event.touches[0].clientY; console.log('touch move: ' + clientX + ', ' + clientY); Array.from(document.querySelector('.dragging').parentElement.children).forEach(element => { var elementBounds = element.getBoundingClientRect();