taye / interact.js

JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+)
http://interactjs.io/
MIT License
12.38k stars 785 forks source link

Not working in IE10 #17

Closed albatrocity closed 10 years ago

albatrocity commented 10 years ago

First off, awesome library. I've been working with it in WebKit and it has gone swimmingly, but testing in IE10 I get breaking errors. It complains about line 4466,

selectorGesture = new Gesture();

saying Object doesn't support this action.

I would think it was an issue with my implementation, but the interactjs.io website throws the same errors. I tried incrementally rolling back versions until 1.0.7, where the errors no longer popped up. But this must have been before drop zones had an accept method because I get the error "Object does not support property or method accept"

taye commented 10 years ago

Well this is interesting. I only have access to the IE10 emulator on IE11 on Windows 8 and I get no errors.

Could you try adding <meta http-equiv="X-UA-Compatible" content="IE=edge" /> to the document head if you haven't already done so (http://www.modern.ie/en-us/performance/how-to-use-x-ua-compatible)?

1.0.7 works because it was after that release that I started working on getting multi-touch gestures working in IE10+ (098d9d4c).

If the above suggestion doesn't work, the only work-around that I can think of If you're not using gesturables at all is to pretend that the browser doesn't support PointerEvents by changing lines 18-20 from:

        PointerEvent = window.PointerEvent || window.MSPointerEvent,
        GestureEvent = window.GestureEvent || window.MSGestureEvent,
        Gesture      = window.Gesture      || window.MSGesture,

into:

        PointerEvent = null,
        GestureEvent = null,
        Gesture      = null,

Doing this would break gesturables in IE10 and IE11.

I'll try to investigate more thoroughly on a real IE10 as soon as I can.

albatrocity commented 10 years ago

I'm running VirtualBox with Windows 7 and IE10. I'll check later today on Windows 8. I've got

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

in my head. I tried taking Interact and my app code out of require wrappers and it works just the same. I'm compiling my Chaplin app with Brunch, installing Interact with Bower, but it seems to work the same outside of that environment.

Luckily I'm not using gestures (yet :smile: ) so I'll use this quick fix for now. I'll let you know if it's any different on Windows 8.

Thanks for your help!

taye commented 10 years ago

It turns out that Windows 7 has no Gesture API (despite there being a GestureEvent object) so avoiding PointerEvents if the Gesture object is missing is the proper fix.

http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx#gesture_object_events