Re: Capturing Problems Example

Yes, I’m pretty sure doing the capture on the event’starget would solve his issue. There’s also another option (which is the one I adopted in my previous code) which consists in setting the capture during the tunneling phase: that way, the capture ends up being set by the element which the closest from the target in a very natural way.


However, it remains a question of knowing if the pointer capture algorithm shouldn’t be modified to avoid common issues like this. My opinion would be that, since most people just don’t know about the tunneling event phase, we should make setPointerCapture “work better” during the bubbling phase.


My proposal is that, if you call “el.setPointerCapture(...)” and that the pointer is already captured by a child of the “el” element, the pointer capture is not updated. If you want to replace the capture of a pointer, you have to release the pointer capture at the child level before.


Whilethis behavior is not necessary to achieve usable pointer capture, it may prevents some developers from accidentally preventing child elements of getting pointer events updates, if the elements specifically asked to receive them.


The other option would be remove the “setPointerCapture” method from elements and, instead, add a “capturePointer” method on the Event object which, when called, make the event’s target capture the pointer. This removes some possibilities but also avoid possible mistakes.





De : Brandon Wallace
Envoyé : ‎vendredi‎ ‎12‎ ‎avril‎ ‎2013 ‎17‎:‎12
À : Konstantinov Sergey, Pointer Events WG



In your capt version, will you achieve your goal if you replace:




outer.msSetPointerCapture(pointerId);





with:




e.target.msSetPointerCapture(pointerId);



 

???







--

Brandon
http://palladiumblog.wordpress.com/









From: Konstantinov Sergey <twirl@yandex-team.ru>
To: Pointer Events WG <public-pointer-events@w3.org> 
Sent: Friday, April 12, 2013 9:57 AM
Subject: Capturing Problems Example
 


I made the test pages to demonstrate both capturing problem and the lack of standard functionality
http://konstantinov.cc/pe/doc.html

http://konstantinov.cc/pe/capt.html


Both pages demonstrate the same scenario:
- outer gray div is draggable
- inner gray div opens "context menu" on two-finger tap.

doc.html - example using document.addEventListener with capturing
capt.html - example using setPointerCapture.

You may note that:
(a) in the capturing example the context menu functionality is broken because the inner div never recieve 'pointerup' event;
(b) furthermore, there is a constant memory leak because we need to save the pointers position but never catch the 'pointerup' event.

-- 
Konstantinov Sergey
Yandex Maps API Development Team Lead
http://api.yandex.com/maps/

Received on Friday, 12 April 2013 15:26:03 UTC