Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

refactor(ui): name the Move layer offset shown_layer_offset

Skyfuller1303bc947f667ad3
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index db0efe31f..15391e1a8 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -4487,7 +4487,7 @@ pub(crate) fn layer_edges_rect(app: &PhotocraftApp, idx: usize) -> Option<photoc
if b.is_empty() {
return None;
}
- let (dx, dy) = crate::move_ui::shown_offset(app, st.doc.id, st.revision, id).unwrap_or((0, 0));
+ let (dx, dy) = crate::move_ui::shown_layer_offset(app, st.doc.id, st.revision, id).unwrap_or((0, 0));
Some(b.translate(dx, dy))
}
diff --git a/crates/ui-egui/src/move_ui.rs b/crates/ui-egui/src/move_ui.rs
index fb49b0247..c8af5c255 100644
--- a/crates/ui-egui/src/move_ui.rs
+++ b/crates/ui-egui/src/move_ui.rs
@@ -174,7 +174,7 @@ fn with_descendants(doc: &Document, ids: &[LayerId]) -> Vec<LayerId> {
/// offset of the latest Move drag frame drawn ([`display_doc`]) when the layer moves with the drag,
/// so its Layer Edges outline moves in lockstep with its pixels (#2413). `None` when it shows
/// where it is.
-pub(crate) fn shown_offset(app: &PhotocraftApp, doc: DocId, revision: u64, id: LayerId) -> Option<(i32, i32)> {
+pub(crate) fn shown_layer_offset(app: &PhotocraftApp, doc: DocId, revision: u64, id: LayerId) -> Option<(i32, i32)> {
let p = app.move_preview.as_ref().filter(|p| p.doc == doc && p.revision == revision && !p.floating && p.shown.is_some())?;
if !p.moving.contains(&id) {
return None;