MrMufflon / Leaflet.Elevation

Leaflet plugin to view height profile of GeoJSON- and GPX polylines using d3
http://mrmufflon.github.io/Leaflet.Elevation
MIT License
276 stars 83 forks source link

Issues in Internet Explorer and Edge #58

Open corinat opened 8 years ago

corinat commented 8 years ago

Hello,

It seems there is a problem with the plugin in Internet Explorer and Edge, the icon doesn't appear on the track when the mouse is over the profile. Has anyone figured the cause of this? I believe there is a compatibility problem with the d3.js library.

MrMufflon commented 8 years ago

I think some of the touch events changed in Edge, but I'm not sure and unfortunately currently have no time for investigation.

corinat commented 8 years ago

My solution for this issue was this : "if (L.Browser.chrome.touch) { background.on("touchmove.drag", this._dragHandler.bind(this)). on("touchstart.drag", this._dragStartHandler.bind(this)). on("touchstart.focus", this._mousemoveHandler.bind(this)); L.DomEvent.on(this._container, 'touchend', this._dragEndHandler, this);

    } else {
        background.on("mousemove.focus", this._mousemoveHandler.bind(this)).
        on("mouseout.focus", this._mouseoutHandler.bind(this)).
        on("mousedown.drag", this._dragStartHandler.bind(this)).
        on("mousemove.drag", this._dragHandler.bind(this));
        L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);
    }

    if (L.Browser.chrome) {
        background.on("touchmove.drag", this._dragHandler.bind(this)).
        on("touchstart.drag", this._dragStartHandler.bind(this)).
        on("touchstart.focus", this._mousemoveHandler.bind(this));
        L.DomEvent.on(this._container, 'touchend', this._dragEndHandler, this);

    } else {
        background.on("mousemove.focus", this._mousemoveHandler.bind(this)).
        on("mouseout.focus", this._mouseoutHandler.bind(this)).
        on("mousedown.drag", this._dragStartHandler.bind(this)).
        on("mousemove.drag", this._dragHandler.bind(this));
        L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);
    }

     if (L.Browser.ie.touch) {              
         background.on("mousemove.focus", this._mousemoveHandler.bind(this)).
        on("mouseout.focus", this._mouseoutHandler.bind(this)).
        on("mousedown.drag", this._dragStartHandler.bind(this)).
        on("mousemove.drag", this._dragHandler.bind(this));
        L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);             
     } else if (L.Browser.ie) {              
         background.on("mousemove.focus", this._mousemoveHandler.bind(this)).
        on("mouseout.focus", this._mouseoutHandler.bind(this)).
        on("mousedown.drag", this._dragStartHandler.bind(this)).
        on("mousemove.drag", this._dragHandler.bind(this));
        L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);             
     }"

I don't know how elegant this is, but it works for all the browsers.

fbonzon commented 8 years ago

I see the same issue, with latest versions of Edge and IE.

@corinat Can you fork this repo and show what you changed to make the altitude appear when mousing over the profile ?

corinat commented 8 years ago

Hi @fbonzon . I created a pull request file where I put the code. I am not used working on github, so I hope I didn't mess things up. :)

nrenner commented 7 years ago

see also #67