fmt
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/App.tsx
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/App.tsx
									
									
									
									
									
								
							| @ -21,7 +21,6 @@ import { BasePlanes } from './components/BasePlanes' | ||||
| import { SketchPlane } from './components/SketchPlane' | ||||
| import { Logs } from './components/Logs' | ||||
|  | ||||
|  | ||||
| const OrrthographicCamera = OrthographicCamera as any | ||||
|  | ||||
| function App() { | ||||
| @ -121,7 +120,7 @@ function App() { | ||||
|     } | ||||
|   }, [code]) | ||||
|   const shouldFormat = useMemo(() => { | ||||
|     if(!ast) return false | ||||
|     if (!ast) return false | ||||
|     const recastedCode = recast(ast) | ||||
|     return recastedCode !== code | ||||
|   }, [code, ast]) | ||||
| @ -130,7 +129,13 @@ function App() { | ||||
|       <Allotment> | ||||
|         <Logs /> | ||||
|         <div className="h-full flex flex-col items-start"> | ||||
|           <button disabled={!shouldFormat} onClick={formatCode} className={`${!shouldFormat && "text-gray-300"}`}>format</button> | ||||
|           <button | ||||
|             disabled={!shouldFormat} | ||||
|             onClick={formatCode} | ||||
|             className={`${!shouldFormat && 'text-gray-300'}`} | ||||
|           > | ||||
|             format | ||||
|           </button> | ||||
|           <div className="bg-red h-full w-full overflow-auto"> | ||||
|             <CodeMirror | ||||
|               className="h-full" | ||||
| @ -180,7 +185,13 @@ function App() { | ||||
|             </div> | ||||
|             {guiMode.mode === 'codeError' && ( | ||||
|               <div className="absolute inset-0 bg-gray-700/20"> | ||||
|                 <pre>{'last first: \n\n' + JSON.stringify(lastGuiMode, null, 2) + '\n\n' + JSON.stringify(guiMode)}</pre></div> | ||||
|                 <pre> | ||||
|                   {'last first: \n\n' + | ||||
|                     JSON.stringify(lastGuiMode, null, 2) + | ||||
|                     '\n\n' + | ||||
|                     JSON.stringify(guiMode)} | ||||
|                 </pre> | ||||
|               </div> | ||||
|             )} | ||||
|           </div> | ||||
|         </div> | ||||
|  | ||||
| @ -20,9 +20,7 @@ export const Toolbar = () => { | ||||
|         </button> | ||||
|       )} | ||||
|       {guiMode.mode === 'sketch' && guiMode.sketchMode === 'points' && ( | ||||
|         <button> | ||||
|           LineTo TODO | ||||
|         </button> | ||||
|         <button>LineTo TODO</button> | ||||
|       )} | ||||
|       {guiMode.mode !== 'default' && ( | ||||
|         <button onClick={() => setGuiMode({ mode: 'default' })}>exit</button> | ||||
|  | ||||
| @ -56,9 +56,9 @@ export const BasePlanes = () => { | ||||
|       mode: 'sketch', | ||||
|       sketchMode: 'points', | ||||
|       axis: axisIndex === 0 ? 'yz' : axisIndex === 1 ? 'xy' : 'xz', | ||||
|       id | ||||
|       id, | ||||
|     }) | ||||
|      | ||||
|  | ||||
|     updateAst(modifiedAst) | ||||
|   } | ||||
|   if (guiMode.mode !== 'sketch') { | ||||
|  | ||||
| @ -912,7 +912,10 @@ export function addLine( | ||||
| ): { modifiedAst: Program; id: string } { | ||||
|   const _node = { ...node } | ||||
|   const dumbyStartend = { start: 0, end: 0 } | ||||
|   const { index, sketchDeclaration, sketchExpression } = getSketchStatement(_node, id) | ||||
|   const { index, sketchDeclaration, sketchExpression } = getSketchStatement( | ||||
|     _node, | ||||
|     id | ||||
|   ) | ||||
|   const line: ExpressionStatement = { | ||||
|     type: 'ExpressionStatement', | ||||
|     ...dumbyStartend, | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { BoxGeometry, SphereGeometry, BufferGeometry } from 'three' | ||||
| import { mergeBufferGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils' | ||||
|  | ||||
| export function baseGeo({from}: {from: [number, number, number]}) { | ||||
| export function baseGeo({ from }: { from: [number, number, number] }) { | ||||
|   const baseSphere = new SphereGeometry(0.25) | ||||
|   baseSphere.translate(from[0], from[1], from[2]) | ||||
|   return baseSphere | ||||
|  | ||||
| @ -43,7 +43,13 @@ export const executor = ( | ||||
|             bodyType: 'sketch', | ||||
|           }) | ||||
|           if (_sketch.length === 0) { | ||||
|             const {programMemory: newProgramMemory} = sketchFns.base(fnMemory, '', [0, 0], 0, 0) | ||||
|             const { programMemory: newProgramMemory } = sketchFns.base( | ||||
|               fnMemory, | ||||
|               '', | ||||
|               [0, 0], | ||||
|               0, | ||||
|               0 | ||||
|             ) | ||||
|             _sketch = newProgramMemory._sketch | ||||
|           } | ||||
|           _programMemory.root[variableName] = _sketch | ||||
|  | ||||
		Reference in New Issue
	
	Block a user