|
@@ -2,13 +2,19 @@ import React, {Profiler} from "react";
|
|
|
import Mapbox from "./../maps/Mapbox";
|
|
|
import {measureTime} from './../helpers/measureTime';
|
|
|
import {CustomInput, Input} from "reactstrap";
|
|
|
+import {mapTestState} from "./../config/variables"
|
|
|
import {
|
|
|
createRandomMarkers,
|
|
|
calcMarkerPosition,
|
|
|
changeSwitch,
|
|
|
setNoOfMarkers
|
|
|
} from "./../helpers/randomMarkers";
|
|
|
-import {mapTestState} from "./../config/variables"
|
|
|
+import {
|
|
|
+ didMountSwitchLatLng,
|
|
|
+ componentDidUpdate,
|
|
|
+ componentWillUnmount
|
|
|
+} from "./../helpers/testLifecycle"
|
|
|
+
|
|
|
|
|
|
export default class MapGLs extends React.Component{
|
|
|
constructor(props) {
|
|
@@ -22,32 +28,13 @@ export default class MapGLs extends React.Component{
|
|
|
this.calcMarkerPosition = calcMarkerPosition.bind(this)
|
|
|
this.changeSwitch = changeSwitch.bind(this)
|
|
|
this.setNoOfMarkers = setNoOfMarkers.bind(this)
|
|
|
- }
|
|
|
|
|
|
- componentDidMount() {
|
|
|
- this.createRandomMarkers(true);
|
|
|
- this.setState({startTime: performance.now()});
|
|
|
- if(this.state.moveMarkers){
|
|
|
- this.timer = setInterval(() => {
|
|
|
- this.setState({currStep: this.state.currStep + 1});
|
|
|
- this.calcMarkerPosition()
|
|
|
- }, this.state.interval);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- componentDidUpdate() {
|
|
|
- if(this.state.currStep===this.state.noOfSteps){
|
|
|
- let endTime = performance.now();
|
|
|
- let duration = endTime - this.state.startTime
|
|
|
- let msg = "Duration " + duration.toFixed(3) + " for " + this.state.noOfSteps + " steps"
|
|
|
- console.log(msg)
|
|
|
- this.markerInfoDiv.current.innerHTML = msg
|
|
|
- this.setState({currStep: this.state.currStep + 1});
|
|
|
- }
|
|
|
+ this.componentDidUpdate = componentDidUpdate.bind(this)
|
|
|
+ this.componentWillUnmount = componentWillUnmount.bind(this)
|
|
|
}
|
|
|
|
|
|
- componentWillUnmount() {
|
|
|
- clearInterval(this.timer);
|
|
|
+ componentDidMount() {
|
|
|
+ didMountSwitchLatLng(this, true)
|
|
|
}
|
|
|
|
|
|
render(){
|