Skip to content

Commit

Permalink
Touch support: more style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJollyjim committed Apr 14, 2019
1 parent f4733f6 commit 63847dd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions InteractiveHtmlBom/web/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,11 @@ function handlePointerUp(e, layerdict) {
e.preventDefault();
e.stopPropagation();

if (layerdict.pointerStates.hasOwnProperty(e.pointerId)) {
// We haven't necessarily had a pointermove event since the interaction started, so make sure we update this now
var ptr = layerdict.pointerStates[e.pointerId];
ptr.distanceTravelled += Math.abs(e.offsetX - ptr.lastX);
ptr.distanceTravelled += Math.abs(e.offsetY - ptr.lastY);
}
// We haven't necessarily had a pointermove event since the interaction started, so make sure we update this now
var ptr = layerdict.pointerStates[e.pointerId];
ptr.distanceTravelled += Math.abs(e.offsetX - ptr.lastX) + Math.abs(e.offsetY - ptr.lastY);

if (e.button == 0 && layerdict.pointerStates.hasOwnProperty(e.pointerId) && layerdict.pointerStates[e.pointerId].distanceTravelled < 10 && Date.now() - layerdict.pointerStates[e.pointerId].downTime <= 500) {
if (e.button == 0 && ptr.distanceTravelled < 10 && Date.now() - ptr.downTime <= 500) {
if (Object.keys(layerdict.pointerStates).length == 1) {
if (layerdict.anotherPointerTapped) {
// This is the second pointer coming off of a two-finger tap
Expand Down Expand Up @@ -555,8 +552,7 @@ function handlePointerMove(e, layerdict) {
var dy = e.offsetY - thisPtr.lastY;

// If this number is low on pointer up, we count the action as a click
thisPtr.distanceTravelled += Math.abs(dx);
thisPtr.distanceTravelled += Math.abs(dy);
thisPtr.distanceTravelled += Math.abs(dx) + Math.abs(dy);

if (Object.keys(layerdict.pointerStates).length == 1) {
// This is a simple drag
Expand Down

0 comments on commit 63847dd

Please sign in to comment.