docs/examples/libs/Leaflet.draw.drag-src.js
function(matrix) {
    var path = this._path;
    var i, len, latlng;

    var px = L.point(matrix[4], matrix[5]);

    var crs = path._map.options.crs;
    var transformation = crs.transformation;
    var scale = crs.scale(path._map.getZoom());
    var projection = crs.projection;

    var diff = transformation.untransform(px, scale)
      .subtract(transformation.untransform(L.point(0, 0), scale));

    // console.time('transform');

    // all shifts are in-place
    if (path._point) { // L.Circle
      path._latlng = projection.unproject(
        projection.project(path._latlng)._add(diff));
      path._point._add(px);
    } else if (path._originalPoints) { // everything else
      for (i = 0, len = path._originalPoints.length; i < len; i++) {
        latlng = path._latlngs[i];
        path._latlngs[i] = projection
          .unproject(projection.project(latlng)._add(diff));
        path._originalPoints[i]._add(px);
      }
    }

    // holes operations
    if (path._holes) {
      for (i = 0, len = path._holes.length; i < len; i++) {
        for (var j = 0, len2 = path._holes[i].length; j < len2; j++) {
          latlng = path._holes[i][j];
          path._holes[i][j] = projection
            .unproject(projection.project(latlng)._add(diff));
          path._holePoints[i][j]._add(px);
        }
      }
    }

    // console.timeEnd('transform');

    path._updatePath();
  }
function(matrix) {
    var path = this._path;
    var i, len, latlng;

    var px = L.point(matrix[4], matrix[5]);

    var crs = path._map.options.crs;
    var transformation = crs.transformation;
    var scale = crs.scale(path._map.getZoom());
    var projection = crs.projection;

    var diff = transformation.untransform(px, scale)
      .subtract(transformation.untransform(L.point(0, 0), scale));

    // console.time('transform');

    // all shifts are in-place
    if (path._point) { // L.Circle
      path._latlng = projection.unproject(
        projection.project(path._latlng)._add(diff));
      path._point._add(px);
    } else if (path._originalPoints) { // everything else
      for (i = 0, len = path._originalPoints.length; i < len; i++) {
        latlng = path._latlngs[i];
        path._latlngs[i] = projection
          .unproject(projection.project(latlng)._add(diff));
        path._originalPoints[i]._add(px);
      }
    }

    // holes operations
    if (path._holes) {
      for (i = 0, len = path._holes.length; i < len; i++) {
        for (var j = 0, len2 = path._holes[i].length; j < len2; j++) {
          latlng = path._holes[i][j];
          path._holes[i][j] = projection
            .unproject(projection.project(latlng)._add(diff));
          path._holePoints[i][j]._add(px);
        }
      }
    }

    // console.timeEnd('transform');

    path._updatePath();
  }
function ( matrix ) { var path = this . _path ; var i , len , latlng ; var px = L . point ( matrix [ 4 ] , matrix [ 5 ] ) ; var crs = path . _map . options . crs ; var transformation = crs . transformation ; var scale = crs . scale ( path . _map . getZoom ( ) ) ; var projection = crs . projection ; var diff = transformation . untransform ( px , scale ) . subtract ( transformation . untransform ( L . point ( 0 , 0 ) , scale ) ) ; // console.time('transform'); // all shifts are in-place if ( path . _point ) { // L.Circle path . _latlng = projection . unproject ( projection . project ( path . _latlng ) . _add ( diff ) ) ; path . _point . _add ( px ) ; } else if ( path . _originalPoints ) { // everything else for ( i = 0 , len = path . _originalPoints . length ; i < len ; i ++ ) { latlng = path . _latlngs [ i ] ; path . _latlngs [ i ] = projection . unproject ( projection . project ( latlng ) . _add ( diff ) ) ; path . _originalPoints [ i ] . _add ( px ) ; } } // holes operations if ( path . _holes ) { for ( i = 0 , len = path . _holes . length ; i < len ; i ++ ) { for ( var j = 0 , len2 = path . _holes [ i ] . length ; j < len2 ; j ++ ) { latlng = path . _holes [ i ] [ j ] ; path . _holes [ i ] [ j ] = projection . unproject ( projection . project ( latlng ) . _add ( diff ) ) ; path . _holePoints [ i ] [ j ] . _add ( px ) ; } } } // console.timeEnd('transform'); path . _updatePath ( ) ; }
Applies transformation, does it in one sweep for performance,
so don't be surprised about the code repetition.

[ x ]   [ a  b  tx ] [ x ]   [ a * x + b * y + tx ]
[ y ] = [ c  d  ty ] [ y ] = [ c * x + d * y + ty ]

@param {Array.<Number>} matrix
Applies transformation does it in one sweep for performance so don t be surprised about the code repetition .