Preserve editor input context through diagram help
This commit is contained in:
@@ -380,6 +380,7 @@ pub enum Message {
|
||||
Guide(crate::guide::Event),
|
||||
ContextHelp(crate::guide::Topic),
|
||||
CloseContextHelp,
|
||||
ContextHelpScroll(crate::guide::ContextScroll),
|
||||
Help,
|
||||
Traceability(crate::views::traceability::Event),
|
||||
ReviewLayerTraces,
|
||||
@@ -1301,6 +1302,11 @@ impl App {
|
||||
iced::time::every(std::time::Duration::from_secs(10)).map(|_| Message::CheckpointTick),
|
||||
window::close_requests().map(|id| Message::Request(Pending::Close(id))),
|
||||
window::resize_events().map(|(_, size)| Message::WindowResized(size)),
|
||||
if self.context_help {
|
||||
iced::event::listen_with(crate::guide::context_scroll_key)
|
||||
} else {
|
||||
Subscription::none()
|
||||
},
|
||||
iced::event::listen_with(|event, _, _| {
|
||||
matches!(
|
||||
event,
|
||||
@@ -1355,6 +1361,13 @@ impl App {
|
||||
])
|
||||
}
|
||||
pub fn update(&mut self, message: Message) -> Task<Message> {
|
||||
if let Message::ContextHelpScroll(scroll) = message {
|
||||
return if self.context_help {
|
||||
crate::guide::context_scroll_task(scroll)
|
||||
} else {
|
||||
Task::none()
|
||||
};
|
||||
}
|
||||
// Help owns user input before any canvas/reference fast path can act.
|
||||
// Passive results may finish; they retain their normal lifetime checks.
|
||||
if self.context_help
|
||||
@@ -2852,6 +2865,7 @@ impl App {
|
||||
Message::CloseContextHelp => {
|
||||
self.context_help = false;
|
||||
}
|
||||
Message::ContextHelpScroll(_) => {}
|
||||
Message::Help => {
|
||||
let topic = match self.page {
|
||||
Page::Diagram => Some(crate::guide::Topic::Nesting),
|
||||
|
||||
Reference in New Issue
Block a user