Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

New Document dialog: orientation toggle, size presets, and a guard against 0-size documents

未關閉
#4,843 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
38/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust
領域
design, frontend

研究方向

Start in editor/src/messages/dialog/new_document_dialog/ and read how the dialog stores W/H, handles Infinite Canvas, and submits dimensions. The request specifies orientation toggling, screen and paper presets, and a 1 px minimum; keep changes within the dialog as described. Done means the controls behave as specified and submission creates a nonzero artboard when Infinite Canvas is off.

由索引模型根據 Issue 內容生成。

描述

The New Document dialog (editor/src/messages/dialog/new_document_dialog/) currently has a name field, an Infinite Canvas checkbox, and W/H inputs. I'd like to propose a few small quality-of-life improvements that live entirely inside the dialog. PortfolioMessage::NewDocumentWithName, GraphOperationMessage::NewArtboard and the rest of Submit would stay as they are.

1. Portrait / Landscape toggle

An "Orientation" row with a two-option Portrait / Landscape radio, replacing the need to swap W and H by hand. The active option follows the dimensions (landscape when W > H). Clicking the inactive one swaps W and H, so one click toggles. A small swap button between W and H does the same toggle, for people who think in terms of swapping the two numbers. All of these are disabled while Infinite Canvas is checked, and the radio is also disabled for square sizes.

New Document dialog prototype: A4 portrait, A4 landscape, preset dropdown open, Infinite Canvas checked

A plain swap-dimensions button was already attempted in #4138, which was closed in the backlog cleanup (#4647) rather than for a problem with the idea. Bot review feedback there was only that it should be disabled in infinite-canvas mode. I think a labeled toggle that shows the current orientation is clearer than an unlabeled swap icon, but I'm happy to go with only an icon button if you prefer.

2. Size presets

A dropdown above Dimensions with common sizes:

  • Screen: 1920x1080, 1280x720, 3840x2160, 1080x1080
  • Paper: A3, A4, A5, Letter

Picking one fills W/H in the current orientation. A preset stays selected when the orientation is toggled, and editing W/H by hand switches the dropdown to "Custom". Presets are plain dialog state and never reach the document code. Paper sizes are pixel values at an assumed 96 DPI (CSS px), which is open to discussion.

3. Guard against 0-size documents

W and H currently have a minimum of 0. If either is 0 with Infinite Canvas off, Submit skips creating the artboard (self.dimensions.x > 0 && self.dimensions.y > 0), so the user silently gets an empty document with no artboard. I'd raise the minimum to 1, so a typed 0 clamps to 1 px. Open to disabling OK instead if you prefer.

Related
  • Enter doesn't confirm the dialog after editing values (#3601). I'd be glad to include a fix for this in the same PR, since it's the same dialog.
  • Footer button mnemonics (#3605), which touches the same dialog.
Willingness to implement

I'd like to implement this myself if you approve. I already have a working prototype (about 80 lines, all inside new_document_dialog/), so the screenshot is the real dialog. I know the backlog is tight for 1.0, so I'd keep the PR small and dialog-only, with before/after screenshots. If you'd like it split (for example the guard and orientation toggle first, presets after), I'm happy to do that.

The mockup screenshots are generated with the help of AI.

主要語言
Rust
星號
27.8k
分支
1.3k
平均合併
17 小時 32 分鐘
30 天內合併 PR
171

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

GraphiteEditor/Graphite 的其他 Issue

查看 GraphiteEditor/Graphite 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。