Closed xianshenglu closed 5 years ago
Hi @xianshenglu, thank you for the report. However, in general, both two are not bug. PlainDraggable was designed for many cases as much as possible.
stopPropagation
method is correct and expected behavior because you called the method to stop the mouse event for some reason.stopPropagation
method was called).stopPropagation
method if the dragging should not be stopped.stopImmediatePropagation
method.element.addEventListener('mousedown', function(event) {
if (event.button !== 0) { event.stopImmediatePropagation(); }
}, false);
new PlainDraggable(element);
Question1:
That's because I want to listen the mousemove
on #app
. Well, it's not a big deal in this case. I am just hoping that if we can decide which element should be bound event.
Question2:
I thought we should only allow left button click by default and leave a switch for developer to decide whether turn on right button click or not.
Answer 1:
The mousemove
and touchmove
event listeners should be added to document to make the containment
option work correctly.
Answer 2:
It should not control behavior with modification of mouse and touch interfaces to allow developers to do that (e.g. stopImmediatePropagation
).
It was named "PlainDraggable", the "plain" means that it is simple and for general use, also, used for many cases as much as possible.
mousemove
event ondocument
. If some guys use thestopPropagation
in the container elementmousemove
listener. The drag would not work. So, I proposed to expose themousemove
element and other event delegation element.Solution:
Solution:
I thought of these because I was making a simple draggableJs. ...