|
28 | 28 | }; |
29 | 29 | } |
30 | 30 |
|
| 31 | + var _extends = Object.assign || function (target) { |
| 32 | + for (var i = 1; i < arguments.length; i++) { |
| 33 | + var source = arguments[i]; |
| 34 | + |
| 35 | + for (var key in source) { |
| 36 | + if (Object.prototype.hasOwnProperty.call(source, key)) { |
| 37 | + target[key] = source[key]; |
| 38 | + } |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + return target; |
| 43 | + }; |
| 44 | + |
| 45 | + function _objectWithoutProperties(obj, keys) { |
| 46 | + var target = {}; |
| 47 | + |
| 48 | + for (var i in obj) { |
| 49 | + if (keys.indexOf(i) >= 0) continue; |
| 50 | + if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; |
| 51 | + target[i] = obj[i]; |
| 52 | + } |
| 53 | + |
| 54 | + return target; |
| 55 | + } |
| 56 | + |
31 | 57 | function _classCallCheck(instance, Constructor) { |
32 | 58 | if (!(instance instanceof Constructor)) { |
33 | 59 | throw new TypeError("Cannot call a class as a function"); |
|
135 | 161 | mapCenter = _props.mapCenter, |
136 | 162 | icon = _props.icon, |
137 | 163 | gradient = _props.gradient, |
138 | | - radius = _props.radius, |
139 | | - opacity = _props.opacity; |
140 | | - |
| 164 | + _props$radius = _props.radius, |
| 165 | + radius = _props$radius === undefined ? 20 : _props$radius, |
| 166 | + _props$opacity = _props.opacity, |
| 167 | + opacity = _props$opacity === undefined ? 0.2 : _props$opacity, |
| 168 | + props = _objectWithoutProperties(_props, ['map', 'google', 'positions', 'mapCenter', 'icon', 'gradient', 'radius', 'opacity']); |
141 | 169 |
|
142 | 170 | if (!google) { |
143 | 171 | return null; |
144 | 172 | } |
145 | 173 |
|
146 | | - positions = positions.map(function (pos) { |
| 174 | + var data = positions.map(function (pos) { |
147 | 175 | return new google.maps.LatLng(pos.lat, pos.lng); |
148 | 176 | }); |
149 | 177 |
|
150 | | - var pref = { |
| 178 | + var pref = _extends({ |
151 | 179 | map: map, |
152 | | - data: positions |
153 | | - }; |
| 180 | + gradient: gradient, |
| 181 | + radius: radius, |
| 182 | + opacity: opacity, |
| 183 | + data: data |
| 184 | + }, props); |
154 | 185 |
|
155 | 186 | this.heatMap = new google.maps.visualization.HeatmapLayer(pref); |
156 | 187 |
|
157 | | - this.heatMap.set('gradient', gradient); |
158 | | - |
159 | 188 | this.heatMap.set('radius', radius === undefined ? 20 : radius); |
160 | 189 |
|
161 | 190 | this.heatMap.set('opacity', opacity === undefined ? 0.2 : opacity); |
|
0 commit comments