mapbox / mapbox-gl-js-mock

A maybe-some-day-fully-featured mock for mapbox-gl-js
BSD 3-Clause "New" or "Revised" License
25 stars 33 forks source link

feat(map): add a loadTile to the object returned by getSource() #12

Closed Scarysize closed 7 years ago

Scarysize commented 7 years ago

I know loadTile is not part of the public API of a raster source. But we are overwriting it from the outside to only load tiles in a given bounding box:

  const source = map.getSource(id);
  const originalLoadTile = source.loadTile.bind(source);

  source.loadTile = (tile, callback) => {
    const intersects = testTileIntersection(boundingBox, tile);

    if (intersects) {
      return originalLoadTile(tile, callback);
    }

    return callback(null);
  };

We just need the property on the object. Shouldn't hurt anyone.

mcwhittemore commented 7 years ago

Yea, I think this is ok as its a noop function.

Scarysize commented 7 years ago

Thanks for the fast review, merge and release <3