Toggle layer properties from resolution row
This commit is contained in:
parent
9940efd0ac
commit
ec656f85cd
|
|
@ -602,7 +602,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "canvas-pilot"
|
||||
version = "0.10.3"
|
||||
version = "0.10.4"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"craft-dwg",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ default-members = ["crates/canvas-pilot"]
|
|||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.10.3"
|
||||
version = "0.10.4"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/canvas-pilot"
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ impl Editor {
|
|||
self.output_draft = Some(d);
|
||||
}
|
||||
}
|
||||
pub(super) fn finish_crop_edit(&mut self) {
|
||||
fn request_formats_close(&mut self) {
|
||||
if let Some(draft) = self
|
||||
.format_draft
|
||||
.as_mut()
|
||||
|
|
@ -294,6 +294,23 @@ impl Editor {
|
|||
} else {
|
||||
self.format_draft = None;
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn toggle_layer_properties(&mut self, layer: usize) {
|
||||
if self
|
||||
.format_draft
|
||||
.as_ref()
|
||||
.is_some_and(|draft| draft.is_for(layer))
|
||||
{
|
||||
self.request_formats_close();
|
||||
} else {
|
||||
self.property_tab = PropertyTab::Layer;
|
||||
self.format_draft = Some(FormatDraft::new(&self.layout, layer));
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn finish_crop_edit(&mut self) {
|
||||
self.request_formats_close();
|
||||
self.edit_content = false;
|
||||
self.edit_mask = false;
|
||||
self.alt_mask = false;
|
||||
|
|
|
|||
|
|
@ -1882,8 +1882,7 @@ impl Editor {
|
|||
palette.text,
|
||||
);
|
||||
if click(ui, &ink, [0.0, 203.0, w, 34.0], "open-formats") {
|
||||
self.property_tab = PropertyTab::Layer;
|
||||
self.format_draft = Some(FormatDraft::new(&self.layout, i));
|
||||
self.toggle_layer_properties(i);
|
||||
}
|
||||
if let Some(mode) = self.layout.formats().layer_fit[i] {
|
||||
ink.text(
|
||||
|
|
@ -8845,6 +8844,30 @@ mod tests {
|
|||
assert_eq!(app.project(), before);
|
||||
}
|
||||
#[test]
|
||||
fn selected_layer_resolution_row_toggles_layer_properties() {
|
||||
let ctx = egui::Context::default();
|
||||
let mut app = Editor::default();
|
||||
let i = app.layout.selected().unwrap();
|
||||
let geometry = app.layout.layers()[i];
|
||||
let label = format!(
|
||||
"{} × {} px / {}",
|
||||
number(geometry.width),
|
||||
number(geometry.height),
|
||||
ratio_ui::label(geometry.width / geometry.height)
|
||||
);
|
||||
|
||||
click_text(&mut app, &ctx, &label);
|
||||
assert!(
|
||||
app.format_draft
|
||||
.as_ref()
|
||||
.is_some_and(|draft| draft.is_for(i))
|
||||
);
|
||||
assert_eq!(app.property_tab, PropertyTab::Layer);
|
||||
|
||||
click_text(&mut app, &ctx, &label);
|
||||
assert!(app.format_draft.is_none());
|
||||
}
|
||||
#[test]
|
||||
fn snapped_move_and_resize_stay_snapped_on_release_and_undo_as_one_edit() {
|
||||
for resize in [false, true] {
|
||||
for zoom in [0.75, 1.0] {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### v0.10.4
|
||||
|
||||
- Make the selected layer's resolution row toggle its Layer properties window:
|
||||
click once to open it and again to close it, preserving the existing review
|
||||
prompt when the window contains unapplied edits.
|
||||
|
||||
### v0.10.3
|
||||
|
||||
- Tighten the selected-layer inspector spacing around crop, measurement, geometry
|
||||
|
|
|
|||
Loading…
Reference in New Issue