mirror of
https://github.com/a-b-street/abstreet.git
synced 2025-01-08 07:41:57 +03:00
jump to info panel object
This commit is contained in:
parent
497d05552a
commit
5f0dd70d43
@ -4,7 +4,7 @@ use crate::ui::UI;
|
|||||||
use abstutil::prettyprint_usize;
|
use abstutil::prettyprint_usize;
|
||||||
use ezgui::{
|
use ezgui::{
|
||||||
hotkey, Button, Color, Composite, EventCtx, HorizontalAlignment, Key, Line, ManagedWidget,
|
hotkey, Button, Color, Composite, EventCtx, HorizontalAlignment, Key, Line, ManagedWidget,
|
||||||
Plot, Series, Text, VerticalAlignment,
|
Plot, RewriteColor, Series, Text, VerticalAlignment,
|
||||||
};
|
};
|
||||||
use geom::{Duration, Statistic, Time};
|
use geom::{Duration, Statistic, Time};
|
||||||
use map_model::{IntersectionID, RoadID};
|
use map_model::{IntersectionID, RoadID};
|
||||||
@ -24,6 +24,13 @@ impl InfoPanel {
|
|||||||
txt.highlight_last_line(Color::BLUE);
|
txt.highlight_last_line(Color::BLUE);
|
||||||
ManagedWidget::draw_text(ctx, txt)
|
ManagedWidget::draw_text(ctx, txt)
|
||||||
},
|
},
|
||||||
|
ManagedWidget::btn(Button::rectangle_svg(
|
||||||
|
"assets/tools/locate.svg",
|
||||||
|
"jump to object",
|
||||||
|
hotkey(Key::J),
|
||||||
|
RewriteColor::Change(Color::hex("#CC4121"), Color::ORANGE),
|
||||||
|
ctx,
|
||||||
|
)),
|
||||||
crate::managed::Composite::text_button(ctx, "X", hotkey(Key::Escape)).align_right(),
|
crate::managed::Composite::text_button(ctx, "X", hotkey(Key::Escape)).align_right(),
|
||||||
])];
|
])];
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use crate::helpers::{list_names, ID};
|
|||||||
use crate::render::DrawOptions;
|
use crate::render::DrawOptions;
|
||||||
use crate::ui::UI;
|
use crate::ui::UI;
|
||||||
use ezgui::{
|
use ezgui::{
|
||||||
hotkey, lctrl, Color, EventCtx, GfxCtx, HorizontalAlignment, Key, Line, Outcome, Text,
|
lctrl, Color, EventCtx, EventLoopMode, GfxCtx, HorizontalAlignment, Key, Line, Outcome, Text,
|
||||||
VerticalAlignment,
|
VerticalAlignment,
|
||||||
};
|
};
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
@ -47,7 +47,7 @@ impl CommonState {
|
|||||||
if ctx.input.new_was_pressed(lctrl(Key::S).unwrap()) {
|
if ctx.input.new_was_pressed(lctrl(Key::S).unwrap()) {
|
||||||
ui.opts.dev = !ui.opts.dev;
|
ui.opts.dev = !ui.opts.dev;
|
||||||
}
|
}
|
||||||
if ui.opts.dev && ctx.input.new_was_pressed(hotkey(Key::J).unwrap()) {
|
if ui.opts.dev && ctx.input.new_was_pressed(lctrl(Key::J).unwrap()) {
|
||||||
return Some(Transition::Push(warp::EnteringWarp::new()));
|
return Some(Transition::Push(warp::EnteringWarp::new()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +80,17 @@ impl CommonState {
|
|||||||
self.info_panel = None;
|
self.info_panel = None;
|
||||||
assert!(ui.per_obj.info_panel_open);
|
assert!(ui.per_obj.info_panel_open);
|
||||||
ui.per_obj.info_panel_open = false;
|
ui.per_obj.info_panel_open = false;
|
||||||
|
} else if action == "jump to object" {
|
||||||
|
return Some(Transition::PushWithMode(
|
||||||
|
Warping::new(
|
||||||
|
ctx,
|
||||||
|
info.id.canonical_point(&ui.primary).unwrap(),
|
||||||
|
Some(10.0),
|
||||||
|
Some(info.id.clone()),
|
||||||
|
&mut ui.primary,
|
||||||
|
),
|
||||||
|
EventLoopMode::Animation,
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
// TODO If the action was conditional on some other stuff, it might
|
// TODO If the action was conditional on some other stuff, it might
|
||||||
// still go unused.
|
// still go unused.
|
||||||
|
Loading…
Reference in New Issue
Block a user