Apply cargo fmt
This commit is contained in:
+27
-7
@@ -236,9 +236,13 @@ impl App {
|
||||
}
|
||||
|
||||
fn insert_text_node(&mut self, at: Pos2, ctx: &Context) {
|
||||
let id = self
|
||||
.view
|
||||
.insert_node(&mut self.doc, NodeKind::Text { text: String::new() }, at);
|
||||
let id = self.view.insert_node(
|
||||
&mut self.doc,
|
||||
NodeKind::Text {
|
||||
text: String::new(),
|
||||
},
|
||||
at,
|
||||
);
|
||||
self.view.edit_node(&id);
|
||||
self.set_status("Added a text node", ctx);
|
||||
}
|
||||
@@ -513,7 +517,11 @@ impl App {
|
||||
}
|
||||
|
||||
// Arrow keys nudge the selection.
|
||||
let step = if ctx.input(|i| i.modifiers.shift) { 10.0 } else { 1.0 };
|
||||
let step = if ctx.input(|i| i.modifiers.shift) {
|
||||
10.0
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let mut delta = egui::Vec2::ZERO;
|
||||
for (key, direction) in [
|
||||
(Key::ArrowLeft, egui::vec2(-1.0, 0.0)),
|
||||
@@ -742,10 +750,18 @@ impl App {
|
||||
|
||||
fn toolbar(&mut self, ui: &mut Ui, ctx: &Context) {
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("New").on_hover_text("New canvas (Ctrl+N)").clicked() {
|
||||
if ui
|
||||
.button("New")
|
||||
.on_hover_text("New canvas (Ctrl+N)")
|
||||
.clicked()
|
||||
{
|
||||
self.new_document(ctx);
|
||||
}
|
||||
if ui.button("Open").on_hover_text("Open a canvas (Ctrl+O)").clicked() {
|
||||
if ui
|
||||
.button("Open")
|
||||
.on_hover_text("Open a canvas (Ctrl+O)")
|
||||
.clicked()
|
||||
{
|
||||
self.open_dialog(ctx);
|
||||
}
|
||||
if ui.button("Save").on_hover_text("Save (Ctrl+S)").clicked() {
|
||||
@@ -798,7 +814,11 @@ impl App {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
ui.toggle_value(&mut self.show_inspector, "Inspector");
|
||||
ui.toggle_value(&mut self.view.snap_to_grid, "Snap");
|
||||
let icon = if self.dark_mode { "Light theme" } else { "Dark theme" };
|
||||
let icon = if self.dark_mode {
|
||||
"Light theme"
|
||||
} else {
|
||||
"Dark theme"
|
||||
};
|
||||
if ui.button(icon).on_hover_text("Switch theme").clicked() {
|
||||
self.dark_mode = !self.dark_mode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user