Popout editor for all cards
This commit is contained in:
+9
-2
@@ -12,7 +12,7 @@ use crate::geometry::{bounds_of, node_rect};
|
||||
use crate::inspector;
|
||||
use crate::model::{Canvas, Node, NodeKind};
|
||||
use crate::theme::Palette;
|
||||
use crate::view::{CanvasView, Clipboard, InsertRequest};
|
||||
use crate::view::{CanvasView, Clipboard, EditTarget, InsertRequest};
|
||||
|
||||
/// How long a status message stays on screen.
|
||||
const STATUS_SECONDS: f64 = 5.0;
|
||||
@@ -546,8 +546,12 @@ impl App {
|
||||
}
|
||||
if ctx.input_mut(|i| i.key_pressed(Key::F2))
|
||||
&& let Some(id) = self.view.selection.only_node().map(str::to_owned)
|
||||
&& let EditTarget::Inspector(reason) = self.view.begin_edit(&self.doc, &id)
|
||||
{
|
||||
self.view.edit_node(&id);
|
||||
// Nothing to type into, so the fields that can be changed are put
|
||||
// where they are instead.
|
||||
self.show_inspector = true;
|
||||
self.set_status(reason, ctx);
|
||||
}
|
||||
if ctx.input_mut(|i| i.key_pressed(Key::F)) && !self.view.selection.is_empty() {
|
||||
self.view.zoom_to_selection(&self.doc.canvas);
|
||||
@@ -1112,6 +1116,9 @@ impl eframe::App for App {
|
||||
if let Some((kind, at)) = out.insert {
|
||||
self.insert_requested(kind, at, &ctx);
|
||||
}
|
||||
if out.reveal_inspector {
|
||||
self.show_inspector = true;
|
||||
}
|
||||
});
|
||||
|
||||
self.dialogs(&ctx);
|
||||
|
||||
Reference in New Issue
Block a user