Merge pull request #6342 from christianlappin/codex/fix-6322-rotate-view-mcp

MCP: handle Rotate View gestures in the desktop canvas
This commit is contained in:
BFlat
2026-11-10 20:10:24 +07:00
committed by GitHub
10 changed files with 359 additions and 9 deletions
+15 -1
View File
@@ -4191,7 +4191,21 @@ every document they read except a native file and the native document that an SV
`view.rotate {angle}` (desktop app) turns the view to `angle` degrees about the center of the canvas; a positive angle
turns the art clockwise on screen. View › Rotate View and the status bar's angle menu run it. It returns `{angle}`, the
angle it set, normalized to (-180, 180], and `view.rotateReset` turns the view back to 0.
angle it set, normalized to (-180, 180], and `view.rotateReset` turns the view back to 0, returning `null` on success.
Select the Rotate View Tool with `select_tool` and the tool id `rotateView`. Its `pointer_gesture`
drags turn the canvas about its center; Shift snaps to 15°. Document coordinates for a rotation
gesture use the view at the initial down event, including when the gesture spans several calls.
The control channel rejects malformed rotation packets without changing the angle and cancels
the current press. Start a new down event after an error.
Reset Rotate View is the command `view.rotateReset`:
```json
{"name":"select_tool","arguments":{"tool":"rotateView"}}
{"name":"pointer_gesture","arguments":{"events":[{"kind":"down","x":300,"y":150},{"kind":"drag","x":200,"y":250},{"kind":"up","x":200,"y":250}]}}
{"name":"command_run","arguments":{"id":"view.rotateReset","params":{}}}
```
`view.rotateToSelection` (desktop app, View › Rotate View to Selection) turns the view about the center of the canvas to
the angle the selected objects share (`selectionRotation` in `document.inspect`, 0 when their angles differ), so their
bounding box is square to the window. It returns `{angle}`, and with nothing selected it returns "nothing selected".