question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Click triggers dragStart event which moveable dispatches

See original GitHub issue

Environments

  • Framework name: plain javascript
  • Framework version:
  • Moveable Component version: latest
  • Testable Address(optional):

Description

It seems to me that clicking on moveable target triggers dragStart event which moveable dispatches. If it’s true, I prefer clicking on moveable target element does not trigger dragStart event. How can I do that? Thanks in advance.

Movie below is my example. dragStart event handler changes element’s opacity. You can see that only clicking fires dragStart event.

https://user-images.githubusercontent.com/58697518/202619465-df5d000e-9a17-4dfb-a8a9-78aa54abc61e.mp4

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
daybrushcommented, Nov 27, 2022

@kotarofunyu

moveable’s new version is released. Check it again.

onDragStart={e => {
   //
}}

onDrag={e => {
   if (e.isFirstDrag) {
      // your code for dragStart
   }
}}
1reaction
daybrushcommented, Nov 23, 2022

The dragStart event is inevitably triggered on mousedown (click).

onDragStart={e => {
   //
}}

onDrag={e => {
   if (e.isFirstDrag) {
      // your code for dragStart
   }
}}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · daybrush/moveable - GitHub
Trigger Resize Event on the corner Scaling Buttons renderDirections: ['nw', 'ne', ... Click triggers dragStart event which moveable dispatches complete ...
Read more >
simulate a 3 pixel drag on draggable elem - javascript
You have to trigger the right sequence using EventTarget.dispatchEvent() . I guess that you combine "HTML Drag and Drop API" with "Mouse events" ......
Read more >
HTMLElement: dragstart event - Web APIs | MDN
The dragstart event is fired when the user starts dragging an element or text selection.
Read more >
Moveable - Documentation - Daybrush
Moveable - Documentation. ... You can drag start the Moveable through the external `MouseEvent`or ... Whether to trigger the moveable's click event.
Read more >
Android Drag and Drop Tutorial: Moving Views and Data
To do this, you set a long-click listener on the mask view that triggers the drag start. Create ClipData and ClipData.Item, which represent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found