Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The drag behavior should support pointer events. #2556

Closed
stnor opened this issue Sep 15, 2015 · 4 comments
Closed

The drag behavior should support pointer events. #2556

stnor opened this issue Sep 15, 2015 · 4 comments
Milestone

Comments

@stnor
Copy link

stnor commented Sep 15, 2015

Hi,
Dragstart, Dragend and Drag events doesn't seem to fire on Microsoft Edge (the new browser in Windows 10) on a Microsoft Surface 3 Pro touch device.

Code works great on IE9-IE11. Does d3 support pointer-events?

If you need more information or help testing, I'd be glad to assist.

Thanks!

@stnor stnor changed the title Microsoft Edge on Windows 10 Drag event doesnt fire on Microsoft Edge on Windows 10 Sep 15, 2015
@stnor
Copy link
Author

stnor commented Sep 15, 2015

This works on IE11 and Chrome but not Edge.

   drag = d3.behavior.drag()
                    .on("dragstart", function(d, i) {
                        console.log("got it")

I also added a console.log in d3 3.5.6 (which prints):

  d3.behavior.drag = function() {
    var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_behavior_dragMouseSubject, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_behavior_dragTouchSubject, "touchmove", "touchend");
    //var pointerdown = dragstart(d3_noop, d3.touch, d3_window, "pointermove", "pointerdown")
    function drag() {
      this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart) //.on("pointerdown.drag", pointerdown);
    }
    function dragstart(id, position, subject, move, end) {
      return function() {
        console.log("*** DRAGGING")
        var that = this, target = d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject()).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(), position0 = position(parent, dragId);
        if (origin) {
          dragOffset = origin.apply(that, arguments);
          dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ];
        } else {
          dragOffset = [ 0, 0 ];

@mbostock mbostock added bug Something isn’t working ms labels Oct 21, 2015
@mbostock mbostock added this to the 3.5.x milestone Oct 21, 2015
@mbostock
Copy link
Member

Possible duplicate of #2403?

@mbostock mbostock changed the title Drag event doesnt fire on Microsoft Edge on Windows 10 The drag behavior should support pointer events. Dec 3, 2015
@mbostock
Copy link
Member

mbostock commented Dec 3, 2015

Related #1439.

@stnor
Copy link
Author

stnor commented Aug 31, 2016

My code works now on Edge both in d3 v3 and v4. Tested on Edge 38.14393

@stnor stnor closed this as completed Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants