mirror of
https://github.com/a-b-street/abstreet.git
synced 2025-01-01 19:04:50 +03:00
add screen positioning to some Composites
This commit is contained in:
parent
d9a68332e5
commit
56285a7b30
@ -1,4 +1,4 @@
|
|||||||
use crate::{Color, ScreenPt, ScreenRectangle, Text, UserInput};
|
use crate::{Color, ScreenDims, ScreenPt, ScreenRectangle, Text, UserInput};
|
||||||
use abstutil::Timer;
|
use abstutil::Timer;
|
||||||
use geom::{Bounds, Distance, Polygon, Pt2D};
|
use geom::{Bounds, Distance, Polygon, Pt2D};
|
||||||
use glium::texture::Texture2dArray;
|
use glium::texture::Texture2dArray;
|
||||||
@ -225,8 +225,31 @@ impl Canvas {
|
|||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn align_window(
|
||||||
|
&self,
|
||||||
|
dims: ScreenDims,
|
||||||
|
horiz: HorizontalAlignment,
|
||||||
|
vert: VerticalAlignment,
|
||||||
|
) -> ScreenPt {
|
||||||
|
let x1 = match horiz {
|
||||||
|
HorizontalAlignment::Left => 0.0,
|
||||||
|
HorizontalAlignment::Center => (self.window_width - dims.width) / 2.0,
|
||||||
|
HorizontalAlignment::Right => self.window_width - dims.width,
|
||||||
|
HorizontalAlignment::FillScreen => 0.0,
|
||||||
|
};
|
||||||
|
let y1 = match vert {
|
||||||
|
VerticalAlignment::Top => 0.0,
|
||||||
|
VerticalAlignment::Center => (self.window_height - dims.height) / 2.0,
|
||||||
|
VerticalAlignment::Bottom => self.window_height - dims.height,
|
||||||
|
// TODO Hack
|
||||||
|
VerticalAlignment::BottomAboveOSD => self.window_height - dims.height - 40.0,
|
||||||
|
};
|
||||||
|
ScreenPt::new(x1, y1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
pub enum HorizontalAlignment {
|
pub enum HorizontalAlignment {
|
||||||
Left,
|
Left,
|
||||||
Center,
|
Center,
|
||||||
@ -234,10 +257,12 @@ pub enum HorizontalAlignment {
|
|||||||
FillScreen,
|
FillScreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
pub enum VerticalAlignment {
|
pub enum VerticalAlignment {
|
||||||
Top,
|
Top,
|
||||||
Center,
|
Center,
|
||||||
Bottom,
|
Bottom,
|
||||||
|
BottomAboveOSD,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
@ -235,26 +235,12 @@ impl<'a> GfxCtx<'a> {
|
|||||||
(horiz, vert): (HorizontalAlignment, VerticalAlignment),
|
(horiz, vert): (HorizontalAlignment, VerticalAlignment),
|
||||||
) {
|
) {
|
||||||
let mut dims = self.text_dims(&txt);
|
let mut dims = self.text_dims(&txt);
|
||||||
let x1 = match horiz {
|
let top_left = self.canvas.align_window(dims, horiz, vert);
|
||||||
HorizontalAlignment::Left => 0.0,
|
if let HorizontalAlignment::FillScreen = horiz {
|
||||||
HorizontalAlignment::Center => (self.canvas.window_width - dims.width) / 2.0,
|
dims.width = self.canvas.window_width;
|
||||||
HorizontalAlignment::Right => self.canvas.window_width - dims.width,
|
}
|
||||||
HorizontalAlignment::FillScreen => {
|
self.canvas
|
||||||
dims.width = self.canvas.window_width;
|
.mark_covered_area(text::draw_text_bubble(self, top_left, txt, dims));
|
||||||
0.0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let y1 = match vert {
|
|
||||||
VerticalAlignment::Top => 0.0,
|
|
||||||
VerticalAlignment::Center => (self.canvas.window_height - dims.height) / 2.0,
|
|
||||||
VerticalAlignment::Bottom => self.canvas.window_height - dims.height,
|
|
||||||
};
|
|
||||||
self.canvas.mark_covered_area(text::draw_text_bubble(
|
|
||||||
self,
|
|
||||||
ScreenPt::new(x1, y1),
|
|
||||||
txt,
|
|
||||||
dims,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_screen_bounds(&self) -> Bounds {
|
pub fn get_screen_bounds(&self) -> Bounds {
|
||||||
|
@ -5,7 +5,10 @@ use crate::managed::{Composite, ManagedWidget};
|
|||||||
use crate::options;
|
use crate::options;
|
||||||
use crate::sandbox::GameplayMode;
|
use crate::sandbox::GameplayMode;
|
||||||
use crate::ui::UI;
|
use crate::ui::UI;
|
||||||
use ezgui::{hotkey, lctrl, Button, Color, EventCtx, Key, Line, RewriteColor, ScreenPt, Text};
|
use ezgui::{
|
||||||
|
hotkey, lctrl, Button, Color, EventCtx, HorizontalAlignment, Key, Line, RewriteColor, Text,
|
||||||
|
VerticalAlignment,
|
||||||
|
};
|
||||||
|
|
||||||
// TODO Rethink this API.
|
// TODO Rethink this API.
|
||||||
pub fn tool_panel(ctx: &EventCtx, extra_buttons: Vec<ManagedWidget>) -> Composite {
|
pub fn tool_panel(ctx: &EventCtx, extra_buttons: Vec<ManagedWidget>) -> Composite {
|
||||||
@ -46,14 +49,15 @@ pub fn tool_panel(ctx: &EventCtx, extra_buttons: Vec<ManagedWidget>) -> Composit
|
|||||||
];
|
];
|
||||||
row.extend(extra_buttons);
|
row.extend(extra_buttons);
|
||||||
|
|
||||||
Composite::minimal_size(
|
Composite::aligned(
|
||||||
|
(HorizontalAlignment::Left, VerticalAlignment::BottomAboveOSD),
|
||||||
ManagedWidget::row(row.into_iter().map(|x| x.margin(10)).collect()).bg(Color::grey(0.4)),
|
ManagedWidget::row(row.into_iter().map(|x| x.margin(10)).collect()).bg(Color::grey(0.4)),
|
||||||
ScreenPt::new(30.0, ctx.canvas.window_height - 80.0),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn edit_map_panel(ctx: &EventCtx, ui: &UI, gameplay: GameplayMode) -> Composite {
|
pub fn edit_map_panel(ctx: &EventCtx, ui: &UI, gameplay: GameplayMode) -> Composite {
|
||||||
Composite::minimal_size(
|
Composite::aligned(
|
||||||
|
(HorizontalAlignment::Center, VerticalAlignment::Top),
|
||||||
ManagedWidget::row(vec![
|
ManagedWidget::row(vec![
|
||||||
ManagedWidget::col(vec![
|
ManagedWidget::col(vec![
|
||||||
ManagedWidget::draw_text(ctx, Text::from(Line("Sandbox"))),
|
ManagedWidget::draw_text(ctx, Text::from(Line("Sandbox"))),
|
||||||
@ -84,6 +88,5 @@ pub fn edit_map_panel(ctx: &EventCtx, ui: &UI, gameplay: GameplayMode) -> Compos
|
|||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
.bg(Color::grey(0.4)),
|
.bg(Color::grey(0.4)),
|
||||||
ScreenPt::new(ctx.canvas.window_width / 2.0, 5.0),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,9 @@ use crate::game::{State, Transition};
|
|||||||
use crate::ui::UI;
|
use crate::ui::UI;
|
||||||
use ezgui::layout::Widget;
|
use ezgui::layout::Widget;
|
||||||
use ezgui::{
|
use ezgui::{
|
||||||
Button, Color, DrawBoth, Drawable, EventCtx, GeomBatch, GfxCtx, JustDraw, Line, MultiKey,
|
Button, Color, DrawBoth, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, JustDraw,
|
||||||
RewriteColor, ScreenDims, ScreenPt, ScreenRectangle, Slider, Text,
|
Line, MultiKey, RewriteColor, ScreenDims, ScreenPt, ScreenRectangle, Slider, Text,
|
||||||
|
VerticalAlignment,
|
||||||
};
|
};
|
||||||
use geom::{Distance, Polygon};
|
use geom::{Distance, Polygon};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -433,6 +434,7 @@ pub enum Outcome {
|
|||||||
enum CompositePosition {
|
enum CompositePosition {
|
||||||
FillScreen,
|
FillScreen,
|
||||||
MinimalTopLeft(ScreenPt),
|
MinimalTopLeft(ScreenPt),
|
||||||
|
Aligned(HorizontalAlignment, VerticalAlignment),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Composite {
|
impl Composite {
|
||||||
@ -450,6 +452,16 @@ impl Composite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn aligned(
|
||||||
|
(horiz, vert): (HorizontalAlignment, VerticalAlignment),
|
||||||
|
top_level: ManagedWidget,
|
||||||
|
) -> Composite {
|
||||||
|
Composite {
|
||||||
|
top_level,
|
||||||
|
pos: CompositePosition::Aligned(horiz, vert),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn recompute_layout(&mut self, ctx: &EventCtx, sliders: &mut HashMap<String, &mut Slider>) {
|
pub fn recompute_layout(&mut self, ctx: &EventCtx, sliders: &mut HashMap<String, &mut Slider>) {
|
||||||
// TODO If this ever gets slow, only run if window size has changed.
|
// TODO If this ever gets slow, only run if window size has changed.
|
||||||
let mut stretch = Stretch::new();
|
let mut stretch = Stretch::new();
|
||||||
@ -463,10 +475,12 @@ impl Composite {
|
|||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
CompositePosition::MinimalTopLeft(_) => Style {
|
CompositePosition::MinimalTopLeft(_) | CompositePosition::Aligned(_, _) => {
|
||||||
// TODO There a way to encode the offset in stretch?
|
Style {
|
||||||
..Default::default()
|
// TODO There a way to encode the offset in stretch?
|
||||||
},
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
)
|
)
|
||||||
@ -481,6 +495,14 @@ impl Composite {
|
|||||||
let top_left = match self.pos {
|
let top_left = match self.pos {
|
||||||
CompositePosition::FillScreen => ScreenPt::new(0.0, 0.0),
|
CompositePosition::FillScreen => ScreenPt::new(0.0, 0.0),
|
||||||
CompositePosition::MinimalTopLeft(pt) => pt,
|
CompositePosition::MinimalTopLeft(pt) => pt,
|
||||||
|
CompositePosition::Aligned(horiz, vert) => {
|
||||||
|
let result = stretch.layout(root).unwrap();
|
||||||
|
ctx.canvas.align_window(
|
||||||
|
ScreenDims::new(result.size.width.into(), result.size.height.into()),
|
||||||
|
horiz,
|
||||||
|
vert,
|
||||||
|
)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
self.top_level
|
self.top_level
|
||||||
.apply_flexbox(sliders, &stretch, &mut nodes, top_left.x, top_left.y, ctx);
|
.apply_flexbox(sliders, &stretch, &mut nodes, top_left.x, top_left.y, ctx);
|
||||||
|
@ -5,7 +5,10 @@ use crate::managed::{Composite, ManagedWidget};
|
|||||||
use crate::sandbox::gameplay::{change_scenario, load_map, spawner, GameplayMode, GameplayState};
|
use crate::sandbox::gameplay::{change_scenario, load_map, spawner, GameplayMode, GameplayState};
|
||||||
use crate::sandbox::overlays::Overlays;
|
use crate::sandbox::overlays::Overlays;
|
||||||
use crate::ui::UI;
|
use crate::ui::UI;
|
||||||
use ezgui::{hotkey, lctrl, Color, EventCtx, GfxCtx, Key, Line, ModalMenu, ScreenPt, Text};
|
use ezgui::{
|
||||||
|
hotkey, lctrl, Color, EventCtx, GfxCtx, HorizontalAlignment, Key, Line, ModalMenu, Text,
|
||||||
|
VerticalAlignment,
|
||||||
|
};
|
||||||
use map_model::IntersectionID;
|
use map_model::IntersectionID;
|
||||||
use sim::Analytics;
|
use sim::Analytics;
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
@ -75,7 +78,8 @@ pub fn freeform_controller(
|
|||||||
gameplay: GameplayMode,
|
gameplay: GameplayMode,
|
||||||
scenario_name: &str,
|
scenario_name: &str,
|
||||||
) -> Composite {
|
) -> Composite {
|
||||||
Composite::minimal_size(
|
Composite::aligned(
|
||||||
|
(HorizontalAlignment::Center, VerticalAlignment::Top),
|
||||||
ManagedWidget::row(vec![
|
ManagedWidget::row(vec![
|
||||||
ManagedWidget::col(vec![
|
ManagedWidget::col(vec![
|
||||||
ManagedWidget::text_button(
|
ManagedWidget::text_button(
|
||||||
@ -125,6 +129,5 @@ pub fn freeform_controller(
|
|||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
.bg(Color::grey(0.4)),
|
.bg(Color::grey(0.4)),
|
||||||
ScreenPt::new(ctx.canvas.window_width / 2.0 - 300.0, 5.0),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -232,13 +232,18 @@ fn change_scenario(wiz: &mut Wizard, ctx: &mut EventCtx, ui: &mut UI) -> Option<
|
|||||||
abstutil::list_all_objects(abstutil::path_all_scenarios(ui.primary.map.get_name()));
|
abstutil::list_all_objects(abstutil::path_all_scenarios(ui.primary.map.get_name()));
|
||||||
list.push(builtin.clone());
|
list.push(builtin.clone());
|
||||||
list.push("just buses".to_string());
|
list.push("just buses".to_string());
|
||||||
|
list.push("empty".to_string());
|
||||||
list
|
list
|
||||||
})?;
|
})?;
|
||||||
ui.primary.clear_sim();
|
ui.primary.clear_sim();
|
||||||
Some(Transition::PopThenReplace(Box::new(SandboxMode::new(
|
Some(Transition::PopThenReplace(Box::new(SandboxMode::new(
|
||||||
ctx,
|
ctx,
|
||||||
ui,
|
ui,
|
||||||
GameplayMode::PlayScenario(scenario_name),
|
if scenario_name == "empty" {
|
||||||
|
GameplayMode::Freeform
|
||||||
|
} else {
|
||||||
|
GameplayMode::PlayScenario(scenario_name)
|
||||||
|
},
|
||||||
))))
|
))))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ use crate::pregame::main_menu;
|
|||||||
use crate::ui::{ShowEverything, UI};
|
use crate::ui::{ShowEverything, UI};
|
||||||
use abstutil::Timer;
|
use abstutil::Timer;
|
||||||
use ezgui::{
|
use ezgui::{
|
||||||
hotkey, lctrl, Button, Choice, Color, EventCtx, EventLoopMode, GfxCtx, Key, Line, ScreenPt,
|
hotkey, lctrl, Button, Choice, Color, EventCtx, EventLoopMode, GfxCtx, HorizontalAlignment,
|
||||||
Text,
|
Key, Line, Text, VerticalAlignment,
|
||||||
};
|
};
|
||||||
pub use gameplay::spawner::spawn_agents_around;
|
pub use gameplay::spawner::spawn_agents_around;
|
||||||
pub use gameplay::GameplayMode;
|
pub use gameplay::GameplayMode;
|
||||||
@ -296,7 +296,8 @@ impl AgentMeter {
|
|||||||
pub fn new(ctx: &EventCtx, ui: &UI) -> AgentMeter {
|
pub fn new(ctx: &EventCtx, ui: &UI) -> AgentMeter {
|
||||||
let (active, unfinished, by_mode) = ui.primary.sim.num_trips();
|
let (active, unfinished, by_mode) = ui.primary.sim.num_trips();
|
||||||
|
|
||||||
let composite = Composite::minimal_size(
|
let composite = Composite::aligned(
|
||||||
|
(HorizontalAlignment::Right, VerticalAlignment::Top),
|
||||||
ManagedWidget::col(vec![
|
ManagedWidget::col(vec![
|
||||||
{
|
{
|
||||||
let mut txt = Text::new();
|
let mut txt = Text::new();
|
||||||
@ -318,7 +319,6 @@ impl AgentMeter {
|
|||||||
])
|
])
|
||||||
.bg(Color::grey(0.4))
|
.bg(Color::grey(0.4))
|
||||||
.padding(20),
|
.padding(20),
|
||||||
ScreenPt::new(ctx.canvas.window_width - 300.0, 5.0),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
AgentMeter {
|
AgentMeter {
|
||||||
|
@ -4,7 +4,7 @@ use crate::sandbox::{GameplayMode, SandboxMode};
|
|||||||
use crate::ui::UI;
|
use crate::ui::UI;
|
||||||
use ezgui::{
|
use ezgui::{
|
||||||
hotkey, Button, Color, EventCtx, EventLoopMode, GeomBatch, GfxCtx, HorizontalAlignment, Key,
|
hotkey, Button, Color, EventCtx, EventLoopMode, GeomBatch, GfxCtx, HorizontalAlignment, Key,
|
||||||
Line, RewriteColor, ScreenPt, Slider, Text, VerticalAlignment, Wizard,
|
Line, RewriteColor, Slider, Text, VerticalAlignment, Wizard,
|
||||||
};
|
};
|
||||||
use geom::{Distance, Duration, Line, Pt2D, Time};
|
use geom::{Distance, Duration, Line, Pt2D, Time};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -15,7 +15,6 @@ const ADJUST_SPEED_PERCENT: f64 = 0.01;
|
|||||||
pub struct SpeedControls {
|
pub struct SpeedControls {
|
||||||
time_panel: TimePanel,
|
time_panel: TimePanel,
|
||||||
|
|
||||||
top_left: ScreenPt,
|
|
||||||
composite: Composite,
|
composite: Composite,
|
||||||
slider: Slider,
|
slider: Slider,
|
||||||
|
|
||||||
@ -34,12 +33,7 @@ enum SpeedState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SpeedControls {
|
impl SpeedControls {
|
||||||
fn make_panel(
|
fn make_panel(ctx: &EventCtx, paused: bool, desired_speed: f64) -> Composite {
|
||||||
ctx: &EventCtx,
|
|
||||||
paused: bool,
|
|
||||||
desired_speed: f64,
|
|
||||||
top_left: ScreenPt,
|
|
||||||
) -> Composite {
|
|
||||||
let mut row = Vec::new();
|
let mut row = Vec::new();
|
||||||
if paused {
|
if paused {
|
||||||
row.push(ManagedWidget::btn_no_cb(Button::rectangle_svg(
|
row.push(ManagedWidget::btn_no_cb(Button::rectangle_svg(
|
||||||
@ -147,20 +141,17 @@ impl SpeedControls {
|
|||||||
.bg(Color::grey(0.5)),
|
.bg(Color::grey(0.5)),
|
||||||
);
|
);
|
||||||
|
|
||||||
Composite::minimal_size(
|
Composite::aligned(
|
||||||
|
(
|
||||||
|
HorizontalAlignment::Center,
|
||||||
|
VerticalAlignment::BottomAboveOSD,
|
||||||
|
),
|
||||||
ManagedWidget::row(row.into_iter().map(|x| x.margin(5)).collect())
|
ManagedWidget::row(row.into_iter().map(|x| x.margin(5)).collect())
|
||||||
.bg(Color::hex("#4C4C4C")),
|
.bg(Color::hex("#4C4C4C")),
|
||||||
top_left,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(ctx: &mut EventCtx, ui: &UI) -> SpeedControls {
|
pub fn new(ctx: &mut EventCtx, ui: &UI) -> SpeedControls {
|
||||||
// TODO Or fullscreen and align it?
|
|
||||||
let top_left = ScreenPt::new(
|
|
||||||
(ctx.canvas.window_width - 600.0) / 2.0,
|
|
||||||
ctx.canvas.window_height - 80.0,
|
|
||||||
);
|
|
||||||
|
|
||||||
// 10 sim minutes / real second normally, or 1 sim hour / real second for dev mode
|
// 10 sim minutes / real second normally, or 1 sim hour / real second for dev mode
|
||||||
let speed_cap: f64 = if ui.opts.dev { 3600.0 } else { 600.0 };
|
let speed_cap: f64 = if ui.opts.dev { 3600.0 } else { 600.0 };
|
||||||
let mut slider = Slider::new(160.0, 15.0);
|
let mut slider = Slider::new(160.0, 15.0);
|
||||||
@ -171,8 +162,7 @@ impl SpeedControls {
|
|||||||
SpeedControls {
|
SpeedControls {
|
||||||
time_panel: TimePanel::new(ctx, ui),
|
time_panel: TimePanel::new(ctx, ui),
|
||||||
|
|
||||||
top_left,
|
composite: SpeedControls::make_panel(ctx, false, 1.0),
|
||||||
composite: SpeedControls::make_panel(ctx, false, 1.0, top_left),
|
|
||||||
slider,
|
slider,
|
||||||
|
|
||||||
state: SpeedState::Running {
|
state: SpeedState::Running {
|
||||||
@ -225,8 +215,7 @@ impl SpeedControls {
|
|||||||
last_measurement: now,
|
last_measurement: now,
|
||||||
last_measurement_sim: ui.primary.sim.time(),
|
last_measurement_sim: ui.primary.sim.time(),
|
||||||
};
|
};
|
||||||
self.composite =
|
self.composite = SpeedControls::make_panel(ctx, false, desired_speed);
|
||||||
SpeedControls::make_panel(ctx, false, desired_speed, self.top_left);
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
"pause" => {
|
"pause" => {
|
||||||
@ -288,8 +277,7 @@ impl SpeedControls {
|
|||||||
pub fn pause(&mut self, ctx: &EventCtx) {
|
pub fn pause(&mut self, ctx: &EventCtx) {
|
||||||
if !self.is_paused() {
|
if !self.is_paused() {
|
||||||
self.state = SpeedState::Paused;
|
self.state = SpeedState::Paused;
|
||||||
self.composite =
|
self.composite = SpeedControls::make_panel(ctx, true, self.desired_speed());
|
||||||
SpeedControls::make_panel(ctx, true, self.desired_speed(), self.top_left);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +368,8 @@ impl TimePanel {
|
|||||||
fn new(ctx: &mut EventCtx, ui: &UI) -> TimePanel {
|
fn new(ctx: &mut EventCtx, ui: &UI) -> TimePanel {
|
||||||
TimePanel {
|
TimePanel {
|
||||||
time: ui.primary.sim.time(),
|
time: ui.primary.sim.time(),
|
||||||
composite: Composite::minimal_size(
|
composite: Composite::aligned(
|
||||||
|
(HorizontalAlignment::Left, VerticalAlignment::Top),
|
||||||
ManagedWidget::col(vec![
|
ManagedWidget::col(vec![
|
||||||
ManagedWidget::draw_text(
|
ManagedWidget::draw_text(
|
||||||
ctx,
|
ctx,
|
||||||
@ -419,7 +408,6 @@ impl TimePanel {
|
|||||||
])
|
])
|
||||||
.bg(Color::hex("#4C4C4C"))
|
.bg(Color::hex("#4C4C4C"))
|
||||||
.padding(10),
|
.padding(10),
|
||||||
ScreenPt::new(0.0, 0.0),
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user