@@ -6,10 +6,6 @@ var _react = require('react');
66
77var _react2 = _interopRequireDefault ( _react ) ;
88
9- var _reactDom = require ( 'react-dom' ) ;
10-
11- var _reactDom2 = _interopRequireDefault ( _reactDom ) ;
12-
139var _lodash = require ( 'lodash.map' ) ;
1410
1511var _lodash2 = _interopRequireDefault ( _lodash ) ;
@@ -68,9 +64,9 @@ function isInvalidLatLngArray(arr) {
6864 return ! isValidLatLngArray ( arr ) ;
6965}
7066
71- function safeRemoveLayer ( map , el ) {
72- var _map $getPanes = map . getPanes ( ) ,
73- overlayPane = _map $getPanes. overlayPane ;
67+ function safeRemoveLayer ( leafletMap , el ) {
68+ var _leafletMap $getPanes = leafletMap . getPanes ( ) ,
69+ overlayPane = _leafletMap $getPanes. overlayPane ;
7470
7571 if ( overlayPane . contains ( el ) ) {
7672 overlayPane . removeChild ( el ) ;
@@ -95,41 +91,34 @@ var HeatmapLayer = function (_MapLayer) {
9591 } ;
9692
9793 HeatmapLayer . prototype . componentDidMount = function componentDidMount ( ) {
98- var _style ;
94+ var _this2 = this ;
9995
10096 var canAnimate = this . context . map . options . zoomAnimation && _leaflet2 . default . Browser . any3d ;
10197 var zoomClass = 'leaflet-zoom-' + ( canAnimate ? 'animated' : 'hide' ) ;
10298 var mapSize = this . context . map . getSize ( ) ;
10399 var transformProp = _leaflet2 . default . DomUtil . testProp ( [ 'transformOrigin' , 'WebkitTransformOrigin' , 'msTransformOrigin' ] ) ;
104100
105- var canvasProps = {
106- className : 'leaflet-heatmap-layer leaflet-layer ' + zoomClass ,
107- style : ( _style = { } , _style [ transformProp ] = '50% 50%' , _style ) ,
108- width : mapSize . x ,
109- height : mapSize . y
110- } ;
111-
112101 this . _el = _leaflet2 . default . DomUtil . create ( 'canvas' , zoomClass ) ;
113102 this . _el . style [ transformProp ] = '50% 50%' ;
114103 this . _el . width = mapSize . x ;
115104 this . _el . height = mapSize . y ;
116105
117106 var el = this . _el ;
118107
119- var element = _leaflet2 . default . Layer . extend ( {
120- onAdd : function onAdd ( map ) {
121- map . getPanes ( ) . overlayPane . appendChild ( el ) ;
108+ var Heatmap = _leaflet2 . default . Layer . extend ( {
109+ onAdd : function onAdd ( leafletMap ) {
110+ return leafletMap . getPanes ( ) . overlayPane . appendChild ( el ) ;
122111 } ,
123- addTo : function addTo ( map ) {
124- map . addLayer ( this ) ;
125- return this ;
112+ addTo : function addTo ( leafletMap ) {
113+ leafletMap . addLayer ( _this2 ) ;
114+ return _this2 ;
126115 } ,
127- onRemove : function onRemove ( map ) {
128- safeRemoveLayer ( map , el ) ;
116+ onRemove : function onRemove ( leafletMap ) {
117+ return safeRemoveLayer ( leafletMap , el ) ;
129118 }
130119 } ) ;
131120
132- this . leafletElement = new element ( ) ;
121+ this . leafletElement = new Heatmap ( ) ;
133122 _MapLayer . prototype . componentDidMount . call ( this ) ;
134123 this . _heatmap = ( 0 , _simpleheat2 . default ) ( this . _el ) ;
135124 this . reset ( ) ;
@@ -222,14 +211,14 @@ var HeatmapLayer = function (_MapLayer) {
222211 } ;
223212
224213 HeatmapLayer . prototype . attachEvents = function attachEvents ( ) {
225- var _this2 = this ;
214+ var _this3 = this ;
226215
227216 var leafletMap = this . props . map ;
228217 leafletMap . on ( 'viewreset' , function ( ) {
229- return _this2 . reset ( ) ;
218+ return _this3 . reset ( ) ;
230219 } ) ;
231220 leafletMap . on ( 'moveend' , function ( ) {
232- return _this2 . reset ( ) ;
221+ return _this3 . reset ( ) ;
233222 } ) ;
234223 if ( leafletMap . options . zoomAnimation && _leaflet2 . default . Browser . any3d ) {
235224 leafletMap . on ( 'zoomanim' , this . _animateZoom , this ) ;
@@ -241,9 +230,9 @@ var HeatmapLayer = function (_MapLayer) {
241230 var offset = this . context . map . _getCenterOffset ( e . center ) . _multiplyBy ( - scale ) . subtract ( this . context . map . _getMapPanePos ( ) ) ;
242231
243232 if ( _leaflet2 . default . DomUtil . setTransform ) {
244- _leaflet2 . default . DomUtil . setTransform ( this . refs . container , offset , scale ) ;
233+ _leaflet2 . default . DomUtil . setTransform ( this . _el , offset , scale ) ;
245234 } else {
246- this . refs . container . style [ _leaflet2 . default . DomUtil . TRANSFORM ] = _leaflet2 . default . DomUtil . getTranslateString ( offset ) + ' scale(' + scale + ')' ;
235+ this . _el . style [ _leaflet2 . default . DomUtil . TRANSFORM ] = _leaflet2 . default . DomUtil . getTranslateString ( offset ) + ' scale(' + scale + ')' ;
247236 }
248237 } ;
249238
@@ -254,10 +243,10 @@ var HeatmapLayer = function (_MapLayer) {
254243 var size = this . context . map . getSize ( ) ;
255244
256245 if ( this . _heatmap . _width !== size . x ) {
257- this . refs . container . width = this . _heatmap . _width = size . x ;
246+ this . _el . width = this . _heatmap . _width = size . x ;
258247 }
259248 if ( this . _heatmap . _height !== size . y ) {
260- this . refs . container . height = this . _heatmap . _height = size . y ;
249+ this . _el . height = this . _heatmap . _height = size . y ;
261250 }
262251
263252 if ( this . _heatmap && ! this . _frame && ! this . props . map . _animating ) {
0 commit comments