Move output format selection into the icon toolbar
This commit is contained in:
parent
3d3c35730d
commit
952c407346
|
|
@ -1125,25 +1125,32 @@ impl Editor {
|
|||
let ink = Ink::new(ui, r);
|
||||
let output = self.layout.formats().output;
|
||||
let [sw, sh] = output.map(|v| v as f32);
|
||||
ink.button(24.0, 20.0, 185.0, "Output format…", false);
|
||||
if click(ui, &ink, [24.0, 20.0, 185.0, 34.0], "output-format") {
|
||||
ink.card(24.0, 65.0, 36.0, 36.0, FIELD, LINE);
|
||||
if toolbar_icon(
|
||||
ui,
|
||||
Rect::from_min_size(ink.point(26.0, 67.0), Vec2::splat(32.0)),
|
||||
"Output format",
|
||||
ToolbarIcon::Output,
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
self.output_draft = Some(OutputDraft::new(output));
|
||||
}
|
||||
ink.text(
|
||||
224.0,
|
||||
24.0,
|
||||
30.0,
|
||||
&format!("{} × {} px", output[0], output[1]),
|
||||
12.0,
|
||||
MUTED,
|
||||
);
|
||||
// A single compact strip: view tools, then history tools.
|
||||
ink.card(24.0, 65.0, 150.0, 36.0, FIELD, LINE);
|
||||
ink.line([99.0, 73.0], [99.0, 93.0], LINE);
|
||||
ink.card(72.0, 65.0, 150.0, 36.0, FIELD, LINE);
|
||||
ink.line([147.0, 73.0], [147.0, 93.0], LINE);
|
||||
for (x, text, icon) in [
|
||||
(28.0, "Fit screen", ToolbarIcon::Screen),
|
||||
(62.0, "Fit selected", ToolbarIcon::Selection),
|
||||
(104.0, "Undo", ToolbarIcon::Undo),
|
||||
(138.0, "Redo", ToolbarIcon::Redo),
|
||||
(76.0, "Fit screen", ToolbarIcon::Screen),
|
||||
(110.0, "Fit selected", ToolbarIcon::Selection),
|
||||
(152.0, "Undo", ToolbarIcon::Undo),
|
||||
(186.0, "Redo", ToolbarIcon::Redo),
|
||||
] {
|
||||
let rect = Rect::from_min_size(ink.point(x, 67.0), Vec2::splat(32.0));
|
||||
if toolbar_icon(ui, rect, text, icon).clicked() {
|
||||
|
|
@ -1175,7 +1182,7 @@ impl Editor {
|
|||
ui.scope_builder(
|
||||
egui::UiBuilder::new()
|
||||
.max_rect(Rect::from_min_size(
|
||||
ink.point(184.0, 66.0),
|
||||
ink.point(232.0, 66.0),
|
||||
Vec2::new(36.0, 34.0),
|
||||
))
|
||||
.layout(egui::Layout::left_to_right(egui::Align::Center)),
|
||||
|
|
@ -1213,7 +1220,7 @@ impl Editor {
|
|||
ui.scope_builder(
|
||||
egui::UiBuilder::new()
|
||||
.max_rect(Rect::from_min_size(
|
||||
ink.point(232.0, 66.0),
|
||||
ink.point(280.0, 66.0),
|
||||
Vec2::new(154.0, 34.0),
|
||||
))
|
||||
.layout(egui::Layout::left_to_right(egui::Align::Center)),
|
||||
|
|
@ -1872,6 +1879,7 @@ fn alignment_icon(
|
|||
|
||||
#[derive(Clone, Copy)]
|
||||
enum ToolbarIcon {
|
||||
Output,
|
||||
Screen,
|
||||
Selection,
|
||||
Undo,
|
||||
|
|
@ -1898,6 +1906,19 @@ fn toolbar_icon(ui: &mut egui::Ui, rect: Rect, label: &str, icon: ToolbarIcon) -
|
|||
let c = rect.center();
|
||||
let point = |x, y| c + Vec2::new(x, y);
|
||||
match icon {
|
||||
ToolbarIcon::Output => {
|
||||
painter.rect_stroke(
|
||||
Rect::from_center_size(c, Vec2::new(22.0, 18.0)),
|
||||
2.0,
|
||||
stroke,
|
||||
StrokeKind::Inside,
|
||||
);
|
||||
for (y, knob) in [(-4.0, -3.0), (4.0, 3.0)] {
|
||||
painter.line_segment([point(-7.0, y), point(7.0, y)], stroke);
|
||||
painter.circle_filled(point(knob, y), 2.5, FIELD);
|
||||
painter.circle_stroke(point(knob, y), 2.5, stroke);
|
||||
}
|
||||
}
|
||||
ToolbarIcon::Screen => {
|
||||
painter.rect_stroke(
|
||||
Rect::from_center_size(point(0.0, -2.0), Vec2::new(20.0, 14.0)),
|
||||
|
|
@ -1960,6 +1981,7 @@ fn toolbar_icon(ui: &mut egui::Ui, rect: Rect, label: &str, icon: ToolbarIcon) -
|
|||
}
|
||||
}
|
||||
response.on_hover_text(match icon {
|
||||
ToolbarIcon::Output => "Output format — screen ratio and resolution",
|
||||
ToolbarIcon::Screen => "Fit screen — show the entire output",
|
||||
ToolbarIcon::Selection => "Fit selected — frame the selected layers",
|
||||
ToolbarIcon::Undo => "Undo (Ctrl/Cmd+Z)",
|
||||
|
|
@ -2955,7 +2977,7 @@ mod tests {
|
|||
}
|
||||
fn open_alignment_test_menu(app: &mut Editor, ctx: &egui::Context) -> egui::FullOutput {
|
||||
frame(app, ctx, vec![]);
|
||||
let pos = Pos2::new(200.0, 127.0);
|
||||
let pos = Pos2::new(248.0, 127.0);
|
||||
frame(
|
||||
app,
|
||||
ctx,
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ one Undo restores the complete resize. Locked or hidden layers cannot be resized
|
|||
|
||||
## Formats and content framing
|
||||
|
||||
Open **Output format…** for HD (1280 × 720), Full HD (1920 × 1080), UHD 4K
|
||||
Open the **Output format** icon (screen with sliders), first in the toolbar, for HD (1280 × 720), Full HD (1920 × 1080), UHD 4K
|
||||
(3840 × 2160), aspect presets or a custom whole-pixel resolution. Output/native
|
||||
sizes support 1–16384 pixels per side as an implementation limit, not a promise
|
||||
of hardware support. Layer positions/sizes remain unchanged; screen-corner
|
||||
|
|
|
|||
Loading…
Reference in New Issue