remove stop button, and replace with start/pause combined into one button

feat/diff_Jaguar
Nikola Sebastian Munder 2025-06-09 12:49:50 +02:00
parent 1e9885bd4b
commit 951f9281a5
1 changed files with 12 additions and 18 deletions

View File

@ -88,12 +88,11 @@ hm = Makie.heatmap!(ax, heat_obs, colormap=:viridis)
ax.aspect = DataAspect()
# # Controls
run_label = Observable("Run")
fig[2, 1] = buttongrid = GridLayout(tellwidth=false)
btn_step = Button(buttongrid[1, 1], label="Step")
btn_start = Button(buttongrid[1, 2], label="Start")
btn_stop = Button(buttongrid[1, 3], label="Stop")
btn_reset = Button(buttongrid[1, 4], label="Reset")
btn_start = Button(buttongrid[1, 2], width=50, label=run_label)
btn_reset = Button(buttongrid[1, 3], label="Reset")
gh[1, 2] = textboxgrid = GridLayout(tellwidth=false)
rowsize!(gh, 1, Relative(1.0))
@ -134,29 +133,24 @@ function animation_loop()
sleep(0.05) # ~20 FPS
end
end
on(box_u.stored_string) do s
try
Du[] = parse(Float64, s)
println("Change Du ", Du[])
catch
@warn "Invalid input for Du: $s"
on(running) do r
run_label[] = r ? "Pause" : "Run"
end
end
on(btn_step.clicks) do _
multi_step!((U, V), 30)
end
on(btn_start.clicks) do _
if !running[]
running[] = true
@async animation_loop()
running[] = !running[]
end
on(btn_start.clicks) do _
@async while running[]
animation_loop()
end
end
on(btn_stop.clicks) do _
running[] = false
end
on(btn_reset.clicks) do _
running[] = false