This commit is contained in:
Joeri Exelmans 2025-10-19 23:57:45 +02:00
parent 8144a3ec78
commit 44fb8726ca
4 changed files with 117 additions and 122 deletions

View file

@ -26,6 +26,7 @@ details {
padding-left: 2px; padding-left: 2px;
padding-right: 2px; padding-right: 2px;
background-color: rgb(230, 249, 255); background-color: rgb(230, 249, 255);
display: inline-block;
} }
.activeState { .activeState {
@ -36,6 +37,7 @@ details {
margin-left: 4px; margin-left: 4px;
padding-left: 2px; padding-left: 2px;
padding-right: 2px; padding-right: 2px;
display: inline-block;
} }
hr { hr {

View file

@ -86,5 +86,3 @@ button.active {
max-height: 100vh; max-height: 100vh;
overflow: auto; overflow: auto;
} }

View file

@ -192,8 +192,9 @@ export function App() {
borderLeft: 1, borderLeft: 1,
borderColor: "divider", borderColor: "divider",
flex: '0 0 content', flex: '0 0 content',
overflow: "auto", overflowY: "auto",
maxWidth: '30vw', overflowX: "visible",
maxWidth: 'min(300px, 30vw)',
}}> }}>
<ShowAST {...{...ast, rt: rt.at(rtIdx!), highlightActive}}/> <ShowAST {...{...ast, rt: rt.at(rtIdx!), highlightActive}}/>
<ShowOutputEvents outputEvents={ast.outputEvents}/> <ShowOutputEvents outputEvents={ast.outputEvents}/>

View file

