feat: view.apply restores a named view or camera; MCP screenshot takes a named view or camera (#528) (#595)
New view.apply command restores a named view, a standard view or any camera (view state, not an undo step); the desktop viewport follows it and the browser's Restore uses it. The MCP screenshot tool takes a named view or a camera. Un-ignores the #528 regression test. Fixes #528. Co-authored-by: jonaswre <jonas.wrede@beyondit.gmbh>
This commit is contained in:
1 parent
e67cc0c747
commit
27f20f97cb
11 files changed
+159
-23
No files matched your search
@@ -884,6 +884,21 @@ impl SolveApp {
|
||||
self.pending_fit = request;
|
||||
}
|
||||
|
||||
/// Move the viewport to the camera a command asked for (`view.apply`): animated like a view
|
||||
/// change, or at once (control requests, so a screenshot right after shows it).
|
||||
pub fn follow_view_request(&mut self, animate: bool) {
|
||||
let Some(mut to) = self.session.camera.take() else { return };
|
||||
to.up = self.cam.up;
|
||||
if animate {
|
||||
self.animate_to(to);
|
||||
} else if to.is_valid() {
|
||||
self.cancel_view_animation();
|
||||
self.viewport.orbit_snap = None;
|
||||
self.viewport.orbit_free = None;
|
||||
self.cam = to;
|
||||
}
|
||||
}
|
||||
|
||||
/// Stop any view animation where it is (the user took over the camera).
|
||||
pub fn cancel_view_animation(&mut self) {
|
||||
self.pending_fit = None;
|
||||
@@ -930,6 +945,7 @@ impl SolveApp {
|
||||
}
|
||||
self.step_view_animation(ctx);
|
||||
self.drain_control(ctx);
|
||||
self.follow_view_request(true);
|
||||
agent_cursor::step(self, ctx);
|
||||
if !self.synthetic.is_empty() {
|
||||
ctx.request_repaint();
|
||||
|
||||
Reference in new issue
Block a user