From 6d7213588f7833f3b982a4d5935351618d4dd634 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 20 Jul 2020 11:33:07 +0200 Subject: [PATCH] update the Hand's position on mouse-down - avoid triggering at the origin point --- HISTORY.md | 1 + snap.html | 2 +- src/morphic.js | 12 ++++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index f0430811..4b72676e 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,6 +4,7 @@ ### 2020-07-20 * objects: fixed a list-watcher direct-editing offset bug +* morphic: update the Hand's position on mouse-down - avoid triggering at the origin point ### 2020-07-19 * blocks: blocks-fade-out support for label arrows (under construction) diff --git a/snap.html b/snap.html index 32f6b49e..bdb787f1 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 cc940db1..c95c86db 100644 --- a/src/morphic.js +++ b/src/morphic.js @@ -1278,7 +1278,7 @@ /*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/ -var morphicVersion = '2020-July-17'; +var morphicVersion = '2020-July-20'; var modules = {}; // keep track of additional loaded modules var useBlurredShadows = true; @@ -11279,8 +11279,16 @@ HandMorph.prototype.drop = function () { */ HandMorph.prototype.processMouseDown = function (event) { - var morph, actualClick; + var morph, actualClick, + 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 + )); + + // process the actual event this.destroyTemporaries(); this.contextMenuEnabled = true; this.morphToGrab = null;