-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use changedTouches instead of targetTouches in style.getClientPosition #337
Conversation
… can have a zero-length targetTouches list, so we check for the array length before derefencing. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=72774880
targetTouches is not defined for touchend and touchcancel events. changedTouches is always defined.
|
Any change for this to get reviewed? Thanks |
|
This change makes sense! The This is the definition of « A TouchList listing all the Touch objects for touch points that are still in contact with the touch surface and whose touchstart event occurred inside the same target element as the current target element. » So, on a touchstart, @fredj's patch fixes that problem. It also makes Potential caveat: when multiple touches are simultaneously added/removed to/from the touch surface then |
|
I'll add a comment, thanks |
|
@fredj, in fact, with #405, goog.style.getClientPosition = function(el) {
goog.asserts.assert(el);
if (el.nodeType == goog.dom.NodeType.ELEMENT) {
return goog.style.getClientPositionForElement_(
/** @type {!Element} */ (el));
} else {
var targetEvent = el.changedTouches ? el.changedTouches[0] : el;
return new goog.math.Coordinate(
targetEvent.clientX,
targetEvent.clientY);
}
};Indeed, with #405, if Thoughts? |
|
See master...elemoine:41. |
|
@elemoine please create a pull request with your branch (and add |
|
See #424. |
|
#424 is the canonical |
targetTouchesis not defined fortouchendortouchcancelevents.changedTouchesis always defined.With the current implementation (after 116609a) the position is always
[0, 0]closes #41