mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
Place: closing a background document keeps the active document's place cursor
This commit is contained in:
1 parent
c8f105dd65
commit
7f0c2818f2
2 files changed
+15
-1
No files matched your search
@@ -608,7 +608,10 @@ impl Session {
|
||||
recovery::discard_document(self, i, recovery_dir.as_deref());
|
||||
}
|
||||
if i < self.docs.len() {
|
||||
self.unload_place_cursor();
|
||||
// A background document's closing leaves the active document's place cursor alone.
|
||||
if self.active == Some(i) {
|
||||
self.unload_place_cursor();
|
||||
}
|
||||
self.reset_find_scope();
|
||||
self.docs.remove(i);
|
||||
self.active = if self.docs.is_empty() { None } else { Some(i.min(self.docs.len() - 1)) };
|
||||
|
||||
@@ -2558,6 +2558,17 @@ fn changing_documents_unloads_the_place_cursor_and_its_tool() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Closing a background document leaves the active document's place cursor loaded.
|
||||
#[test]
|
||||
fn closing_a_background_document_keeps_the_place_cursor() {
|
||||
let mut s = session();
|
||||
s.execute("file.new", &json!({})).unwrap();
|
||||
load_test_images(&mut s, 2);
|
||||
s.close_document(0);
|
||||
assert!(s.loaded.is_some() && s.loaded_queue.len() == 1);
|
||||
assert_eq!(s.tool_id(), "placeGun");
|
||||
}
|
||||
|
||||
/// Issue #1637: with several objects selected, a click on one of them (no drag) makes it the key
|
||||
/// object, and Align to Key Object leaves it in place. A second click on it drops the key.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user