mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 18:23:52 -06:00
fmt: import order in fillui, ribbon animations, home and title bar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
256b7c4714
commit
9b10e46da0
@@ -9,13 +9,13 @@ use craft::theme::Srgba;
|
||||
use craft::ui::buttons::IconButton;
|
||||
use craft::ui::contract::overlay::Anchor;
|
||||
use craft::ui::contract::{Bind, Entry, FieldLayout, Props as _, Show as _, ShowContainer as _, clicked};
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::list::ThumbAspect;
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::popover::Popover;
|
||||
use craft::ui::primitives::{Glyph, IconSpec};
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::runtime::env::UnitKind;
|
||||
use craft::ui::runtime::requests::HostAnswer;
|
||||
use craft::ui::text::{NumberField, StepArrows};
|
||||
|
||||
@@ -5,11 +5,11 @@ use craft::menu::ribbon::{Gallery, GalleryFace, GalleryItem, GalleryMore, Ribbon
|
||||
use craft::ui::buttons::{Arrangement, Button, ToggleButton};
|
||||
use craft::ui::contract::{Bind, BodyCx, Entry, PopupKind, Props as _, Show as _, ShowContainer as _, Trigger};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::layout_components::Stack;
|
||||
use craft::ui::list::ThumbAspect;
|
||||
use craft::ui::menu::{Menu, MenuItem};
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::primitives::{ContentPainterCx, IconSpec};
|
||||
use craft::ui::layout_components::Stack;
|
||||
use craft::ui::text::{NumberField, StepArrows};
|
||||
use craft::ui::tile_grid::{CaptionPlace, Tile, TileGrid};
|
||||
use deckcraft_model::AnimClass;
|
||||
|
||||
@@ -29,7 +29,15 @@ const SHAPE_FILL_KEY: &str = "ribbon.home.shapeFill";
|
||||
const SHAPE_OUTLINE_KEY: &str = "ribbon.home.shapeOutline";
|
||||
|
||||
/// Shows a painter whose single click toggles and whose double click keeps it armed.
|
||||
pub(super) fn painter_toggle(app: &mut SlideApp, ui: &mut Ui, (icon, arrangement): (Icon, Arrangement), label: &str, cmd: &str, armed: bool, tooltip: &str) {
|
||||
pub(super) fn painter_toggle(
|
||||
app: &mut SlideApp,
|
||||
ui: &mut Ui,
|
||||
(icon, arrangement): (Icon, Arrangement),
|
||||
label: &str,
|
||||
cmd: &str,
|
||||
armed: bool,
|
||||
tooltip: &str,
|
||||
) {
|
||||
let output = ToggleButton::new(label.to_owned(), Bind::given(armed))
|
||||
.icon(icon.id())
|
||||
.arrangement(arrangement)
|
||||
@@ -66,7 +74,7 @@ fn clipboard(app: &mut SlideApp, ui: &mut Ui) {
|
||||
Button::command("edit.copy").label(Word::plain("Copy")).icon(Icon::Copy.id()).show(ui);
|
||||
let armed = app.session.painter.is_some();
|
||||
let tooltip = Env::of(ui).view().resolve(&Word::plain("Format Painter (double-click to keep it on)").into());
|
||||
painter_toggle(app, ui, (Icon::FormatPainter, Arrangement::Inline), "Format","format.painter", armed, tooltip.as_str());
|
||||
painter_toggle(app, ui, (Icon::FormatPainter, Arrangement::Inline), "Format", "format.painter", armed, tooltip.as_str());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ pub fn title_bar(app: &mut SlideApp, ui: &mut egui::Ui, _cx: &mut BodyCx<'_>) {
|
||||
|ui, _| super::qat::bar(app, ui),
|
||||
|ui, _| {
|
||||
// The icon names the appearance, so the button rests flat in both, as the old title bar's did: no on plate.
|
||||
switch_appearance = IconButton::new(if dark { Icon::Sparkle } else { Icon::Palette }.id()).label("Light/Dark appearance").show(ui).clicked();
|
||||
switch_appearance =
|
||||
IconButton::new(if dark { Icon::Sparkle } else { Icon::Palette }.id()).label("Light/Dark appearance").show(ui).clicked();
|
||||
ToggleButton::command(CommandRef::with_params("view.pane", json!({"pane": "comments", "toggle": true})))
|
||||
.label("Comments")
|
||||
.icon(Icon::CommentsBubble.id())
|
||||
|
||||
Reference in New Issue
Block a user