Skip to content

Commit b07b2c3

Browse files
committed
Fix: æCannot read property _animating of undefined' by replacing props.map with context.map
1 parent f33efde commit b07b2c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/HeatmapLayer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export default class HeatmapLayer extends MapLayer {
214214
}
215215

216216
attachEvents(): void {
217-
const leafletMap: Map = this.props.map;
217+
const leafletMap: Map = this.context.map;
218218
leafletMap.on('viewreset', () => this.reset());
219219
leafletMap.on('moveend', () => this.reset());
220220
if (leafletMap.options.zoomAnimation && L.Browser.any3d) {
@@ -251,7 +251,7 @@ export default class HeatmapLayer extends MapLayer {
251251
this._el.height = this._heatmap._height = size.y;
252252
}
253253

254-
if (this._heatmap && !this._frame && !this.props.map._animating) {
254+
if (this._heatmap && !this._frame && !this.context.map._animating) {
255255
this._frame = L.Util.requestAnimFrame(this.redraw, this);
256256
}
257257

@@ -276,7 +276,7 @@ export default class HeatmapLayer extends MapLayer {
276276
);
277277

278278
const cellSize = r / 2;
279-
const panePos = this.props.map._getMapPanePos();
279+
const panePos = this.context.map._getMapPanePos();
280280
const offsetX = panePos.x % cellSize;
281281
const offsetY = panePos.y % cellSize;
282282
const getLat = this.props.latitudeExtractor;
@@ -340,7 +340,7 @@ export default class HeatmapLayer extends MapLayer {
340340
)
341341
);
342342

343-
const data = getDataForHeatmap(this.props.points, this.props.map);
343+
const data = getDataForHeatmap(this.props.points, this.context.map);
344344

345345
this._heatmap.clear();
346346
this._heatmap.data(data).draw(this.getMinOpacity(this.props));

0 commit comments

Comments
 (0)