mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-21 18:04:03 +01:00
Crop Image: the Control bar leaves room for the cropping options
While the Crop Image tool is in use, the image's Control bar shows its file name, color mode and resolution only, so the tool's PPI, reference point, X, Y, W and H follow them in a wide window instead of being left out behind Unembed, Image Trace, Mask, Crop Image and Remove Background. ui.cropImage's params text now lists the ppi, reference and linked options and says Apply sends ppi with the rect.
This commit is contained in:
1 parent
49d53b8aaf
commit
e83f78f681
4 files changed
+11
-6
No files matched your search
@@ -848,7 +848,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"ui.cropImage",
|
||||
"Crop Image",
|
||||
"",
|
||||
"{} show a crop box on the selected image (tool `cropImage`): it starts on the part over the image's artboard; drag its handles or inside it, then Enter or the Control bar's Apply crops the image to it (object.cropImage {rect}), Escape or Cancel leaves it as it is, both back to the Selection tool. tool.setOption {key: \"rect\", value: [x, y, width, height]} sets the box. → {tool}; a tool that cannot be chosen returns the error",
|
||||
"{} show a crop box on the selected image (tool `cropImage`): it starts on the part over the image's artboard; drag its handles or inside it, then Enter or the Control bar's Apply crops the image to it (object.cropImage {rect, ppi?}: ppi when a resolution that changes the image's pixels is set), Escape or Cancel leaves it as it is, both back to the Selection tool. tool.setOption {key: \"rect\", value: [x, y, width, height]} sets the box; {key: \"ppi\", value: 1 to 2400 and at most the selected image's own resolution (300 for a linked image), or null for the image's own} the cropped image's resolution; {key: \"reference\", value: 0 to 8, left to right and top to bottom; 4, the center, by default} the point the Control bar's X and Y name and its W and H resize about; {key: \"linked\", value: true or false (default false)} whether W and H keep the box's proportions. → {tool}; a tool that cannot be chosen returns the error",
|
||||
),
|
||||
("effect.applyLast", "Apply Last Effect", "Cmd+Shift+E", "{}"),
|
||||
(
|
||||
|
||||
@@ -3292,7 +3292,7 @@ fn the_control_bar_s_controls_stay_inside_the_bar_in_a_narrow_window() {
|
||||
wide(&mut app, "an embedded image", &["Unembed…", "Image Trace", "Mask", "Crop Image", "Remove Background"]);
|
||||
app.select_tool(vectorcraft_tools::cropimage::ID);
|
||||
check(&mut app, "Crop Image");
|
||||
wide(&mut app, "Crop Image", &["X:", "Y:", "W:"]);
|
||||
wide(&mut app, "Crop Image", &["PPI", "X:", "Y:", "W:", "H:"]);
|
||||
app.select_tool("selection");
|
||||
app.run("imageTrace.make", json!({"preset": "Default"})).unwrap();
|
||||
let trace = selected(&app);
|
||||
|
||||
@@ -849,7 +849,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"ui.cropImage",
|
||||
"Crop Image",
|
||||
"",
|
||||
"{} show a crop box on the selected image (tool `cropImage`): it starts on the part over the image's artboard; drag its handles or inside it, then Enter or the Control bar's Apply crops the image to it (object.cropImage {rect}), Escape or Cancel leaves it as it is, both back to the Selection tool. tool.setOption {key: \"rect\", value: [x, y, width, height]} sets the box. → {tool}; a tool that cannot be chosen returns the error",
|
||||
"{} show a crop box on the selected image (tool `cropImage`): it starts on the part over the image's artboard; drag its handles or inside it, then Enter or the Control bar's Apply crops the image to it (object.cropImage {rect, ppi?}: ppi when a resolution that changes the image's pixels is set), Escape or Cancel leaves it as it is, both back to the Selection tool. tool.setOption {key: \"rect\", value: [x, y, width, height]} sets the box; {key: \"ppi\", value: 1 to 2400 and at most the selected image's own resolution (300 for a linked image), or null for the image's own} the cropped image's resolution; {key: \"reference\", value: 0 to 8, left to right and top to bottom; 4, the center, by default} the point the Control bar's X and Y name and its W and H resize about; {key: \"linked\", value: true or false (default false)} whether W and H keep the box's proportions. → {tool}; a tool that cannot be chosen returns the error",
|
||||
),
|
||||
("effect.applyLast", "Apply Last Effect", "Cmd+Shift+E", "{}"),
|
||||
(
|
||||
|
||||
@@ -741,9 +741,11 @@ pub fn image_summary(i: &Value) -> (String, String) {
|
||||
|
||||
/// The Control bar for the one selected image: Linked File or Embedded, its file name, colour mode
|
||||
/// and effective resolution, Embed or Unembed, Edit Original (a linked file), Image Trace, Mask,
|
||||
/// Crop Image and Remove Background. Whether one image is selected. A file name the row has no room
|
||||
/// for is left out alone; after it, each control shows only while the row has room for it and
|
||||
/// `reserve` after it, and the controls after one left out are left out too.
|
||||
/// Crop Image and Remove Background. While the Crop Image tool is in use, the bar shows the file
|
||||
/// name, colour mode and resolution only, and the tool's cropping options follow them. Whether one
|
||||
/// image is selected. A file name the row has no room for is left out alone; after it, each control
|
||||
/// shows only while the row has room for it and `reserve` after it, and the controls after one left
|
||||
/// out are left out too.
|
||||
pub fn control_bar_details(app: &mut VectorcraftApp, ui: &mut egui::Ui, reserve: f32) -> bool {
|
||||
let Some(i) = selected_image_info(app) else { return false };
|
||||
let (name, details) = image_summary(i);
|
||||
@@ -763,6 +765,9 @@ pub fn control_bar_details(app: &mut VectorcraftApp, ui: &mut egui::Ui, reserve:
|
||||
ui.label(details);
|
||||
}
|
||||
fit.separator(ui);
|
||||
if app.session.tool_id() == vectorcraft_tools::cropimage::ID {
|
||||
return true;
|
||||
}
|
||||
link_buttons(app, ui, id, linked, &name, LinkButtons::Fit(&mut fit));
|
||||
// The Image Trace button grows past its usual width for a longer translated label.
|
||||
let arrow = widgets::SPLIT_ARROW;
|
||||
|
||||
Reference in new issue
Block a user