michaelguild13 / Leaflet.draw

Vector drawing and editing plugin for Leaflet
MIT License
44 stars 35 forks source link

Failures on Windows devices with touchscreens #4

Open rajadain opened 9 years ago

rajadain commented 9 years ago

I've discovered these while working on another project with this fork https://github.com/WikiWatershed/model-my-watershed/pull/502 (please refrain from commenting there, and add pertinent information here instead). Specifically, these issues were discovered:

I do not currently have access to a Windows touch device, but will test and update this as soon as I do. However, I have no reason to believe that these behaviors have changed with new version of Chrome, Firefox, and IE. I also do not have access to a Windows Phone device to test in IE Mobile.

ddproxy commented 8 years ago

@rajadain - could you try 0.2.5 of ddproxy/Leaflet.draw ?

    "leaflet-draw": "git+https://github.com/ddproxy/Leaflet.draw.git",

I've recently patched some touch issues that should fix: https://github.com/WikiWatershed/model-my-watershed/issues/649 https://github.com/WikiWatershed/model-my-watershed/issues/892 (closed)

rajadain commented 8 years ago

@ddproxy Thanks, that looks promising! I don't have a Windows Touchscreen device near me at the moment, but will try and test tomorrow!

ddproxy commented 8 years ago

Commented a bit too quickly - the particular issue with #892 is touch events being triggered twice per 'touch click'. 0.2.5 patches this issue in a similar manner to Leaflet's internal touch-restriction.

ddproxy commented 8 years ago

It's "better" but not working quite as well as I'd like.

Touch works in Microsoft Edge but normal point-click now malfunctions. Chrome polyline performs properly but polygon does not. Firefox point-click performs properly but touch is not being triggered properly.

Side note - @rajadain - I've been hovering a bit, watching model-my-watershed - I'd be interested in getting to know more about that project if you have some spare time.

rajadain commented 8 years ago

I just tested 0.2.5 on various platforms, and while it works correctly (and hasn't broken) on most platforms, it misses out on Chrome on touch-enabled Windows which is one of our main platforms:

This is good work, and I'll keep an eye out for any updates.

ddproxy commented 8 years ago

Thanks for the report!

My target is also Chrome and Firefox, it's just hard debugging this issue at the moment. I'll let you know when I create an additional patch after testing.

rajadain commented 8 years ago

Model My Watershed is an educational web app that allows the user to study the effects of precipitation and land use modifications on water behavior, such as ground infiltration, runoff, or evaporation. The idea is that you can compare how water behaves in a geographical area currently, how it behaved pre-development, and how changing the land use will effect the watershed. The user can simulate many scenarios and compare the results, which allow them to make decisions about landscape development.

We don't have a deploy for the general public available just yet, but I'll let you know when we do.

arahansen commented 8 years ago

Is there any update on this issue? I've had users run into this recently.

Also, is this the "canonical" ticket being tracked for this issue? The same problem is being reported several different places.

ddproxy commented 8 years ago

Hey @arahansen , Leaflet.draw 0.3.0 has been released with touch support. I'd suggest any additional issues/reports be made on Leaflet.draw repository.

I'll draft an issue template later, but if you don't mind including leaflet version, source (npm/bower) and any stack traces (or lack) I'd appreciate it.

mike-unearth commented 7 years ago

I fixed the IE issue in my project by overwriting the addPointerListener function with the missing events (touchcancel and touchleave) added in:

L.extend(L.DomEvent, {
    addPointerListener: function (obj, type, handler, id) {
        switch (type) {
        case 'touchstart':
            return this.addPointerListenerStart(obj, type, handler, id);
        case 'touchend':
            return this.addPointerListenerEnd(obj, type, handler, id);
        case 'touchmove':
            return this.addPointerListenerMove(obj, type, handler, id);
        case 'touchcancel':
            return;
        case 'touchleave':
            return;
        default:
            console.warn('Unknown touch event type: ' + type);
        }
    }
});