mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-03 06:30:00 -06:00
G1: Pin grid dialog bounds to canvas click via reference locator (#1377)
Store the click as __anchorX/__anchorY and recompute x/y when the locator opens or changes so the chosen point stays on the click like Illustrator. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
bflatastic
co-authored by
Cursor
parent
699e6e9af4
commit
f12ad3aa0a
@@ -159,6 +159,17 @@ fn key_frame(app: &mut VectorcraftApp, key: egui::Key) {
|
||||
out.textures_delta.clear();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rectangular_grid_reference_locator_reanchors_to_the_click() {
|
||||
let mut app = app();
|
||||
click(&mut app, Point::new(100.0, 100.0));
|
||||
set(&mut app, "reference", json!(4));
|
||||
super::shapes::grid_pin_to_anchor(app.ui.dialog.as_mut().unwrap());
|
||||
assert_eq!((field(&app, "x"), field(&app, "y")), (json!(50.0), json!(50.0)));
|
||||
let id = confirm(&mut app);
|
||||
assert_grid(&app, id, Rect::new(50.0, 50.0, 150.0, 150.0), 5, 5);
|
||||
}
|
||||
|
||||
/// #1377: OK uses the bounding box after a reference-point resize (`artboard_rect` keeps the
|
||||
/// center pinned when width doubles).
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user