Git Product home page Git Product logo

Comments (2)

chriswilley avatar chriswilley commented on July 29, 2024 1

@ogix I discovered this same issue when I upgraded to 1.1.0 of Leaflet. As I do not need to support Leaflet 0.7.x, my solution was to comment out the following section at the top of the source file L.CanvasLayer.js:

L.DomUtil.setTransform = L.DomUtil.setTransform || function (el, offset, scale) {
    var pos = offset || new L.Point(0, 0);

    el.style[L.DomUtil.TRANSFORM] =
	(L.Browser.ie3d ?
	'translate(' + pos.x + 'px,' + pos.y + 'px)' :
	'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
	(scale ? ' scale(' + scale + ')' : '');
};

and then run "gulp scripts" to re-concatenate the JavaScript modules.

The developer included a _setTransform function in L.CanvasLayer.js that is a duplicate of the above section. As the only reference to setTransform occurs in the _animateZoom function in the same module, you might try adding the following exception catch:

_animateZoom: function _animateZoom(e) {
    var scale = this._map.getZoomScale(e.zoom);
    // -- different calc of offset in leaflet 1.0.0 and 0.0.7 thanks for 1.0.0-rc2 calc @jduggan1
    var offset = L.Layer ? this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(), e.zoom, e.center) : this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos());

    try {
        L.DomUtil.setTransform(this._canvas, offset, scale);
    }
    catch (err) {
        this._setTransform(this._canvas, offset. scale);
    }
}

I have no way of testing this to see if it allows Leaflet 0.7.x to work, but my own fix above at least got this plugin working in my setup. Hope this helps.

from leaflet-velocity.

chriswilley avatar chriswilley commented on July 29, 2024

Also see this discussion on Leaflet's GitHub repo. It appears that they want plugins to use their own namespaces rather than altering the L namespace. This supports using the _setTransform function approach, I think.

from leaflet-velocity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.