touch devices: touchend event not fired on elements removed/detached during touchstart/touchmove callbacks (caused issues when switching tabs using a button inside a tab)
This commit is contained in:
parent
e7dfa453e4
commit
fae6448a5b
2 changed files with 28 additions and 0 deletions
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
- bug fixes
|
||||
- editor: regression breaking widget context menu actions under "Position" submenu
|
||||
- touch devices: touchend event not fired on elements removed/detached during touchstart/touchmove callbacks (caused issues when switching tabs using a button inside a tab)
|
||||
|
||||
|
||||
## 1.24.1
|
||||
|
||||
|
|
|
|||
|
|
@ -158,8 +158,34 @@ function mouseUpCapture(event){
|
|||
|
||||
// Touch events wrappers
|
||||
|
||||
// Touchend event is not emitted when target element is removed/detached
|
||||
// Watch for DOM mutations and simulate pointerUp if a registered
|
||||
// target is removed/detached
|
||||
const domObserver = new MutationObserver(function(mutations) {
|
||||
for (var id in targets) {
|
||||
var event = previousPointers[id],
|
||||
target = targets[id]
|
||||
|
||||
if (event.pointerType === 'mouse') continue
|
||||
|
||||
for (var mutation of mutations) {
|
||||
for (var node of mutation.removedNodes) {
|
||||
if (node == target || node.contains(target)){
|
||||
pointerUpHandler(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
domObserver.active = false
|
||||
|
||||
function touchDownCapture(event) {
|
||||
|
||||
if (!domObserver.active) {
|
||||
domObserver.observe(DOM.get('#osc-container')[0], {subtree: true, childList: true})
|
||||
domObserver.active = true
|
||||
}
|
||||
|
||||
event.preventDefault()
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue