2021-03-26 17:25:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
2021-03-27 03:18:11 +08:00
|
|
|
import './app.scss'
|
2021-03-26 17:25:28 +08:00
|
|
|
|
2021-03-28 20:00:31 +08:00
|
|
|
import { Provider, useDispatch, useSelector } from 'react-redux'
|
2021-03-29 05:34:55 +08:00
|
|
|
// import { renderInst } from './index'
|
2021-03-28 20:00:31 +08:00
|
|
|
|
2021-03-27 03:18:11 +08:00
|
|
|
export const Root = ({ store }) => (
|
2021-03-26 17:25:28 +08:00
|
|
|
<Provider store={store}>
|
2021-03-27 03:18:11 +08:00
|
|
|
<App></App>
|
2021-03-26 17:25:28 +08:00
|
|
|
</Provider>
|
|
|
|
);
|
2021-03-27 03:18:11 +08:00
|
|
|
|
|
|
|
const App = () => {
|
2021-03-28 20:00:31 +08:00
|
|
|
const dispatch = useDispatch()
|
2021-03-29 18:27:34 +08:00
|
|
|
const treeEntries = useSelector(state => state.treeEntries)
|
2021-03-27 03:18:11 +08:00
|
|
|
|
|
|
|
return <>
|
2021-03-29 02:54:05 +08:00
|
|
|
|
|
|
|
<div className='buttons-group'>
|
|
|
|
<button onClick={() => dispatch({ type: 'toggle', payload: true })}> true</button>
|
|
|
|
<button onClick={() => dispatch({ type: 'toggle', payload: false })}> false </button>
|
|
|
|
<button onClick={renderInst.addSketch}> addsketch </button>
|
2021-03-29 18:27:34 +08:00
|
|
|
<button onClick={()=>renderInst.extrude(4)}> extrude </button>
|
2021-03-29 02:54:05 +08:00
|
|
|
</div>
|
2021-03-28 20:00:31 +08:00
|
|
|
|
|
|
|
<div className='feature-tree'>
|
2021-03-29 18:27:34 +08:00
|
|
|
{treeEntries.allIds.map((entId, idx) => (
|
|
|
|
<div key={idx}
|
|
|
|
onClick={()=>{
|
|
|
|
renderInst.extrude(treeEntries.byId[entId])
|
|
|
|
}}
|
|
|
|
>{entId}</div>
|
2021-03-28 20:00:31 +08:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
|
2021-03-27 03:18:11 +08:00
|
|
|
</>
|
2021-03-28 20:00:31 +08:00
|
|
|
}
|
|
|
|
|