Expose aspect ratio toggle in inspector and layer context menu
This commit is contained in:
parent
56fdbd310f
commit
df0ee4cf5d
|
|
@ -945,11 +945,18 @@ impl Editor {
|
|||
enter = true;
|
||||
}
|
||||
}
|
||||
ui.scope_builder(
|
||||
egui::UiBuilder::new().max_rect(Rect::from_min_size(
|
||||
ink.point(0.0, 530.0),
|
||||
Vec2::new(w, 24.0),
|
||||
)),
|
||||
|ui| self.resize_ratio_option(ui),
|
||||
);
|
||||
let pending = self.fields_pending();
|
||||
let apply = ui
|
||||
.scope_builder(
|
||||
egui::UiBuilder::new().max_rect(Rect::from_min_size(
|
||||
ink.point(0.0, 530.0),
|
||||
ink.point(0.0, 558.0),
|
||||
Vec2::new(w, 34.0),
|
||||
)),
|
||||
|ui| {
|
||||
|
|
@ -963,47 +970,47 @@ impl Editor {
|
|||
}
|
||||
if !self.error.is_empty() {
|
||||
ui.put(
|
||||
Rect::from_min_size(ink.point(0.0, 575.0), Vec2::new(w, 55.0)),
|
||||
Rect::from_min_size(ink.point(0.0, 603.0), Vec2::new(w, 55.0)),
|
||||
egui::Label::new(egui::RichText::new(&self.error).color(palette.amber)).wrap(),
|
||||
);
|
||||
} else if g.outside_on(self.layout.formats().output) {
|
||||
ink.text(
|
||||
0.0,
|
||||
579.0,
|
||||
607.0,
|
||||
"Outside screen · use Fit selected to find it",
|
||||
12.0,
|
||||
palette.amber,
|
||||
);
|
||||
}
|
||||
ink.line([0.0, 612.0], [w, 612.0], palette.line);
|
||||
ink.line([0.0, 640.0], [w, 640.0], palette.line);
|
||||
ink.text(
|
||||
0.0,
|
||||
635.0,
|
||||
663.0,
|
||||
"VISIBLE BOX / CENTER POSITION",
|
||||
11.0,
|
||||
palette.cyan,
|
||||
);
|
||||
let [h, v] = g.center();
|
||||
ink.field(0.0, 665.0, half, "Horizontal · from left", &number(h));
|
||||
ink.field(half + 12.0, 665.0, half, "Vertical · from top", &number(v));
|
||||
ink.field(0.0, 693.0, half, "Horizontal · from left", &number(h));
|
||||
ink.field(half + 12.0, 693.0, half, "Vertical · from top", &number(v));
|
||||
ink.text(
|
||||
0.0,
|
||||
748.0,
|
||||
776.0,
|
||||
"Layer properties: crops / provisional device mapping",
|
||||
12.0,
|
||||
palette.muted,
|
||||
);
|
||||
ink.button(0.0, 780.0, w, "Copy position values", true);
|
||||
if click(ui, &ink, [0.0, 780.0, w, 34.0], "copy-values") {
|
||||
ink.button(0.0, 808.0, w, "Copy position values", true);
|
||||
if click(ui, &ink, [0.0, 808.0, w, 34.0], "copy-values") {
|
||||
self.copy(ui.ctx());
|
||||
}
|
||||
ink.button(0.0, 829.0, w, "Paste layer(s) values", false);
|
||||
if click(ui, &ink, [0.0, 829.0, w, 34.0], "paste-button") {
|
||||
ink.button(0.0, 857.0, w, "Paste layer(s) values", false);
|
||||
if click(ui, &ink, [0.0, 857.0, w, 34.0], "paste-button") {
|
||||
self.open_paste(String::new());
|
||||
}
|
||||
ink.text(
|
||||
0.0,
|
||||
884.0,
|
||||
912.0,
|
||||
"Or Ctrl/Cmd-V with the viewport focused",
|
||||
12.0,
|
||||
palette.muted,
|
||||
|
|
@ -1095,6 +1102,21 @@ impl Editor {
|
|||
ui.colored_label(palette.amber, &self.error);
|
||||
}
|
||||
}
|
||||
fn resize_ratio_option(&mut self, ui: &mut egui::Ui) {
|
||||
if ui
|
||||
.checkbox(
|
||||
&mut self.keep_aspect_ratio,
|
||||
"Keep aspect ratio when resizing",
|
||||
)
|
||||
.on_hover_text(
|
||||
"Applies to layer sizing. Crop zoom always keeps the source proportions.",
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
let options = self.application_settings(ui.ctx());
|
||||
self.settings.save(&options);
|
||||
}
|
||||
}
|
||||
fn layer_context_menu(&mut self, ui: &mut egui::Ui) {
|
||||
ui.set_min_width(210.0);
|
||||
let selected = self.layout.selected_indices();
|
||||
|
|
@ -1163,6 +1185,7 @@ impl Editor {
|
|||
});
|
||||
}
|
||||
if !selected.is_empty() {
|
||||
self.resize_ratio_option(ui);
|
||||
ui.menu_button("Align…", |ui| self.alignment_menu(ui));
|
||||
ui.separator();
|
||||
if ui.button("Copy layer values").clicked() {
|
||||
|
|
@ -2603,6 +2626,7 @@ mod tests {
|
|||
let pos = output
|
||||
.shapes
|
||||
.iter()
|
||||
.rev()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::Shape::Text(t) if t.galley.text() == label => {
|
||||
Some(t.pos + t.galley.size() / 2.0)
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ mod tests {
|
|||
let pos = output
|
||||
.shapes
|
||||
.iter()
|
||||
.rev()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::Shape::Text(t) if t.galley.text() == label => {
|
||||
Some(t.pos + t.galley.size() / 2.0)
|
||||
|
|
|
|||
|
|
@ -472,3 +472,9 @@ repaired or moved and the application restarted. Write failures keep options
|
|||
active in memory and offer **Retry saving options**. No project data, images or
|
||||
clipboard contents are stored here. The [settings interface](interfaces/midra-layout-settings.md)
|
||||
documents the file and compatibility rules.
|
||||
|
||||
**Keep aspect ratio when resizing** is also available directly above
|
||||
**Apply position / size** in the selected layer's right panel and in the layer
|
||||
right-click menu (including multiple selections). These controls share the
|
||||
Options setting and save changes automatically. They do not apply or discard
|
||||
pending size/position edits. Crop zoom remains proportional.
|
||||
|
|
|
|||
Loading…
Reference in New Issue