Comments (7)
I've implemented the allowFrom
setting.
* A drag/resize/gesture is started only If the target of the
* `mousedown`, `pointerdown` or `touchstart` event or any of it's
* parents match the given CSS selector or Element.
https://raw.githubusercontent.com/taye/interact.js/master/interact.js
from interact.js.
Here's an implementation based on someone elses jsfiddle.
http://jsfiddle.net/dw3xdhch/43/
You can only drag/drop using the handle provided due to
line 2: allowFrom('.handle')
from interact.js.
There's no setting for this so you would have to change the target yourself in your event listeners.
I could implement something like an allowFrom
options which would be sort of the reverse of ignoreFrom
to only start actions from the matching element or it's children.
from interact.js.
prolly a non-issue but:
https://github.com/taye/interact.js/blob/master/interact.js#L4134
shouldn't this be this._element.querySelector
to restrict drag handles to child nodes only? there is no need to take other matching elements into consideration
from interact.js.
You're right, it should only focus on the child nodes. However, the line that you mentioned is only there to test that the given string is a valid CS selector. I've implemented the behaviour in d67646e for both allowFrom
and ignoreFrom
.
Thanks for mentioning this!
from interact.js.
Can you give a sample code snippet about the implementation? Thanks great framework
from interact.js.
When there are two or more handles in a parent element and you need to know which one is being dragged, see https://jsfiddle.net/Lzzrfybg/.
from interact.js.
Related Issues (20)
- Missing TypeScript types (e.g. `styleCursor` option) HOT 1
- Issue on dropzones with 1.10.20 release HOT 7
- How to implement elements snapping to each other functionality? HOT 1
- @Interacrt/Interact cannot trigger the move event
- draggable and gesturable div, behavior lock with inertia
- Issue with Module Parsing in Project Using react-multi-crops HOT 3
- Vite production builds fail after v1.10.25
- TypeScript compile errors - version 1.10.26 HOT 4
- Resize modifier - wrong types HOT 1
- Gestures not working in ShadowDom
- Incompatible with Angular (v17) HOT 3
- New Snap syntax not working HOT 1
- Can't drag element when wrap drag item inside div HOT 1
- Restricting a drag with parent as origin. HOT 4
- Set snap on or off by user
- Demo Page down (https://interactjs.io/) HOT 1
- Is there a way to set the z-index of dropactive?
- interactjs.io is down
- mouseButtons typescript type definitions
- Web server is down (interactjs.io) 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 interact.js.