mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 19:51:26 -05:00
3D panel: the one-step edits of a pass are one undo step to where the last left them, and the light sphere writes each arrow from where the one before left the light, so Down then Up in one frame lands back at 90 degrees; the handle tests show the 3D panel, as its handles need
This commit is contained in:
@@ -423,9 +423,12 @@ pub(crate) fn sphere(ui: &mut egui::Ui, fields: &mut DialogFields, cx: &mut Cust
|
||||
if let Some(index) = out.picked {
|
||||
select(fields, index);
|
||||
}
|
||||
// What each event leaves in the lights, a cancel's restored start included.
|
||||
// What each event leaves in the lights, a cancel's restored start included, each from where the one before left
|
||||
// them (Down then Up in one pass lands back where it began).
|
||||
let mut from = list.clone();
|
||||
for lights in out.edit.events.iter().filter_map(|event| event.landed()) {
|
||||
write_moved(fields, &list, lights);
|
||||
write_moved(fields, &from, lights);
|
||||
from.clone_from(lights);
|
||||
}
|
||||
let current = selected(fields, list.len());
|
||||
let behind = list.get(current).is_some_and(|l| l.behind);
|
||||
|
||||
@@ -763,7 +763,11 @@ fn the_graphics_frame_is_built_once_for_each_revision() {
|
||||
}
|
||||
|
||||
/// `app` with the graphics' handles over an 800 × 600 canvas, and the handle the trial reads the app through.
|
||||
fn handles_fixture(app: VectorcraftApp) -> (Rc<RefCell<VectorcraftApp>>, Fixture) {
|
||||
fn handles_fixture(mut app: VectorcraftApp) -> (Rc<RefCell<VectorcraftApp>>, Fixture) {
|
||||
// The handles show while the 3D and Materials panel shows its Materials tab.
|
||||
if !crate::panel_docking::visible(&app, super::ID) {
|
||||
app.run("window.panel", json!({ "panel": super::ID })).unwrap();
|
||||
}
|
||||
let app = Rc::new(RefCell::new(app));
|
||||
let drawn = Rc::clone(&app);
|
||||
let mut fixture = Fixture::new(move |ui| {
|
||||
|
||||
@@ -242,6 +242,8 @@ pub(crate) fn send(app: &mut VectorcraftApp, changed: Map<String, Value>, phase:
|
||||
/// document moved under the gesture, or the panel was removed (the gesture commits as one step).
|
||||
pub(crate) fn apply(app: &mut VectorcraftApp, params: &[Param], input: &DialogFields, events: &EditEvents<DialogFields>) {
|
||||
let settings = |fields: &DialogFields| Value::Object(form::json_of(params, fields));
|
||||
// The one-step changes of a pass (several key presses in one frame) are one undo step, to where the last left them.
|
||||
let mut set = None;
|
||||
for event in events {
|
||||
match event {
|
||||
EditEvent::Begin { id, .. } => {
|
||||
@@ -259,7 +261,7 @@ pub(crate) fn apply(app: &mut VectorcraftApp, params: &[Param], input: &DialogFi
|
||||
let changed = changed_settings(&app.three_d.before, &settings(after));
|
||||
send(app, changed, Live::Released);
|
||||
}
|
||||
EditEvent::Set { after, .. } => send(app, changed_settings(&settings(input), &settings(after)), Live::Released),
|
||||
EditEvent::Set { after, .. } => set = Some(after),
|
||||
EditEvent::Cancel { reason, .. } => {
|
||||
if matches!(reason, CancelReason::Removed) || reason.document_moved() {
|
||||
send(app, Map::new(), Live::Released);
|
||||
@@ -270,6 +272,9 @@ pub(crate) fn apply(app: &mut VectorcraftApp, params: &[Param], input: &DialogFi
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if let Some(after) = set {
|
||||
send(app, changed_settings(&settings(input), &settings(after)), Live::Released);
|
||||
}
|
||||
}
|
||||
|
||||
/// The 3D and Materials panel.
|
||||
|
||||
Reference in New Issue
Block a user