Skip to content

widgets:new_document: add swap button to dims#4138

Open
xaiki wants to merge 1 commit into
GraphiteEditor:masterfrom
xaiki:swap-dims
Open

widgets:new_document: add swap button to dims#4138
xaiki wants to merge 1 commit into
GraphiteEditor:masterfrom
xaiki:swap-dims

Conversation

@xaiki
Copy link
Copy Markdown

@xaiki xaiki commented May 12, 2026

add a button to swap dimensions, essentially changing between portrait and landscape mode much more easily

Code written in cursor, less than 40 lines and carefully reviewed.
description written by human.
tested and working.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a feature to swap width and height dimensions in the 'New Document' dialog. It adds a SwapDimensions message variant, implements the swap logic using std::mem::swap, and adds an IconButton to the UI. The reviewer suggested disabling the swap button when the 'Infinite Canvas' option is enabled to maintain consistency with other dimension controls.

add a button to swap dimensions, essentially changing between portrait
and landscape mode much more easily

[edit]
disabled when infinite is selected.

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Confidence score: 4/5

  • This PR looks safe to merge with minimal risk: the reported issue is moderate-low severity (4/10) and appears limited to UI behavior consistency rather than a core functional break.
  • In editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs, the swap action remains enabled in Infinite Canvas mode even though width/height NumberInput controls are disabled, which can create confusing or non-applicable interactions for users.
  • Pay close attention to editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs - ensure the swap button is disabled when Infinite Canvas is selected to match the existing control-state logic.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs">

<violation number="1" location="editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs:138">
P2: The swap button should be disabled when 'Infinite Canvas' is selected, matching the behavior of the width/height `NumberInput` controls which are disabled in that mode. Swapping dimensions is not applicable for infinite canvas.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant