22
33exports . __esModule = true ;
44
5+ var _class , _temp ;
6+
57var _react = require ( 'react' ) ;
68
79var _react2 = _interopRequireDefault ( _react ) ;
@@ -81,7 +83,7 @@ function shouldIgnoreLocation(loc) {
8183 return isInvalid ( loc . lng ) || isInvalid ( loc . lat ) ;
8284}
8385
84- var HeatmapLayer = function ( _MapLayer ) {
86+ exports . default = ( 0 , _reactLeaflet . withLeaflet ) ( ( _temp = _class = function ( _MapLayer ) {
8587 _inherits ( HeatmapLayer , _MapLayer ) ;
8688
8789 function HeatmapLayer ( ) {
@@ -97,9 +99,9 @@ var HeatmapLayer = function (_MapLayer) {
9799 HeatmapLayer . prototype . componentDidMount = function componentDidMount ( ) {
98100 var _this2 = this ;
99101
100- var canAnimate = this . context . map . options . zoomAnimation && _leaflet2 . default . Browser . any3d ;
102+ var canAnimate = this . props . leaflet . map . options . zoomAnimation && _leaflet2 . default . Browser . any3d ;
101103 var zoomClass = 'leaflet-zoom-' + ( canAnimate ? 'animated' : 'hide' ) ;
102- var mapSize = this . context . map . getSize ( ) ;
104+ var mapSize = this . props . leaflet . map . getSize ( ) ;
103105 var transformProp = _leaflet2 . default . DomUtil . testProp ( [ 'transformOrigin' , 'WebkitTransformOrigin' , 'msTransformOrigin' ] ) ;
104106
105107 this . _el = _leaflet2 . default . DomUtil . create ( 'canvas' , zoomClass ) ;
@@ -228,7 +230,7 @@ var HeatmapLayer = function (_MapLayer) {
228230 } ;
229231
230232 HeatmapLayer . prototype . componentWillUnmount = function componentWillUnmount ( ) {
231- safeRemoveLayer ( this . context . map , this . _el ) ;
233+ safeRemoveLayer ( this . props . leaflet . map , this . _el ) ;
232234 } ;
233235
234236 HeatmapLayer . prototype . fitBounds = function fitBounds ( ) {
@@ -242,11 +244,11 @@ var HeatmapLayer = function (_MapLayer) {
242244 return ;
243245 }
244246
245- this . context . map . fitBounds ( _leaflet2 . default . latLngBounds ( _leaflet2 . default . latLng ( sw ) , _leaflet2 . default . latLng ( ne ) ) ) ;
247+ this . props . leaflet . map . fitBounds ( _leaflet2 . default . latLngBounds ( _leaflet2 . default . latLng ( sw ) , _leaflet2 . default . latLng ( ne ) ) ) ;
246248 } ;
247249
248250 HeatmapLayer . prototype . componentDidUpdate = function componentDidUpdate ( ) {
249- this . context . map . invalidateSize ( ) ;
251+ this . props . leaflet . map . invalidateSize ( ) ;
250252 if ( this . props . fitBoundsOnUpdate ) {
251253 this . fitBounds ( ) ;
252254 }
@@ -260,7 +262,7 @@ var HeatmapLayer = function (_MapLayer) {
260262 HeatmapLayer . prototype . attachEvents = function attachEvents ( ) {
261263 var _this3 = this ;
262264
263- var leafletMap = this . context . map ;
265+ var leafletMap = this . props . leaflet . map ;
264266 leafletMap . on ( 'viewreset' , function ( ) {
265267 return _this3 . reset ( ) ;
266268 } ) ;
@@ -273,8 +275,8 @@ var HeatmapLayer = function (_MapLayer) {
273275 } ;
274276
275277 HeatmapLayer . prototype . _animateZoom = function _animateZoom ( e ) {
276- var scale = this . context . map . getZoomScale ( e . zoom ) ;
277- var offset = this . context . map . _getCenterOffset ( e . center ) . _multiplyBy ( - scale ) . subtract ( this . context . map . _getMapPanePos ( ) ) ;
278+ var scale = this . props . leaflet . map . getZoomScale ( e . zoom ) ;
279+ var offset = this . props . leaflet . map . _getCenterOffset ( e . center ) . _multiplyBy ( - scale ) . subtract ( this . props . leaflet . map . _getMapPanePos ( ) ) ;
278280
279281 if ( _leaflet2 . default . DomUtil . setTransform ) {
280282 _leaflet2 . default . DomUtil . setTransform ( this . _el , offset , scale ) ;
@@ -284,10 +286,10 @@ var HeatmapLayer = function (_MapLayer) {
284286 } ;
285287
286288 HeatmapLayer . prototype . reset = function reset ( ) {
287- var topLeft = this . context . map . containerPointToLayerPoint ( [ 0 , 0 ] ) ;
289+ var topLeft = this . props . leaflet . map . containerPointToLayerPoint ( [ 0 , 0 ] ) ;
288290 _leaflet2 . default . DomUtil . setPosition ( this . _el , topLeft ) ;
289291
290- var size = this . context . map . getSize ( ) ;
292+ var size = this . props . leaflet . map . getSize ( ) ;
291293
292294 if ( this . _heatmap . _width !== size . x ) {
293295 this . _el . width = this . _heatmap . _width = size . x ;
@@ -296,7 +298,7 @@ var HeatmapLayer = function (_MapLayer) {
296298 this . _el . height = this . _heatmap . _height = size . y ;
297299 }
298300
299- if ( this . _heatmap && ! this . _frame && ! this . context . map . _animating ) {
301+ if ( this . _heatmap && ! this . _frame && ! this . props . leaflet . map . _animating ) {
300302 this . _frame = _leaflet2 . default . Util . requestAnimFrame ( this . redraw , this ) ;
301303 }
302304
@@ -305,16 +307,16 @@ var HeatmapLayer = function (_MapLayer) {
305307
306308 HeatmapLayer . prototype . redraw = function redraw ( ) {
307309 var r = this . _heatmap . _r ;
308- var size = this . context . map . getSize ( ) ;
310+ var size = this . props . leaflet . map . getSize ( ) ;
309311
310312 var maxIntensity = this . props . max === undefined ? 1 : this . getMax ( this . props ) ;
311313
312- var maxZoom = this . props . maxZoom === undefined ? this . context . map . getMaxZoom ( ) : this . getMaxZoom ( this . props ) ;
314+ var maxZoom = this . props . maxZoom === undefined ? this . props . leaflet . map . getMaxZoom ( ) : this . getMaxZoom ( this . props ) ;
313315
314- var v = 1 / Math . pow ( 2 , Math . max ( 0 , Math . min ( maxZoom - this . context . map . getZoom ( ) , 12 ) ) ) ;
316+ var v = 1 / Math . pow ( 2 , Math . max ( 0 , Math . min ( maxZoom - this . props . leaflet . map . getZoom ( ) , 12 ) ) / 2 ) ;
315317
316318 var cellSize = r / 2 ;
317- var panePos = this . context . map . _getMapPanePos ( ) ;
319+ var panePos = this . props . leaflet . map . _getMapPanePos ( ) ;
318320 var offsetX = panePos . x % cellSize ;
319321 var offsetY = panePos . y % cellSize ;
320322 var getLat = this . props . latitudeExtractor ;
@@ -383,7 +385,7 @@ var HeatmapLayer = function (_MapLayer) {
383385 return roundResults ( accumulateInGrid ( points , leafletMap , getBounds ( leafletMap ) ) ) ;
384386 } ;
385387
386- var data = getDataForHeatmap ( this . props . points , this . context . map ) ;
388+ var data = getDataForHeatmap ( this . props . points , this . props . leaflet . map ) ;
387389
388390 this . _heatmap . clear ( ) ;
389391 this . _heatmap . data ( data ) . draw ( this . getMinOpacity ( this . props ) ) ;
@@ -404,9 +406,7 @@ var HeatmapLayer = function (_MapLayer) {
404406 } ;
405407
406408 return HeatmapLayer ;
407- } ( _reactLeaflet . MapLayer ) ;
408-
409- HeatmapLayer . propTypes = {
409+ } ( _reactLeaflet . MapLayer ) , _class . propTypes = {
410410 points : _propTypes2 . default . array . isRequired ,
411411 longitudeExtractor : _propTypes2 . default . func . isRequired ,
412412 latitudeExtractor : _propTypes2 . default . func . isRequired ,
@@ -421,5 +421,4 @@ HeatmapLayer.propTypes = {
421421 minOpacity : _propTypes2 . default . number ,
422422 blur : _propTypes2 . default . number ,
423423 gradient : _propTypes2 . default . object
424- } ;
425- exports . default = HeatmapLayer ;
424+ } , _temp ) ) ;
0 commit comments