@@ -9,14 +9,13 @@ import {
99 AppbaseSensorHelper as helper ,
1010 PoweredBy
1111} from "@appbaseio/reactivebase" ;
12- import { SearchAsMove } from "../addons/SearchAsMove" ;
12+ import _ from "lodash" ;
13+ import SearchAsMove from "../addons/SearchAsMove" ;
1314import { MapStyles , mapStylesCollection } from "../addons/MapStyles" ;
1415import * as ReactiveMapHelper from "../helper/ReactiveMapHelper" ;
1516
16- import _ from "lodash" ;
17-
1817const MapComponent = ( withGoogleMap ( ( props ) => {
19- const { children : children , onMapMounted : onMapMounted , ...allProps } = props ;
18+ const { children, onMapMounted, ...allProps } = props ;
2019
2120 return (
2221 < GoogleMap ref = { onMapMounted } { ...allProps } >
@@ -92,7 +91,7 @@ export default class ReactiveMap extends Component {
9291 this . setReact ( this . props ) ;
9392 this . createChannel ( updateExecute ) ;
9493 const currentMapStyle = this . getMapStyle ( this . props . defaultMapStyle ) ;
95- this . initialMapBoundQuery = this . props . defaultCenter ? true : false ;
94+ this . initialMapBoundQuery = ! ! this . props . defaultCenter ;
9695 this . applyGeoQuery = this . props . applyGeoQuery ? this . props . applyGeoQuery : this . props . setSearchAsMove ;
9796 this . setState ( {
9897 currentMapStyle
@@ -180,7 +179,7 @@ export default class ReactiveMap extends Component {
180179 delete modifiedData . data ;
181180 modifiedData = helper . prepareResultData ( modifiedData , res . data ) ;
182181 if ( this . props . onAllData ) {
183- if ( modifiedData . res ) {
182+ if ( modifiedData . res ) {
184183 modifiedData . res . mapRef = this . mapRef ;
185184 }
186185 const generatedData = this . props . onAllData ( modifiedData . res , modifiedData . err ) ;
@@ -252,7 +251,7 @@ export default class ReactiveMap extends Component {
252251 this . setState ( {
253252 rerender : true
254253 } , ( ) => {
255- if ( this . props . popoverTTL ) {
254+ if ( this . props . popoverTTL ) {
256255 this . watchPopoverTTL ( marker ) ;
257256 }
258257 } ) ;
@@ -268,18 +267,18 @@ export default class ReactiveMap extends Component {
268267 // watch and close popover on timeout
269268 watchPopoverTTL ( marker ) {
270269 this . popoverTTLStore = this . popoverTTLStore ? this . popoverTTLStore : { } ;
271- if ( this . popoverTTLStore [ marker . _type + marker . _id ] ) {
272- this . clearTTL ( marker . _type + marker . _id ) ;
270+ if ( this . popoverTTLStore [ marker . _type + marker . _id ] ) {
271+ this . clearTTL ( marker . _type + marker . _id ) ;
273272 } else {
274- this . popoverTTLStore [ marker . _type + marker . _id ] = setTimeout ( ( ) => {
273+ this . popoverTTLStore [ marker . _type + marker . _id ] = setTimeout ( ( ) => {
275274 this . handleMarkerClose ( marker ) ;
276- this . clearTTL ( marker . _type + marker . _id ) ;
277- } , this . props . popoverTTL * 1000 ) ;
275+ this . clearTTL ( marker . _type + marker . _id ) ;
276+ } , this . props . popoverTTL * 1000 ) ;
278277 }
279278 }
280279
281280 clearTTL ( id ) {
282- clearTimeout ( this . popoverTTLStore [ id ] )
281+ clearTimeout ( this . popoverTTLStore [ id ] ) ;
283282 delete this . popoverTTLStore [ id ] ;
284283 }
285284
@@ -325,7 +324,7 @@ export default class ReactiveMap extends Component {
325324 const flag = this . initialMapBoundQuery ? true : ( this . applyGeoQuery ? this . applyGeoQuery : this . searchAsMove ) ;
326325 this . setValue ( boundingBoxCoordinates , flag ) ;
327326 }
328- if ( ! _ . isEqual ( { mapBounds : this . state . mapBounds } , stateObj ) ) {
327+ if ( ! _ . isEqual ( { mapBounds : this . state . mapBounds } , stateObj ) ) {
329328 this . setState ( stateObj ) ;
330329 }
331330 }
@@ -454,9 +453,7 @@ export default class ReactiveMap extends Component {
454453 convertedGeo : [ ]
455454 } ;
456455 if ( markersData && markersData . length ) {
457- markersData = markersData . filter ( ( hit ) => {
458- return ReactiveMapHelper . identifyGeoData ( hit . _source [ self . props . dataField ] ) ;
459- } ) ;
456+ markersData = markersData . filter ( hit => ReactiveMapHelper . identifyGeoData ( hit . _source [ self . props . dataField ] ) ) ;
460457 response . markerComponent = markersData . map ( ( hit , index ) => {
461458 const field = ReactiveMapHelper . identifyGeoData ( hit . _source [ self . props . dataField ] ) ;
462459 response . convertedGeo . push ( field ) ;
@@ -475,7 +472,7 @@ export default class ReactiveMap extends Component {
475472 popoverEvent = { } ;
476473 popoverEvent . onClick = this . handleMarkerClick . bind ( this , hit ) ;
477474 }
478- const defaultFn = function ( ) { } ;
475+ const defaultFn = function ( ) { } ;
479476 const events = {
480477 onClick : this . props . markerOnClick ? this . props . markerOnClick : defaultFn ,
481478 onDblClick : this . props . markerOnDblClick ? this . props . markerOnDblClick : defaultFn ,
@@ -598,7 +595,7 @@ export default class ReactiveMap extends Component {
598595 { showMapStyles }
599596 < MapComponent
600597 onMapMounted = { ( ref ) => {
601- this . mapRef = ref
598+ this . mapRef = ref ;
602599 } }
603600 containerElement = { < div
604601 className = "rbc-container"
@@ -607,7 +604,7 @@ export default class ReactiveMap extends Component {
607604 mapElement = { < div style = { { height : "100%" } } /> }
608605 { ...centerComponent }
609606 { ...ReactiveMapHelper . normalizeProps ( this . props ) }
610- options = { {
607+ options = { {
611608 styles : this . state . currentMapStyle
612609 } }
613610 defaultCenter = { ReactiveMapHelper . normalizeCenter ( this . state . defaultCenter ) }
0 commit comments