perliedman/leaflet-routing-machine

linetouched event doesn't triggered if addwaypoints = false

Closed this issue · 1 comments

Hi there,

If my line has addWaypoints set to false the linetouched event doesn't triggered. I want to do something other than add waypoints to my route.

            waypoints: waypoints,
            .......
            routeLine: (route) => {
                var line = L.Routing.line(route, {
                    styles: [{ color: "red", weight: 4 }],
                    extendToWaypoints: true,
                    missingRouteTolerance: 0,
                    addWaypoints: false
                });
                line.on('linetouched', (e: L.LeafletEvent) => {
                    console.log(e);
                });
                return line;
            },

Kind regards,
Basile

Sorry I found a solution in an old post :

                line.eachLayer((l) => {
                    l.on('click', (e) => {
                        console.log(e);
                    });
                });