Comments (13)
I suppose, that solution above is pretty suitable for this situation. Not obvious, but not weird. But you should notice that it will not disable dragging on mobile devices.
I will think about disabled
prop, but it's arguable solution, because it's not obvious what's exactly will be disabled (drag scroll, every scroll and etc.)
Перевод на русский
Я думаю, решение, приведённое выше, вполне подходит для данной ситуации. Не очевидное, но и не столь костыльное. Однако следует отметить, что оно не отключит соответствующий скроллинг для мобильных устройств.Я подумаю насчёт добавления пропа "disabled", но это достаточно спорное решение, поскольку не вполне очевидно, что именно будет отключено (скролл мышкой, любой скролл и т.д.)
from react-indiana-drag-scroll.
@katalonne, it's undocumented also. But I'm glad to see someone, who want to use it. Could you describe the case?
from react-indiana-drag-scroll.
@Norserium ahh.. I thought it will disable the drag...
I'm implementing a hand tool and I need to disable the drag.
Thanks for the reply.
from react-indiana-drag-scroll.
I'm implementing a hand tool and I need to disable the drag.
Disable drag?
from react-indiana-drag-scroll.
onMouseMove
from react-indiana-drag-scroll.
Sorry, but I don't understand. If it would be helpful, I know Russian also. There is high probability, that you know it too.
from react-indiana-drag-scroll.
Mne inogda ne nado scroll kogda drag (cerez mouse click/mousemove)
, toliko na mousewheel (obychnyi)
.
caroce tam esti functia : isDraggable
, i napisal kostyli )
(ScrollContainer.prototype as any).isDraggable = function (target: any) {
const { ignoreElements, disableDrag } = this.props
if (disableDrag) return false
if (ignoreElements) {
const closest = target.closest(ignoreElements)
return closest === null || closest.contains(this.getElement())
} else {
return true
}
}
Tipa dobavil novyi prop: disableDrag
from react-indiana-drag-scroll.
The same effect you may get by adding the following prop: ignoreElements={disableDrag ? "*" : ""}
. But it's pretty strange case, in the described situation I don't see the reason to use this library. It's designed to implement scroll by mouse.
Перевод на русский
Аналогичный эффект можно получить добавлением пропса:ignoreElements={disableDrag ? "*" : ""}Но это довольно странный кейс, поскольку в описанной ситуации я не вижу смысла использовать эту библиотеку. Она предназначена для прокручивания мышкой.
from react-indiana-drag-scroll.
I don't see the reason to use this library
As I said: I'm implementing a hand tool and I need to disable the drag
I have to modes, think canDrag: boolean
.
If I'm wrong can you point me to other library?
from react-indiana-drag-scroll.
What's the "hand tool"?
Перевод на русский
А что за "hand tool"?from react-indiana-drag-scroll.
@Norserium https://answers.acrobatusers.com/How-I-access-hand-tool-Adobe-Reader-q151155.aspx
from react-indiana-drag-scroll.
ignoreElements={disableDrag ? "*" : ""}
thanks!
from react-indiana-drag-scroll.
what's exactly will be disabled
You can document the disabled
prop as Disable drag on desktop browsers
.
from react-indiana-drag-scroll.
Related Issues (20)
- [Request] Option to remove body class HOT 9
- No way to get scroll offsets HOT 3
- There is no response to the components in ScrollContainer. HOT 8
- Doesn't work with scroll snapping HOT 3
- Any plan of migrating to function components? HOT 4
- Any plan to support React 18? HOT 5
- Activate drag scroll with the mouse wheel? HOT 5
- Change input in container HOT 4
- Horizontal scroll not working with touchpad HOT 7
- 'ScrollContainer' cannot be used as a JSX component. HOT 6
- style prop isn't applied in v3 HOT 10
- Dragging problem on touch devices HOT 8
- Add horizontal scroll support using a scroll wheel HOT 2
- reset scroll bar position HOT 1
- scrollLeft not set when scrolling with mousewheel HOT 3
- Receiving [Violation] warning on every render of ScrollContainer
- Bad importation at https://norserium.github.io/react-indiana-drag-scroll/ HOT 1
- v3 feedback HOT 1
- Doesn't work with Next.js 13+ HOT 4
- Focus removed from input elements 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 react-indiana-drag-scroll.