Slides element positioning: move, reorder#26
Conversation
Add the positioning primitives so the create-* elements (text box, table, image) -- which land at default positions -- can be laid out: - slides move <preso> <objectId> --x <pt> --y <pt> [--scale-x N --scale-y N]: updatePageElementTransform in ABSOLUTE mode. Sets position/scale outright (no read of the current transform needed). Points -> EMU. Non-finite / out-of-range geometry and non-positive scale are rejected (exit 2). - slides reorder <preso> <objectId> --to front|back|forward|backward: updatePageElementsZOrder (BRING_TO_FRONT / SEND_TO_BACK / BRING_FORWARD / SEND_BACKWARD). An unknown direction is a usage error (exit 2). Both are additive .edit writes with --dry-run/--json. 4 wiring tests (transform verb/endpoint/body incl. EMU translate; the non-finite guard; z-order op mapping; the bad-direction guard). SKILL.md documents both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
There was a problem hiding this comment.
Code Review
This pull request adds two new subcommands to the gog slides tool: move (for setting a slide element's absolute position and scale) and reorder (for changing its z-order). It also includes documentation updates and comprehensive unit tests. The feedback suggests an improvement to the move command's validation logic to allow negative scale factors, which are valid in Google Slides for reflecting or flipping elements, rather than restricting them to strictly positive values.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
#26) Negative scale factors are valid in Slides (they reflect/flip an element), so the strictly-positive guard was too restrictive. Require finite and non-zero instead: allows flipping, still rejects zero (degenerate/singular matrix) and non-finite (would trap the JSON encoder). Matches Gemini's suggested diff. Adds tests that a negative --scale-x is accepted and zero is rejected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40b7f6c8e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex correctly flagged that ABSOLUTE updatePageElementTransform replaces the whole transform, so `move` stripped an element's rotation/shear (omitted -> 0) and reset its scale to 1 when --scale was omitted -- wrong for "reposition an existing element." move now first reads the element's current transform and preserves its scale/shear, changing only the position (and scale when --scale-x/--scale-y are given; those stay optional and still allow negative for a flip). An unknown objectId is a clean usage error (exit 2). --scale-x/--scale-y are now optional (omit = keep current). Rewrote the move wiring test to assert preservation (scale + shear kept, position set) via a decoded body so it doesn't depend on float formatting; updated the negative-scale test to supply the element in the read response. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
Continues the Docs/Slides authoring roadmap (after #23–#25 added the "add any element" surface). The
create-*commands (create-textbox/create-table/create-image) place elements at Slides' default position; this adds the positioning primitives to lay them out.New commands
slides move <preso> <objectId> --x <pt> --y <pt> [--scale-x N --scale-y N].editpresentations.batchUpdate(updatePageElementTransform, ABSOLUTE)slides reorder <preso> <objectId> --to front|back|forward|backward.editpresentations.batchUpdate(updatePageElementsZOrder)Notes
movesets the element's transform in ABSOLUTE mode — position (and optional scale) are set outright, so no read of the current transform is needed. Positions are in points (→ EMU; 1 pt = 12700). Non-finite / out-of-range--x/--yand non-positive--scale-x/--scale-yare rejected (exit 2). Because ABSOLUTE replaces the transform, omitting--scale-*resets scale to 1 — fine forcreate-*elements, which are already scale 1.reordermaps--to→BRING_TO_FRONT/SEND_TO_BACK/BRING_FORWARD/SEND_BACKWARD; an unknown direction is a usage error (exit 2).slides read-slide. Both are.edit, with--dry-run/--json.Tests
4 wiring tests:
moveverb/endpoint/body (incl. the EMU translate); the non-finite--xguard;reorderz-order op mapping; and the bad---toguard. SKILL.md documents both.🤖 Generated with Claude Code
https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
Generated by Claude Code