canvas-click event shouldn't fire as you drag
See original GitHub issueI just wrote a little test for canvas-click:
viewer.addHandler('canvas-click', function(target, info) {
console.log(info.position.x, info.position.y);
});
… and noticed that it fires for every mouse move while I drag. Having a canvas-drag event would probably be a good idea, but conflating the two events doesn’t seem like a good idea. Let’s get that sorted out.
Issue Analytics
- State:
- Created 10 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
React synthetic event: onDrag doesn't fire after onClick or ...
It fires only in drag & drop context. To implement dragging behavior in canvas I used classic. mousedown, mouseup and mousemove events.
Read more >How to differentiate mouse “click” and “drag” event using ...
In a “click” event, there is no “mouse move” event. However, the “mouse down” and “mouse up” event remains the same for both...
Read more >HTML5 Canvas Fire Event with Konva
To fire events with Konva, we can use the fire() method. This enables us to programmatically fire events like click , mouseover ,...
Read more >ondrag Event - W3Schools
Links and images are draggable by default, and do not need the draggable attribute. Many events occur in the different stages of a...
Read more >Drag'n'Drop with mouse events - The Modern JavaScript Tutorial
Not bad, but there's a side effect. To initiate the drag'n'drop, we can mousedown anywhere on the ball. But if “take” it from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In the current event implementation, a click event is always raised when the mouse button is released. To differentiate between a click and a drag in your click handler, examine the “quick” parameter passed to your handler - it will be false for a drag, true for a click.
Works like a charm. Thank you.