Comments (2)
I found out that this line is the culprit:
/**
* Emit to the event listeners
* @param {string} eventType
* @param {Event} event
*/
wrapper.emit = function(eventType, event) {
_firstTarget = event.target; // <------------------------------------- this one
hammer.emit(eventType, event);
};
So you have this _firstTarget
global and redefining it to event.target
on each emit
. Is there any reason for that? If I comment it - my issue gets solved, but I feel like it can break something?
Thanks in advance!
from propagating-hammerjs.
Yes there was a very good reason for this _firstTarget
, it ensures you keep the correct event target while dragging outside of the target where a drag started. Else you will not receive a drag end event for example when you stop dragging outside of the element where you started dragging. See this part of the code: https://github.com/josdejong/propagating-hammerjs/blob/master/propagating.js#L212-L226
Your issue with dynamically changed DOM is a generic one in react/preact, I've encountered it myself too. It's not specific to propagating-hammerjs. You can probably use event.stopPropagation()
to prevent this, or maybe use a setTimeout(() => {...}, 0)
.
EDIT: I see now that you already tried event.stopPropagation
. Maybe we can improve/fix stopPropagation to correctly deal with changed DOM.
from propagating-hammerjs.
Related Issues (11)
- Anyway to run client side with Meteor HOT 11
- panmove is not work when swipe first time in device of android HOT 1
- angular 6/7 HOT 1
- export also as ESM module HOT 2
- Way to emit events in test code that is compatible with propagating-hammerjs HOT 4
- Doesn't work when using the jquery.hammer plugin HOT 4
- Performance of Vertical Scroll is less in android chrome using propagating.js HOT 1
- Use apply() in stopPropagation wrapper HOT 3
- Multitouch does not work HOT 4
- needs domEvents:true? but this causes issues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from propagating-hammerjs.