@@ -77,6 +77,23 @@ export default class PointerEventManager extends EventManager {
77
77
}
78
78
79
79
const adaptedEvent : AdaptedEvent = this . mapEvent ( event , EventTypes . MOVE ) ;
80
+ const target = event . target as HTMLElement ;
81
+
82
+ // You may be wondering why are we setting pointer capture here, when we
83
+ // already set it in `pointerdown` handler. Well, that's a great question,
84
+ // for which I don't have an answer. Specification (https://www.w3.org/TR/pointerevents2/#dom-element-setpointercapture)
85
+ // says that the requirement for `setPointerCapture` to work is that pointer
86
+ // must be in 'active buttons state`, otherwise it will fail silently, which
87
+ // is lovely. Obviously, when `pointerdown` is fired, one of the buttons
88
+ // (when using mouse) is pressed, but that doesn't mean that `setPointerCapture`
89
+ // will succeed, for some reason. Since it fails silently, we don't actually know
90
+ // if it worked or not (there's `gotpointercapture` event, but the complexity of
91
+ // incorporating it here seems stupid), so we just call it again here, every time
92
+ // pointer moves until it succeeds.
93
+ // God, I do love web development.
94
+ if ( ! target . hasPointerCapture ( event . pointerId ) ) {
95
+ target . setPointerCapture ( event . pointerId ) ;
96
+ }
80
97
81
98
const inBounds : boolean = isPointerInBounds ( this . view , {
82
99
x : adaptedEvent . x ,
0 commit comments