I think that it might be best to take as much stuff as possible out of the page and gradually re-introduce things, so, yes, I’d say take that out - and jQuery/jQuery UI, if you can - and test out the jsPlumb side of things.
If you get it going then you might want to then think about binding tap/click events through jsPlumb, because it uses a library (https://github.com/jsplumb/mottle) that offers tap events which fall back to click on non-touch devices.
this is not documented at the moment. i keep meaning to do a blog post about. basically you can do this:
jsPlumb.on(someSelector, "tap", function(e) {
});
it’s also not been tested by anyone outside of jsPlumb, so, er, your results may vary. I mention it only because the fewer things you have in your page, the better.
also, I should point out that the asynchronous nature of element rendering in Angular means that it’s not always clear when something is ready to have event listeners bound. But I assume you’ve already figured out a way around that.
I updated the fiddle a little and it works for me on the desktop now:
as well as on my android phone. but on the iPad the yellow div bleeds out over the page and tapping the blue div takes me variously to twitter or to facebook; somehow it’s trying to get me to like things or whatever.
The only real change I made was to use a string selector to the on call.
I saw on the desktop you get a drag start followed by a tap and then a drag end, but of course the element hasn’t actually moved. I’m not sure what effect it would have on jsPlumb if I were to change that behaviour in Katavorio.
In an earlier message I said the library being used under the hood is katavorio. That’s actually only for dragging. For event handling it’s https://github.com/sporritt/mottle.
I should probably update the Mottle docs if people are going to use the project...
The callback is given an Event. A browser Event.
….I was writing that last reply on my phone. Whenever I do that I get frustrated quickly and end up writing far fewer words than I had intended.
Anyway so it’s a native browser Event, meaning it doesn’t have the layer of normalisation that jQuery and other libraries give you. In practise this is not much of a drama, in my experience, but there are a couple of small things that can catch you out. One such thing is the fact that in older versions of IE there is no stopPropagation or preventDefault method on the Event object; you have to use event.returnValue = false instead. To deal with that Mottle offers a static method:
Mottle.consume(someEvent);
another static method Mottle has is one that can get you the “page location” of some event (because the information used to determine this can vary amongst desktop browsers, and touch events introduce further differences):
Mottle.pageLocation(someEvent)
For touch events with multiple touches, the location of the first touch is the one that is used.