@ -199,17 +199,17 @@ export function TopPanel({rt, rtIdx, time, setTime, onInit, onClear, onRaise, on
onTimeScaleChange((timescale*2).toString(), Math.round(performance.now())); onTimeScaleChange((timescale*2).toString(), Math.round(performance.now()));
} }
return <> return <div className="toolbar">
<div className="toolbar">
{/* shortcuts / about */} {/* shortcuts / about */}
<div className="toolbarGroup"> <div className="toolbarGroup">
<KeyInfo keyInfo={<kbd>~</kbd>}> <KeyInfo keyInfo={<kbd>~</kbd>}>
<button title="show/hide keyboard shortcuts" className={showKeys?"active":""} onClick={() => setShowKeys(s => !s)}><KeyboardIcon fontSize="small"/></button> <button title="show/hide keyboard shortcuts" className={showKeys?"active":""} onClick={() => setShowKeys(s => !s)}><KeyboardIcon fontSize="small"/></button>
</KeyInfo> </KeyInfo>
<button title="about StateBuddy" onClick={() => setModal(<About setModal={setModal}/>)}><InfoOutlineIcon fontSize="small"/></button> <button title="about StateBuddy" onClick={() => setModal(<About setModal={setModal}/>)}><InfoOutlineIcon fontSize="small"/></button>
&emsp;
</div> </div>
&emsp;
{/* undo / redo */} {/* undo / redo */}
<div className="toolbarGroup"> <div className="toolbarGroup">
@ -219,9 +219,8 @@ export function TopPanel({rt, rtIdx, time, setTime, onInit, onClear, onRaise, on
<KeyInfo keyInfo={<><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd></>}> <KeyInfo keyInfo={<><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd></>}>
<button title="redo"><RedoIcon fontSize="small"/></button> <button title="redo"><RedoIcon fontSize="small"/></button>
</KeyInfo> </KeyInfo>
</div>
&emsp; &emsp;
</div>
{/* insert rountangle / arrow / ... */} {/* insert rountangle / arrow / ... */}
<div className="toolbarGroup"> <div className="toolbarGroup">
@ -241,9 +240,8 @@ export function TopPanel({rt, rtIdx, time, setTime, onInit, onClear, onRaise, on
className={mode===m ? "active":""} className={mode===m ? "active":""}
onClick={() => setMode(m)} onClick={() => setMode(m)}
>{buttonTxt}</button></KeyInfo>)} >{buttonTxt}</button></KeyInfo>)}
</div>
&emsp; &emsp;
</div>
{/* execution */} {/* execution */}
<div className="toolbarGroup"> <div className="toolbarGroup">
@ -261,9 +259,8 @@ export function TopPanel({rt, rtIdx, time, setTime, onInit, onClear, onRaise, on
<button title="pause the simulation" disabled={!rt || time.kind==="paused"} className={(rt && time.kind==="paused") ? "active":""} onClick={() => onChangePaused(true, Math.round(performance.now()))}><PauseIcon fontSize="small"/></button> <button title="pause the simulation" disabled={!rt || time.kind==="paused"} className={(rt && time.kind==="paused") ? "active":""} onClick={() => onChangePaused(true, Math.round(performance.now()))}><PauseIcon fontSize="small"/></button>
<button title="run the simulation in real time" disabled={!rt || time.kind==="realtime"} className={(rt && time.kind==="realtime") ? "active":""} onClick={() => onChangePaused(false, Math.round(performance.now()))}><PlayArrowIcon fontSize="small"/></button> <button title="run the simulation in real time" disabled={!rt || time.kind==="realtime"} className={(rt && time.kind==="realtime") ? "active":""} onClick={() => onChangePaused(false, Math.round(performance.now()))}><PlayArrowIcon fontSize="small"/></button>
</KeyInfo> </KeyInfo>
</div>
&emsp; &emsp;
</div>
{/* speed */} {/* speed */}
<div className="toolbarGroup"> <div className="toolbarGroup">
@ -275,35 +272,33 @@ export function TopPanel({rt, rtIdx, time, setTime, onInit, onClear, onRaise, on
<KeyInfo keyInfo={<kbd>F</kbd>}> <KeyInfo keyInfo={<kbd>F</kbd>}>
<button title="faster" onClick={onFaster}>×2</button> <button title="faster" onClick={onFaster}>×2</button>
</KeyInfo> </KeyInfo>
</div>
&emsp; &emsp;
</div>
{/* time, next */} {/* time, next */}
<div className="toolbarGroup"> <div className="toolbarGroup">
<div className="toolbarGroup"> <div className="toolbarGroup">
<label htmlFor="time">time (s)</label>&nbsp; <label htmlFor="time">time (s)</label>&nbsp;
<input title="the current simulated time" id="time" disabled={!rt} value={displayTime} readOnly={true} className="readonlyTextBox" /> <input title="the current simulated time" id="time" disabled={!rt} value={displayTime} readOnly={true} className="readonlyTextBox" />
&emsp;
</div> </div>
&emsp;
<div className="toolbarGroup"> <div className="toolbarGroup">
<label htmlFor="next-timeout">next (s)</label>&nbsp; <label htmlFor="next-timeout">next (s)</label>&nbsp;
<input title="next point in simulated time where a timed transition may fire" id="next-timeout" disabled={!rt} value={nextTimedTransition ? formatTime(nextTimedTransition[0]) : '+inf'} readOnly={true} className="readonlyTextBox"/> <input title="next point in simulated time where a timed transition may fire" id="next-timeout" disabled={!rt} value={nextTimedTransition ? formatTime(nextTimedTransition[0]) : '+inf'} readOnly={true} className="readonlyTextBox"/>
<KeyInfo keyInfo={<kbd>Tab</kbd>}> <KeyInfo keyInfo={<kbd>Tab</kbd>}>
<button title="advance time just enough for the next timer to elapse" disabled={nextTimedTransition===undefined} onClick={onSkip}><SkipNextIcon fontSize="small"/><AccessAlarmIcon fontSize="small"/></button> <button title="advance time just enough for the next timer to elapse" disabled={nextTimedTransition===undefined} onClick={onSkip}><SkipNextIcon fontSize="small"/><AccessAlarmIcon fontSize="small"/></button>
</KeyInfo> </KeyInfo>
&emsp;
</div>
</div> </div>
</div> </div>
{/* input events */}
</div>
<div className="toolbarGroup"> <div className="toolbarGroup">
{ast.inputEvents && {ast.inputEvents &&
<> <>
{ast.inputEvents.map(({event, paramName}) => {ast.inputEvents.map(({event, paramName}) =>
<><button title={`raise input event '${event}'`} disabled={!rt} onClick={() => { <div className="toolbarGroup"><button title={`raise input event '${event}'`} disabled={!rt} onClick={() => {
// @ts-ignore // @ts-ignore
const param = document.getElementById(`input-${event}-param`)?.value; const param = document.getElementById(`input-${event}-param`)?.value;
let paramParsed; let paramParsed;
@ -322,11 +317,10 @@ export function TopPanel({rt, rtIdx, time, setTime, onInit, onClear, onRaise, on
{event} {event}
</button> </button>
{paramName && <><input id={`input-${event}-param`} style={{width: 20}} placeholder={paramName}/></>} {paramName && <><input id={`input-${event}-param`} style={{width: 20}} placeholder={paramName}/></>}
&nbsp;</>)} &nbsp;</div>)}
</> </>
} }
</div>
</div> </div>;
</div>
</>;
} }