Elements under pointer #201

merged 46 commits into from Mar 6, 2013


None yet

2 participants

  • Contains #194 and #195
    • Added a basic implementation of charCode to return for keypress events
    • Cleans up event handling in the svg renderer.
    • adds “deltaX/Y” and “diffX/Y” to regular “pointermove” events as well (not only drags) when triggered by mouse events.
    • adds “deltaX/Y” to “pointermove” and “drag” events when triggered by touches
    • does not send unnecessary drag events to the runner.
    • Stops memory leaking from touch events.
  • breaks out dom event recognition and translation to bonsai events into own module
  • adds experimental event feature: get all elements under the pointer for pointer events
Wolfram Krie... and others added some commits Feb 12, 2013
Wolfram Kriesing Implemented rudimentary charCode to be returned by keydown event. a36aab8
@davidaurelio davidaurelio Remove a memory leak where saved touch data would never be released 1adf6e8
@davidaurelio davidaurelio Remove dead code branches for touch events c734681
@davidaurelio davidaurelio Bring touch events back into the main switch block 183f87d
@davidaurelio davidaurelio Reset properties to null instead of deleting them b6314d0
@davidaurelio davidaurelio Emit drags only for real drags (mouse is down) b61c9f3
@davidaurelio davidaurelio Emit deltaX/Y and diffX/Y values for mousemove events, too daaac99
@davidaurelio davidaurelio Add deltaX/Y to touch events as well (pointermove/drag) 5042e78
@davidaurelio davidaurelio Add to changelog 98076cd
@davidaurelio davidaurelio Add experimental `elementsUnderPointer` renderer option 11e6688
@davidaurelio davidaurelio Add private/internal module to wrap svg intersection checks 00f22da
@davidaurelio davidaurelio Prevent unnecessary object creation 98ad4b6
@davidaurelio davidaurelio Extend property matchers so that they can also check property values 05f3e31
@davidaurelio davidaurelio Start to break events out of the svg renderer
- for future reusability with other renderers
- to increase code organization and legibility
@davidaurelio davidaurelio Remove functions that are no longer in use d0e07cf
@davidaurelio davidaurelio Simplify property tests 3275cac
@davidaurelio davidaurelio Add mouse button properties adbeb28
@davidaurelio davidaurelio Add clone methods c0d8043
@davidaurelio davidaurelio Add `PointerEvent.fromDomMouseEvent()` f3328e2
@davidaurelio davidaurelio Add `PointerEvent.fromDomTouch` method 0088ffe
@davidaurelio davidaurelio Get rid of `touchIndex` property b40554e
@davidaurelio davidaurelio Finish `fromDomTouch()` b3643f4
@davidaurelio davidaurelio Finish fromDomKeyboardEvent 0f9559a
@davidaurelio davidaurelio Add “click” and “dblclick” to mouse events bf7679e
@davidaurelio davidaurelio Change the svg event handler to use the event module
- `preventDefault()`s only “touchmove” events for now
- makes “diffX/Y” and “deltaX/Y” properties more consistent
- makes firing of multitouch and non-multitouch events more consistent between touch and mouse events
@davidaurelio davidaurelio Merge branch 'master' into elements-under-pointer 7c8b53e
@davidaurelio davidaurelio Fix drag events for mouse 18e6326
@davidaurelio davidaurelio Make pointerup events from touchcancel events 0364aab
@davidaurelio davidaurelio Listen to touchcancels 6f46d8c
@davidaurelio davidaurelio Handle touchcancel events 4296171
@davidaurelio davidaurelio Add support for mouse button properties c338959
@davidaurelio davidaurelio Fix svg intersection checking code e3ec4b2
@davidaurelio davidaurelio Emit ids of elements under the pointer if experimental option is enabled 4172541
@davidaurelio davidaurelio Add elements under pointer to bonsai events, if present c5850ec
@davidaurelio davidaurelio Start to break out svg independent dom event handling logic
- better separation of concerns
- better reuse of logic for other DOM-based renderers
@davidaurelio davidaurelio Align property names 23a7412
@davidaurelio davidaurelio Add renderer option to renderer 3d88cc3
@davidaurelio davidaurelio Pass on objects under pointer for all pointer events 36ad504
@davidaurelio davidaurelio Fix assignment to wrong property ad9b8db
@davidaurelio davidaurelio Clean up e6fca8a

I’ve checked this in different browsers (chrome, safari, firefox, opera, ie10), and it’s not necessary. charCode already contains the correct code. On the contrary, for combinations like shift–alt–5 on a mac/us layout, charCode would be 64257 for “fi” (one character!), toUpperCase() would transform that to “FI”, and eventually charCodeAt() would return 70 for “F”.

Edit: Also tested IE9 and safari/ios. toUpperCase is not necessary.


Another problem is stuff like alt+u, a on a mac/us keyboard, which produces an “¨”-accent and an “a” and combines them to “ä”. That combination does not trigger a single keypress, though.


i can see that the test cases i added pass too, so for that part i can say +1, the rest i dont feel knowledgable enough.

@davidaurelio davidaurelio merged commit b662eeb into master Mar 6, 2013
@davidaurelio davidaurelio deleted the elements-under-pointer branch Mar 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment