Norserium / react-indiana-drag-scroll

React component which implements scrolling via holding the mouse button or touch

Home Page:https://norserium.github.io/react-indiana-drag-scroll/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update typings with new props

katalonne opened this issue · comments

stopPropagation missing

@katalonne, it's undocumented also. But I'm glad to see someone, who want to use it. Could you describe the case?

@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.

I'm implementing a hand tool and I need to disable the drag.

Disable drag?

onMouseMove

Sorry, but I don't understand. If it would be helpful, I know Russian also. There is high probability, that you know it too.

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

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 ? "*" : ""}
Но это довольно странный кейс, поскольку в описанной ситуации я не вижу смысла использовать эту библиотеку. Она предназначена для прокручивания мышкой.

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?

What's the "hand tool"?

Перевод на русский А что за "hand tool"?

ignoreElements={disableDrag ? "*" : ""} thanks!

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", но это достаточно спорное решение, поскольку не вполне очевидно, что именно будет отключено (скролл мышкой, любой скролл и т.д.)

what's exactly will be disabled

You can document the disabled prop as Disable drag on desktop browsers .