From 7261dbb462b6160197c43b4aebbbd5d3165f2a3d Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 23 Jul 2020 00:27:32 +0200 Subject: [PATCH] fixed mouseDown events for touch devices --- HISTORY.md | 3 +++ snap.html | 2 +- src/morphic.js | 12 +++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index dc378611..c9f69afb 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,9 @@ ## in development: +### 2020-07-23 +* morphic: fixed mouseDown events for touch devices + ### 2020-07-22 * morphic, blocks, gui: tweaked block-fading mouse-over * blocks, threads: tweaked context visualizations to be alpha-independent diff --git a/snap.html b/snap.html index c9c5c913..98d98674 100755 --- a/snap.html +++ b/snap.html @@ -4,7 +4,7 @@ Snap! Build Your Own Blocks 6.0.1 - dev - - + diff --git a/src/morphic.js b/src/morphic.js index 7eb28ca8..f442cc1b 100644 --- a/src/morphic.js +++ b/src/morphic.js @@ -1280,7 +1280,7 @@ /*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/ -var morphicVersion = '2020-July-22'; +var morphicVersion = '2020-July-23'; var modules = {}; // keep track of additional loaded modules var useBlurredShadows = true; @@ -11284,10 +11284,12 @@ HandMorph.prototype.processMouseDown = function (event) { posInDocument = getDocumentPositionOf(this.world.worldCanvas); // update my position, in case I've just been initialized - this.setPosition(new Point( - event.pageX - posInDocument.x, - event.pageY - posInDocument.y - )); + if (event.pageX) { + this.setPosition(new Point( + event.pageX - posInDocument.x, + event.pageY - posInDocument.y + )); + } // process the actual event this.destroyTemporaries();