ScratchData LogoScratchData
Back to gtoal's profile

Mouse handling library

GTgtoal•Created April 23, 2015
Mouse handling library
42
29
1116 views
View on Scratch

Instructions

Supports single click, double click, and drag&drop. A simple short single or double click without holding the mouse down for an extended period should not cause the sprite to move at all - not even by a pixel. Note that it does distinguish between a single click-drag and a double-click drag, though your code will probably prefer to ignore the distinction. to do: add motion blur/mouse trails? ( https://scratch.mit.edu/projects/52770342/ ) add broadcasts. a better shadow would be nice, especially if it could be grey, with gaussian blur https://scratch.mit.edu/projects/16629717/

Description

I've picked values that work for me. If they consistently fail to distinguish the different kinds of clicks for you, please tweak the sliders until it works for you, and post the values you needed to use in the comments please. INTERESTING BEHAVIOUR: click duration using the mouse button on my laptop is less than .11s but a single tap on the touchpad takes longer than that (< 0.24s) and is detected as a short drag instead! I know this code is a little messy, I've only just now written it. I'll refactor it sometime after people have had a chance to test it, and make it easier to maintain. It should probably send events to notify about the various activities.

Project Details

Project ID58567194
CreatedApril 23, 2015
Last ModifiedDecember 25, 2015
SharedApril 23, 2015
Visibilityvisible
CommentsAllowed