mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 04:04:25 +00:00
fwb2-fix: CropBar out_of_range and Fill help words
(cherry picked from commit 00a6d8a82470f36a7d01b30e19b6b78526b27ef7)
This commit is contained in:
@@ -57,8 +57,12 @@ pub struct CropBarOutput {
|
||||
pub pick_color: Option<ColorRequest>,
|
||||
/// Any option of the settings changed this pass: the app persists them.
|
||||
pub settings_changed: bool,
|
||||
/// The help button was pressed this pass: the host opens a `HostedAlert`.
|
||||
/// The help button was pressed this pass: the host opens a `HostedAlert` (the `fill_help_*` words of
|
||||
/// [`CropBarWords`]).
|
||||
pub help: bool,
|
||||
/// A value typed into W x H x Resolution outside its range: the cell keeps the limit and the host raises the
|
||||
/// range alert.
|
||||
pub out_of_range: Option<craft_ui::text::RangeAlert>,
|
||||
/// Reset was pressed this pass.
|
||||
pub reset: bool,
|
||||
/// Selection was picked in the preset list: the app calls `CropTool::take_selection_frame`.
|
||||
@@ -146,6 +150,7 @@ impl<'a> CropBar<'a> {
|
||||
let before = settings.clone();
|
||||
let mut report = Report::default();
|
||||
let (mut help_pressed, mut reset_pressed) = (false, false);
|
||||
let mut out_of_range = None;
|
||||
// The options are the bar's members, spaced as the bar spaces them.
|
||||
let shown = Row::new().gap(Gap::Item).show(ui, |ui, cx| {
|
||||
let list = CropPresetList::new(settings, document)
|
||||
@@ -158,9 +163,14 @@ impl<'a> CropBar<'a> {
|
||||
report.delete_preset = list.delete_preset;
|
||||
report.selection = list.selection;
|
||||
if settings.ratio == CropRatio::Size {
|
||||
if size_cells::show(ui, &mut settings.size, SizeLimits::CROP, document, &units, &words).changed {
|
||||
let cells = size_cells::show(ui, &mut settings.size, SizeLimits::CROP, document, &units, &words);
|
||||
if cells.changed {
|
||||
report.ratio = Some(CropRatioChange { editing: false });
|
||||
}
|
||||
// The body can run more than once in a pass: a later run does not drop an alert an earlier one raised.
|
||||
if cells.out_of_range.is_some() {
|
||||
out_of_range = cells.out_of_range;
|
||||
}
|
||||
} else {
|
||||
ratio_fields(ui, cx, settings, &words, document, has_document, &units, &mut report);
|
||||
}
|
||||
@@ -204,6 +214,7 @@ impl<'a> CropBar<'a> {
|
||||
pick_color: report.pick_color,
|
||||
settings_changed: changed,
|
||||
help: help_pressed,
|
||||
out_of_range,
|
||||
reset: reset_pressed,
|
||||
selection: report.selection,
|
||||
}
|
||||
|
||||
@@ -68,6 +68,13 @@ craft_ui::words! {
|
||||
fill_transparent: "cropBar.fillTransparent" = "Transparent (default)";
|
||||
/// The Reset button's name and tooltip.
|
||||
reset_tip: "cropBar.resetTip" = "Reset the crop box, image rotation, and aspect ratio settings";
|
||||
/// The Fill help button's name, and the help it opens: a title, then each fill method's name and what it does.
|
||||
fill_help: "cropBar.fillHelp" = "Displays pop-up help for the fill methods";
|
||||
fill_help_title: "cropBar.fillHelpTitle" = "Fill options";
|
||||
fill_help_background: "cropBar.fillHelpBackground" = "Background (default):";
|
||||
fill_help_background_text: "cropBar.fillHelpBackgroundText" = "Fill the expanded area with your background color or transparent pixels";
|
||||
fill_help_content_aware: "cropBar.fillHelpContentAware" = "Content-aware fill";
|
||||
fill_help_content_aware_text: "cropBar.fillHelpContentAwareText" = "Sample content from part of the image and use it to fill a small area";
|
||||
/// The perspective bar's Show Grid check box.
|
||||
show_grid: "cropBar.showGrid" = "Show Grid";
|
||||
commit: "cropBar.commit" = "Commit current crop operation";
|
||||
|
||||
Reference in New Issue
Block a user