leaflet-rotate 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/map/Map.js CHANGED
@@ -119,12 +119,19 @@ L.Map.include({
119
119
  if (!this._rotate && mapProto.mapBoundsToContainerBounds) {
120
120
  return mapProto.mapBoundsToContainerBounds.apply(this, arguments);
121
121
  }
122
+
123
+ // const nw = this.latLngToContainerPoint(bounds.getNorthWest()),
124
+ // ne = this.latLngToContainerPoint(bounds.getNorthEast()),
125
+ // sw = this.latLngToContainerPoint(bounds.getSouthWest()),
126
+ // se = this.latLngToContainerPoint(bounds.getSouthEast());
127
+
122
128
  // same as `this.latLngToContainerPoint(latlng)` but with floating point precision
123
- const origin = this.getPixelOrigin().add(this._getMapPanePos());
124
- const nw = this.project(bounds.getNorthWest())._subtract(origin),
125
- ne = this.project(bounds.getNorthEast())._subtract(origin),
126
- sw = this.project(bounds.getSouthWest())._subtract(origin),
127
- se = this.project(bounds.getSouthEast())._subtract(origin);
129
+ const origin = this.getPixelOrigin();
130
+ const nw = this.layerPointToContainerPoint(this.project(bounds.getNorthWest())._subtract(origin)),
131
+ ne = this.layerPointToContainerPoint(this.project(bounds.getNorthEast())._subtract(origin)),
132
+ sw = this.layerPointToContainerPoint(this.project(bounds.getSouthWest())._subtract(origin)),
133
+ se = this.layerPointToContainerPoint(this.project(bounds.getSouthEast())._subtract(origin));
134
+
128
135
  return L.bounds([
129
136
  L.point(Math.min(nw.x, ne.x, se.x, sw.x), Math.min(nw.y, ne.y, se.y, sw.y)), // [ minX, minY ]
130
137
  L.point(Math.max(nw.x, ne.x, se.x, sw.x), Math.max(nw.y, ne.y, se.y, sw.y)) // [ maxX, maxY ]