-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Add State Indicators to Quick Action Buttons - Add Option to Specify Scene with a Query Parameter - Add Debugging Options - Add Options to See and Modify Current Scene and Benchmarking Configurations (more details are available in attached issues)
- Loading branch information
1 parent
e923180
commit 1d5cd59
Showing
19 changed files
with
376 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React, { useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import CodeEditorSection from '../Editors/CodeEditor/CodeEditorSection'; | ||
|
||
const getCircularReplacer = () => { | ||
const seen = new WeakSet(); | ||
return (key, value) => { | ||
if (typeof value === 'object' && value !== null) { | ||
if (seen.has(value)) { | ||
return; | ||
} | ||
seen.add(value); | ||
} | ||
|
||
return value; | ||
}; | ||
}; | ||
|
||
const stripScene = (scene) => ({ | ||
...scene, | ||
engine: undefined, | ||
world: undefined, | ||
staticObjects: undefined, | ||
robots: scene?.robots?.map((robot) => ({ | ||
...robot, | ||
scene: undefined, | ||
engine: undefined, | ||
world: undefined, | ||
sensorManager: undefined, | ||
actuatorManager: undefined | ||
})), | ||
pucks: scene?.pucks?.map((puck) => ({ | ||
...puck, | ||
scene: undefined, | ||
engine: undefined, | ||
world: undefined, | ||
sensorManager: undefined, | ||
actuatorManager: undefined | ||
})) | ||
}); | ||
|
||
function DebugPanel({ | ||
title, | ||
getSceneState | ||
}) { | ||
const [debugInfo, setDebugInfo] = useState(''); | ||
|
||
return ( | ||
<CodeEditorSection | ||
key='DebugPanel' | ||
title={title} | ||
setCode={(d) => setDebugInfo(d)} | ||
code={debugInfo} | ||
defaultCode='' | ||
foldAll | ||
getDefaultCode={() => JSON.stringify(stripScene(getSceneState()), getCircularReplacer(), 2)} | ||
/> | ||
); | ||
} | ||
|
||
DebugPanel.propTypes = { | ||
title: PropTypes.string, | ||
getSceneState: PropTypes.func | ||
}; | ||
|
||
export default DebugPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.