Content-Aware Fill: keep the workspace open while a background fill runs

With background jobs on, Apply and OK start edit.contentAwareFill as a job
and get {"job", "pending": true} back. The workspace treated that as a
finished fill: OK closed at once, so a fill that then failed or was
cancelled left no workspace to fix and retry from, and Apply refreshed
before the fill had landed and let a second fill start meanwhile.

The workspace now records the job it started. While it runs, the
controls, tools, shortcuts and a second Apply/OK are refused; Cancel (the
button, Esc or the control channel) cancels the job and closes. When the
job ends, a successful OK closes the workspace and a successful Apply
refreshes it; a failed or cancelled fill keeps it open with the reason in
its panel, as a failed synchronous OK does. Jobs of another workspace or
document are ignored. describe() reports pending and pendingJob.

Taken from the Content-Aware Fill part of #8506.
This commit is contained in:
FredApps committed 2026-11-16 20:08:09 +01:00
1 parent 02e9907f68
commit e9481d08df
6 files changed
+311 -22

No files matched your search

+13 -1
View File
@@ -25,8 +25,9 @@
use egui::{Align2, Color32, FontId, Pos2, Rect as ERect, Sense, Stroke, TextureHandle, pos2, vec2};
use photocraft_algo::content_aware::{SamplingStroke, paint_strokes};
use photocraft_doc::LayerId;
use photocraft_doc::{DocId, LayerId};
use photocraft_engine::edit_menu_cmds::{MAX_CAF_EDITS, MAX_CAF_POINTS};
use photocraft_engine::jobs::{JobEvent, JobId, JobOutcome};
use photocraft_geom::Rect;
use serde_json::{Value, json};
@@ -41,6 +42,7 @@ mod preview;
mod view;
pub use controls::{control, keys, pointer};
pub(crate) use lifecycle::on_job_event;
pub use lifecycle::{apply, cancel, commit, open};
#[cfg(test)]
use preview::plan_params;
@@ -218,6 +220,7 @@ fn stroke_json(s: &SamplingStroke) -> Value {
}
pub struct CafWorkspace {
document: DocId,
pub layer: LayerId,
layer_name: String,
canvas: Rect,
@@ -261,9 +264,16 @@ pub struct CafWorkspace {
center: [f64; 2],
hover: Option<[f64; 2]>,
preview: Preview,
pending_fill: Option<PendingFill>,
pub error: Option<String>,
}
#[derive(Clone, Copy, Debug)]
struct PendingFill {
job: JobId,
close_on_success: bool,
}
impl CafWorkspace {
pub fn describe(&self) -> Value {
let sampled = self.mask.iter().zip(&self.hole_px).filter(|(m, h)| **m && !**h).count();
@@ -283,6 +293,8 @@ impl CafWorkspace {
"sampledProxyPixels": sampled,
"proxyScale": self.k,
"settings": self.opts.to_json(),
"pending": self.pending_fill.is_some(),
"pendingJob": self.pending_fill.map(|p| p.job.0),
"previewReady": self.preview.tex.is_some() && self.preview.shown == self.preview.want,
"previewError": self.preview.error,
"error": self.error,
+15 -8
View File
@@ -1,4 +1,4 @@
use super::lifecycle::{apply, cancel, close, fill_edit, redo, report, reset, set_sampling, undo};
use super::lifecycle::{apply, cancel, commit_fill, fill_edit, redo, report, reset, set_sampling, undo};
use super::preview::{rebase, wait_preview};
use super::{CafTool, CafWorkspace, LASSO_OPS, PhotocraftApp, ToolEvent, Value, json};
@@ -9,6 +9,9 @@ pub fn control(app: &mut PhotocraftApp, ui: &Value) -> Result<Value, String> {
cancel(app);
return Ok(json!({"cancelled": true}));
}
if app.distort.caf.as_ref().is_some_and(|w| w.pending_fill.is_some()) {
return Err("Content-Aware Fill is still processing".into());
}
let before = app.distort.caf.as_ref().ok_or("Content-Aware Fill is not open")?.opts.clone();
{
let w = app.distort.caf.as_mut().ok_or("Content-Aware Fill is not open")?;
@@ -83,7 +86,7 @@ pub fn control(app: &mut PhotocraftApp, ui: &Value) -> Result<Value, String> {
if flag("redo") {
redo(app);
}
if flag("apply") {
if flag("apply") && !flag("commit") {
apply(app)?;
}
if flag("waitPreview") {
@@ -92,12 +95,13 @@ pub fn control(app: &mut PhotocraftApp, ui: &Value) -> Result<Value, String> {
// OK last, with the settings given alongside. A failed fill keeps the workspace open, as
// the OK button does.
if flag("commit") {
let r = apply(app);
match &r {
Ok(_) => close(app),
Err(e) => report(app, e.clone()),
match commit_fill(app) {
Ok(v) => return Ok(v),
Err(e) => {
report(app, e.clone());
return Err(e);
}
}
return r.map(|v| json!({"committed": true, "result": v}));
}
Ok(app.distort.caf.as_ref().map(CafWorkspace::describe).unwrap_or(Value::Null))
}
@@ -105,6 +109,9 @@ pub fn control(app: &mut PhotocraftApp, ui: &Value) -> Result<Value, String> {
/// Pointer in document coordinates (from the view or the control channel).
pub fn pointer(app: &mut PhotocraftApp, ev: ToolEvent, mods: egui::Modifiers) {
let Some(w) = app.distort.caf.as_mut() else { return };
if w.pending_fill.is_some() {
return;
}
match (w.tool, ev) {
(CafTool::Brush, ToolEvent::Down { x, y, .. }) => w.begin_stroke([x, y], mods.alt),
(CafTool::Brush, ToolEvent::Move { x, y, .. }) => {
@@ -149,7 +156,7 @@ pub fn pointer(app: &mut PhotocraftApp, ev: ToolEvent, mods: egui::Modifiers) {
}
pub fn keys(app: &mut PhotocraftApp, ctx: &egui::Context) {
if crate::color_picker_ui::any_open(app) {
if app.distort.caf.as_ref().is_some_and(|w| w.pending_fill.is_some()) || crate::color_picker_ui::any_open(app) {
return;
}
let cmd_shift = egui::Modifiers::COMMAND | egui::Modifiers::SHIFT;
+78 -5
View File
@@ -1,5 +1,6 @@
use super::preview::{Base, Preview, cancel_preview, compute_base, plan_params, points_limit, rebase, refresh};
use super::{CMD, CafOpts, CafTool, CafWorkspace, MAX_CAF_EDITS, MAX_CAF_POINTS, PROXY_SIDE, PhotocraftApp, REMEMBERED, Rect, Step, Value};
use super::{JobEvent, JobId, JobOutcome, PendingFill, json};
/// Opens the workspace on the active layer and its selection.
pub fn open(app: &mut PhotocraftApp) -> Result<(), String> {
@@ -7,6 +8,7 @@ pub fn open(app: &mut PhotocraftApp) -> Result<(), String> {
return Err("Content-Aware Fill needs a selection on a pixel layer".into());
}
let st = app.session.active().ok_or("no document")?;
let document = st.doc.id;
let layer = st.active_layer.ok_or("no active layer")?;
let canvas = st.doc.bounds();
let revision = st.revision;
@@ -18,6 +20,7 @@ pub fn open(app: &mut PhotocraftApp) -> Result<(), String> {
let _ = opts.apply(saved);
}
let mut w = CafWorkspace {
document,
layer,
layer_name: name,
canvas,
@@ -51,6 +54,7 @@ pub fn open(app: &mut PhotocraftApp) -> Result<(), String> {
center: [f64::from(canvas.x0 + canvas.x1) / 2.0, f64::from(canvas.y0 + canvas.y1) / 2.0],
hover: None,
preview: Preview::default(),
pending_fill: None,
error: None,
};
w.brush_add = w.opts.sampling == "custom";
@@ -79,13 +83,24 @@ fn remember(app: &mut PhotocraftApp, opts: &CafOpts) {
/// Apply: fill with the current state (one history step); the workspace stays open.
pub fn apply(app: &mut PhotocraftApp) -> Result<Value, String> {
let Some(w) = app.distort.caf.as_mut() else { return Err("Content-Aware Fill is not open".into()) };
if w.pending_fill.is_some() {
return Err("Content-Aware Fill is still processing".into());
}
w.end_stroke();
w.pressed = false;
let p = plan_params(w, true);
let opts = w.opts.clone();
remember(app, &opts);
let r = app.run(CMD, p);
if r.is_ok() {
refresh(app);
match &r {
Ok(v) if v.get("pending").and_then(Value::as_bool) == Some(true) => {
let job = v.get("job").and_then(Value::as_u64).map(JobId).ok_or("background Content-Aware Fill returned no job id")?;
if let Some(w) = app.distort.caf.as_mut() {
w.pending_fill = Some(PendingFill { job, close_on_success: false });
}
}
Ok(_) => refresh(app),
Err(_) => {}
}
r
}
@@ -94,9 +109,63 @@ pub fn apply(app: &mut PhotocraftApp) -> Result<Value, String> {
/// leaves the workspace open with the error in its panel, so the areas can be fixed and OK
/// pressed again instead of the work being thrown away.
pub fn commit(app: &mut PhotocraftApp) {
match apply(app) {
Ok(_) => close(app),
Err(e) => report(app, e),
if let Err(e) = commit_fill(app) {
report(app, e);
}
}
/// The control channel's OK result; a pending result is accepted, not yet committed.
pub(super) fn commit_fill(app: &mut PhotocraftApp) -> Result<Value, String> {
let r = apply(app)?;
if r.get("pending").and_then(Value::as_bool) == Some(true) {
let job = r.get("job").and_then(Value::as_u64).map(JobId).ok_or("background Content-Aware Fill returned no job id")?;
let pending =
app.distort.caf.as_mut().and_then(|w| w.pending_fill.as_mut()).filter(|p| p.job == job).ok_or("Content-Aware Fill job is no longer pending")?;
pending.close_on_success = true;
Ok(json!({"committed": false, "pending": true, "job": job.0}))
} else {
close(app);
Ok(json!({"committed": true, "result": r}))
}
}
/// A background fill ended (see `jobs_ui::on_event`). Only the job this workspace started on its
/// own document counts. A failed or cancelled fill keeps the workspace open with the reason in
/// its panel, as a failed synchronous OK does; a successful OK closes it, a successful Apply
/// refreshes it.
pub(crate) fn on_job_event(app: &mut PhotocraftApp, e: &JobEvent) {
if e.command != CMD {
return;
}
let Some(w) = app.distort.caf.as_mut() else { return };
let Some(pending) = w.pending_fill.filter(|p| p.job == e.id) else { return };
w.pending_fill = None;
if e.document != Some(w.document) {
return;
}
match &e.outcome {
JobOutcome::Done(_) => {}
JobOutcome::Failed(err) => {
w.error = Some(err.clone());
return;
}
JobOutcome::Cancelled => {
w.error = Some("cancelled".into());
return;
}
}
let document = w.document;
// Another document is active: the workspace is dropped with it (`distort_ui::drop_foreign`).
if !app.session.active().is_some_and(|st| st.doc.id == document) {
return;
}
if pending.close_on_success {
close(app);
} else {
if let Some(w) = app.distort.caf.as_mut() {
w.error = None;
}
refresh(app);
}
}
@@ -113,7 +182,11 @@ pub(super) fn report(app: &mut PhotocraftApp, e: String) {
pub fn cancel(app: &mut PhotocraftApp) {
if let Some(w) = app.distort.caf.as_ref() {
let opts = w.opts.clone();
let pending_job = w.pending_fill.map(|p| p.job);
remember(app, &opts);
if let Some(job) = pending_job {
app.session.cancel_job(job);
}
}
close(app);
}
+184
View File
@@ -1,5 +1,15 @@
use super::*;
fn finish_pending_job(app: &mut PhotocraftApp) {
let ctx = egui::Context::default();
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30);
while app.distort.caf.as_ref().is_some_and(|w| w.pending_fill.is_some()) {
crate::jobs_ui::tick(app, &ctx);
assert!(std::time::Instant::now() < deadline, "Content-Aware Fill job did not finish");
std::thread::sleep(std::time::Duration::from_millis(1));
}
}
/// A textured layer (a checker of two colours over a gradient) with a 20 px square selected.
fn app_with_selection() -> PhotocraftApp {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
@@ -165,6 +175,180 @@ fn a_failed_ok_keeps_the_workspace_open() {
assert!(app.session.active().unwrap().history.past_len() > steps, "and fills");
}
#[test]
fn a_background_apply_waits_for_success_and_rejects_a_second_apply() {
let mut app = app_with_selection();
app.background_jobs = true;
open(&mut app).unwrap();
let steps = app.session.active().unwrap().history.past_len();
let result = apply(&mut app).unwrap();
assert_eq!(result["pending"], true, "{result}");
let job = ws(&app).pending_fill.expect("the job is tracked").job;
let opts = ws(&app).opts.clone();
assert!(apply(&mut app).unwrap_err().contains("still processing"));
assert!(control(&mut app, &json!({"sampling": "rectangular"})).is_err());
assert_eq!(ws(&app).opts, opts, "an in-flight job keeps its captured settings");
assert_eq!(ws(&app).pending_fill.map(|p| p.job), Some(job));
finish_pending_job(&mut app);
assert!(app.distort.caf.is_some(), "Apply remains open after success");
assert!(ws(&app).pending_fill.is_none());
assert_eq!(app.session.active().unwrap().history.past_len(), steps + 1);
}
#[test]
fn background_ok_closes_only_after_the_fill_is_applied() {
let mut app = app_with_selection();
app.background_jobs = true;
open(&mut app).unwrap();
let steps = app.session.active().unwrap().history.past_len();
commit(&mut app);
let job = ws(&app).pending_fill.expect("OK records the pending job").job;
assert!(ws(&app).pending_fill.unwrap().close_on_success);
assert!(app.distort.caf.is_some(), "accepting an async fill does not close the workspace");
assert_eq!(app.session.active().unwrap().history.past_len(), steps);
commit(&mut app);
assert_eq!(ws(&app).pending_fill.map(|p| p.job), Some(job), "a repeated OK does not start a second job");
finish_pending_job(&mut app);
assert!(app.distort.caf.is_none(), "successful completion closes OK");
assert_eq!(app.session.active().unwrap().history.past_len(), steps + 1);
}
#[test]
fn control_ok_reports_pending_and_does_not_close_early() {
let mut app = app_with_selection();
app.background_jobs = true;
open(&mut app).unwrap();
let result = control(&mut app, &json!({"commit": true})).unwrap();
assert_eq!(result["committed"], false, "{result}");
assert_eq!(result["pending"], true, "{result}");
let job = JobId(result["job"].as_u64().unwrap());
assert_eq!(ws(&app).pending_fill.map(|p| p.job), Some(job));
assert!(ws(&app).pending_fill.unwrap().close_on_success);
assert!(app.distort.caf.is_some());
assert!(control(&mut app, &json!({"commit": true})).is_err());
assert_eq!(ws(&app).pending_fill.map(|p| p.job), Some(job));
finish_pending_job(&mut app);
assert!(app.distort.caf.is_none());
}
#[test]
fn cancelling_a_pending_fill_cancels_the_job_and_closes_the_workspace() {
let mut app = app_with_selection();
app.background_jobs = true;
open(&mut app).unwrap();
let result = apply(&mut app).unwrap();
let job = JobId(result["job"].as_u64().unwrap());
assert!(app.session.job(job).is_some_and(|j| j.state == "running"));
cancel(&mut app);
assert!(app.distort.caf.is_none());
assert!(app.session.job(job).is_none(), "cancelled jobs leave the running set");
assert!(app.session.jobs_with_recent().iter().any(|j| j.id == job && j.state == "cancelled"));
}
#[test]
fn cancel_button_remains_clickable_during_a_pending_fill() {
use egui_kittest::kittest::Queryable;
let mut app = app_with_selection();
app.background_jobs = true;
open(&mut app).unwrap();
let result = apply(&mut app).unwrap();
let job = JobId(result["job"].as_u64().unwrap());
let mut h = egui_kittest::Harness::builder().with_size(vec2(1600.0, 1000.0)).build_ui_state(
|ui, app: &mut PhotocraftApp| {
let ctx = ui.ctx().clone();
if ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
show(app, &ctx);
}
},
app,
);
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
h.run_steps(4);
assert_eq!(ws(h.state()).pending_fill.map(|p| p.job), Some(job));
// Exercise the actual footer interaction, not cancel() or the control endpoint.
h.get_by_label("Cancel").click();
h.run_steps(3);
assert!(h.state().distort.caf.is_none(), "the visible Cancel button closes the workspace while busy");
assert!(h.state().session.job(job).is_none());
assert!(h.state().session.jobs_with_recent().iter().any(|j| j.id == job && j.state == "cancelled"));
}
#[test]
fn failed_cancelled_and_stale_jobs_do_not_close_a_caf_workspace() {
let mut app = app_with_selection();
open(&mut app).unwrap();
let document = ws(&app).document;
let job = JobId(71);
app.distort.caf.as_mut().unwrap().pending_fill = Some(PendingFill { job, close_on_success: true });
let mut event = JobEvent {
id: JobId(70),
command: CMD.into(),
label: "Content-Aware Fill".into(),
document: Some(document),
outcome: JobOutcome::Done(Value::Null),
error: None,
};
on_job_event(&mut app, &event);
assert_eq!(ws(&app).pending_fill.map(|p| p.job), Some(job), "a different job is ignored");
event.id = job;
event.outcome = JobOutcome::Cancelled;
on_job_event(&mut app, &event);
assert!(app.distort.caf.is_some());
assert!(ws(&app).pending_fill.is_none());
assert_eq!(ws(&app).error.as_deref(), Some("cancelled"));
app.distort.caf.as_mut().unwrap().pending_fill = Some(PendingFill { job: JobId(72), close_on_success: true });
event.id = JobId(72);
event.outcome = JobOutcome::Failed("fill failed".into());
on_job_event(&mut app, &event);
assert!(app.distort.caf.is_some());
assert!(ws(&app).pending_fill.is_none());
assert_eq!(ws(&app).error.as_deref(), Some("fill failed"));
app.distort.caf.as_mut().unwrap().pending_fill = Some(PendingFill { job: JobId(73), close_on_success: true });
cancel(&mut app);
open(&mut app).unwrap();
event.id = JobId(73);
event.document = Some(ws(&app).document);
event.outcome = JobOutcome::Done(Value::Null);
on_job_event(&mut app, &event);
assert!(app.distort.caf.is_some(), "an old job cannot close a later workspace");
assert!(ws(&app).pending_fill.is_none());
}
#[test]
fn a_success_for_an_inactive_document_does_not_close_its_workspace() {
let mut app = app_with_selection();
open(&mut app).unwrap();
crate::distort_ui::drop_foreign(&mut app);
let document = ws(&app).document;
let job = JobId(74);
app.distort.caf.as_mut().unwrap().pending_fill = Some(PendingFill { job, close_on_success: true });
app.session.execute("file.new", json!({"width": 32, "height": 32, "depth": 8})).unwrap();
let event = JobEvent {
id: job,
command: CMD.into(),
label: "Content-Aware Fill".into(),
document: Some(document),
outcome: JobOutcome::Done(Value::Null),
error: None,
};
on_job_event(&mut app, &event);
assert!(app.distort.caf.is_some(), "completion for the inactive document does not close another dialog");
assert!(ws(&app).pending_fill.is_none());
crate::distort_ui::drop_foreign(&mut app);
assert!(app.distort.caf.is_none(), "the existing document-switch lifecycle drops the old workspace");
}
/// Undo or Redo of a sampling stroke changes what OK would fill, so it clears the error a
/// failed OK left in the panel, as a new stroke does; otherwise the stale error would stay
/// drawn over the recovered preview.
+20 -8
View File
@@ -202,6 +202,9 @@ fn caf_props_panel(
let o = [("current".to_string(), tl!("Current Layer")), ("new".to_string(), tl!("New Layer")), ("duplicate".to_string(), tl!("Duplicate Layer"))];
widgets::dropdown(ui, "caf-output", tl!("Output To"), &mut w.opts.output, &o, 140.0);
});
if w.pending_fill.is_some() {
ui.label(tl!("Working…"));
}
if let Some(e) = w.error.as_ref().or(w.preview.error.as_ref()) {
ui.label(egui::RichText::new(e.as_str()).color(t.danger).size(11.0));
}
@@ -239,11 +242,11 @@ fn caf_preview_panel(ui: &mut egui::Ui, painter: &egui::Painter, t: &Tokens, w:
ui.put(sp, egui::Spinner::new().size(16.0));
}
let presp = ui.interact(pv_area, egui::Id::unique("caf-preview-view"), Sense::click_and_drag());
if presp.dragged() {
if w.pending_fill.is_none() && presp.dragged() {
let d = presp.drag_delta();
w.preview.center = [w.preview.center[0] - f64::from(d.x / pv.zoom), w.preview.center[1] - f64::from(d.y / pv.zoom)];
}
if presp.hovered() {
if w.pending_fill.is_none() && presp.hovered() {
let scroll = ui.input(|i| i.smooth_scroll_delta.y);
if scroll != 0.0 {
w.preview.zoom = (w.preview.zoom * (scroll / 200.0).exp()).clamp(0.01, 32.0);
@@ -281,11 +284,18 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
let mut dragging = false;
egui::Area::new(egui::Id::unique("caf-workspace")).order(egui::Order::Foreground).fixed_pos(screen.min).show(ctx, |ui| {
let Some(w) = app.distort.caf.as_mut() else { return };
let busy = w.pending_fill.is_some();
let before = w.opts.clone();
w.texture_limit = ctx.input(|i| i.max_texture_side);
let (full, _) = ui.allocate_exact_size(screen.size(), Sense::hover());
let painter = ui.painter().clone();
painter.rect_filled(full, 0.0, t.chrome);
// Create Cancel before disabling its parent so a pending job stays cancellable.
let foot = ERect::from_min_size(pos2(full.right() - PANEL_W + 10.0, full.bottom() - 48.0), vec2(PANEL_W - 20.0, 32.0));
let mut fb = ui.new_child(egui::UiBuilder::new().max_rect(foot).layout(egui::Layout::right_to_left(egui::Align::Center)));
if busy {
ui.disable();
}
// Title strip.
let title = ERect::from_min_size(full.min, vec2(full.width(), 30.0));
painter.rect_filled(title, 0.0, t.dock);
@@ -329,11 +339,12 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
.show(&mut props, |ui| caf_props_panel(ui, w, &t, &mut reset_what, &mut new_sampling, &mut rebase_needed));
// Footer, in Photoshop's order on every platform: reset all at the left, then OK, Apply,
// Cancel against the right edge.
let foot = ERect::from_min_size(pos2(right.left() + 10.0, right.bottom() - 48.0), vec2(PANEL_W - 20.0, 32.0));
let mut fb = ui.new_child(egui::UiBuilder::new().max_rect(foot).layout(egui::Layout::right_to_left(egui::Align::Center)));
if widgets::secondary_button(&mut fb, tl!("Cancel"), 70.0).clicked() {
action = Some("cancel");
}
if busy {
fb.disable();
}
if widgets::secondary_button(&mut fb, tl!("Apply"), 70.0).clicked() {
action = Some("apply");
}
@@ -355,7 +366,7 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
w.zoom = ((area.width() - 40.0) / cw).min((area.height() - 40.0) / chh).clamp(0.01, 4.0);
}
let resp = ui.interact(area, egui::Id::unique("caf-view"), Sense::click_and_drag());
if resp.hovered() {
if !busy && resp.hovered() {
let scroll = ui.input(|i| i.smooth_scroll_delta.y);
if scroll != 0.0
&& let Some(hp) = resp.hover_pos()
@@ -410,10 +421,11 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
clip.rect_stroke(img, 0.0, Stroke::new(1.0, t.separator), egui::StrokeKind::Outside);
// Mouse → tools (Space, the middle button or the Hand pan).
let pan = ui.input(|i| i.key_down(egui::Key::Space) || i.pointer.middle_down()) || w.tool == CafTool::Hand;
if pan && resp.dragged() {
if !busy && pan && resp.dragged() {
let dl = resp.drag_delta();
w.center = [w.center[0] - f64::from(dl.x / w.zoom), w.center[1] - f64::from(dl.y / w.zoom)];
} else if !pan
} else if !busy
&& !pan
&& resp.is_pointer_button_down_on()
&& let Some(pp) = resp.interact_pointer_pos()
{
@@ -430,7 +442,7 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
}
dragging = true;
}
if w.pressed && !resp.is_pointer_button_down_on() {
if !busy && w.pressed && !resp.is_pointer_button_down_on() {
w.pressed = false;
let q = w.hover.unwrap_or(w.center);
events.push(ToolEvent::Up { x: q[0], y: q[1] });
+1
View File
@@ -608,6 +608,7 @@ fn on_event(app: &mut PhotocraftApp, ctx: &egui::Context, e: JobEvent) {
true
}
});
crate::caf_ui::on_job_event(app, &e);
// A Free Transform commit's session ends with its job (then reported like any job).
crate::transform_tool::on_job_event(app, &e);
if crate::prefs_ui::on_recovery_event(app, &e) {