iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
989 stars 552 forks source link

Update Leaflet.draw to release 0.3.0 for touch device support in DrawTools? #1142

Open sndirsch opened 8 years ago

sndirsch commented 8 years ago

Apparently with release 0.3.0 (2016-03-08) touch device support has been added to Leaflet.draw, which is used by DrawTools plugin. Any plans to update this so we can finally use Draw Tools also on mobile devices without having to add a BT mouse or USB mouse plugged in via OTG?

/edit Related posting on IITC Community: https://plus.google.com/+StefanDirsch/posts/YUahqygYM4b

s-chizhik commented 8 years ago

Similar issue

sndirsch commented 8 years ago

I was able to update leaflet.draw to release 0.4.0 and refix portal snapping support (IITC is patching it). See https://github.com/sndirsch/ingress-intel-total-conversion/commit/fc6c7bea38a7ed34f1bba79d6b7d50fab7b463db, https://github.com/sndirsch/ingress-intel-total-conversion/commit/3576fd18cf0930d38f52f61cc1dd3897c3850070 and https://github.com/sndirsch/ingress-intel-total-conversion/commit/548fe742570d926be852b867655c7fe102314eb9 (see my fork on https://github.com/sndirsch/ingress-intel-total-conversion/). This makes it possible to use draw-tools also on the mobile platform with touch, but snapping to portals there does not work. It appears to me, that once you are close to a portal, this gets selected and draw tools disabled in this moment. I'm afraid I'm not the guy, who has the knowledge to address that issue. :-( Unfortunately missing support for snapping to portals makes DrawTools rather useless IMO.

s-chizhik commented 8 years ago

@sndirsch I've updated leaflet without any problems. Snapping to portals also works fine. You can have a look to my dev branch

sndirsch commented 8 years ago

@s-chizhik , your dev branch doesn't work for me. Snapping doesn't work neither on the desktop nor on the mobile platform. Seems you've just updated the leaflet.draw.js file without adding/adjusting the snapportal patches to it.

McBen commented 8 years ago

@sndirsch leaflet.draw is not using geodesic lines. You have to replace Polyline & Polygon by GeodesicPolyline & GeodesicPolygon.

/edit add a comment that this is a customized and not the original Leaflet.draw. An even better approach would be to move all changed outside of the 3rd-pary code - if possible.

sndirsch commented 8 years ago

@McBen Thanks. I'm checking now all changes to leaflet.draw/leaflet.draw.css in git after update to 0.2.1. Switching to GeodesicPolyline & GeodesicPolygon won't fix snapping on mobile or refix crossed/done links plugin, which I broke with this leaflet.draw update, right?

McBen commented 8 years ago

it should. But I didn't checked what else was changes in leaflet.draw.

snip from 'crosslink' (where it depends on leaflet.draw / drawtools plugin): for (var i in plugin.drawTools.drawnItems._layers) { var layer = plugin.drawTools.drawnItems._layers[i]; if (layer instanceof L.GeodesicPolygon) {

sndirsch commented 8 years ago

@McBen Indeed this fixes the cross/done plugins. Thanks a lot. Will add this to my fork ASAP.

/edit done ;-)