Skip to content

Commit e603c82

Browse files
committed
Add t_sim
1 parent a9c52fd commit e603c82

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#### Added
66
- add menu time_lapse for changing the simulation/ replay speed
77
- add field `mod_text` to Viewer3D; it defines the quotient of the update rate and the text update rate
8+
- add textbox `t_sim` to enter the simulation time
89

910
### KiteViewers v0.4.10 - 2024-03-30
1011

mwes/mwe_05.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ segments=se().segments
55
state=demo_state_4p(segments+1)
66
update_system(viewer, state, kite_scale=0.25)
77
sleep(5)
8-
close(viewer.screen)
8+
#close(viewer.screen)

src/viewer3D.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ mutable struct Viewer3D <: AKV
8585
menu::Union{Menu, Nothing}
8686
menu_rel_tol::Union{Menu, Nothing}
8787
menu_time_lapse::Union{Menu, Nothing}
88+
t_sim::Union{Textbox, Nothing}
8889
btn_OK::Union{Button, Nothing}
8990
sw::Toggle
9091
step::Int64
@@ -158,6 +159,17 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi
158159
label3.halign[]=:left
159160
label3.valign[]=:top
160161
label3.alignmode=Outside(160, 0, 0, 100)
162+
tb = Textbox(fig, bbox = fig.scene.viewport, placeholder = "Simulation time",
163+
validator = UInt16, stored_string="460")
164+
tb.width[] =120
165+
tb.halign[]=:left
166+
tb.valign[]=:top
167+
tb.alignmode[]=Outside(30, 0, 0, 130)
168+
# tb.stored_string[]="460"
169+
label3 = Label(fig, "t_sim [s]", bbox=fig.scene.viewport)
170+
label3.halign[]=:left
171+
label3.valign[]=:top
172+
label3.alignmode=Outside(160, 0, 0, 137)
161173
btn_OK = Button(fig, bbox=fig.scene.viewport, label = "OK")
162174
btn_OK.halign[]=:left
163175
btn_OK.valign[]=:top
@@ -166,6 +178,7 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi
166178
menu1=nothing
167179
menu2=nothing
168180
menu3=nothing
181+
tb = nothing
169182
btn_OK=nothing
170183
end
171184

@@ -229,7 +242,7 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi
229242
mod_text = 4
230243
s = Viewer3D(fig, scene3D, cam, gl_screen, points, pos, part_pos, markersizes,
231244
rotations, set, btn_RESET, btn_ZOOM_in, btn_ZOOM_out,
232-
btn_PLAY_PAUSE, btn_AUTO, btn_PARKING, btn_STOP, menu1, menu2, menu3, btn_OK,
245+
btn_PLAY_PAUSE, btn_AUTO, btn_PARKING, btn_STOP, menu1, menu2, menu3, tb, btn_OK,
233246
sw, 0, mod_text, 0, show_kite, false)
234247
txt2 = init_system(s, s.scene3D; show_kite=show_kite)
235248

0 commit comments

Comments
 (0)