ゴミ箱をタップして一括削除する #48 - #49
Merged
Merged
Conversation
Clearing a workspace meant pressing ✕ on every row, and #44 folded that ✕ into a menu — so the fastest way to start over became one menu per block, which is not a thing a child will do. The can at the bottom already means "throw this away"; now a drop throws away the block you are holding and a tap offers to throw away the program. Different gestures, so they never collide, and the tap asks first. Being a Button is also what let the can stop being invisible. It had been accessibilityHidden since #30 because a drop target is nothing a VoiceOver user can operate; it can now say what it is and what it does. The confirmation is an alert rather than a confirmationDialog. On iPad the latter is a popover hanging off the can, and that form drops the title and the cancel button both — the question never gets asked, and the way out is the one control not on screen. One alert serves both entry points, since the second of two would silently swallow the first. On the Mac it is also Edit ▸ ぜんぶけす (⌘⌫). The menu only asks for the confirmation: what travels through the focused value is WorkspaceUIState, not the editor, which is a value type wrapping a Binding and cannot go that way. Fixes #48
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A 案(缶をタップ → 確認 → ぜんぶ消す)+ macOS メニュー+確認ダイアログ、決めてもらったとおりに実装しました。
入れたもの
WorkspaceEditor.deleteAll()。ドロップで 1 枚消す従来の動作はそのままsetBlocks([])の 1 ステップ)。空のときはsetBlocksが変化なしを弾くので、空の undo は積まれませんaccessibilityHiddenを解除し、ラベル(ぜんぶけす)とヒント(もとにもどせる旨)を付与実装中に変えた判断が 1 つ
confirmationDialog→alert。 最初はconfirmationDialogで書きましたが、iPad で撮ってみると缶にぶら下がるポップオーバーになり、タイトルと「やめる」ボタンの両方が落ちます(タップ外しで閉じる形になる)。つまり「ブロックを ぜんぶ けす?」という肝心の問いが画面に出ず、逃げ道だけが唯一表示されないコントロールになる。子ども向けにはどちらも譲れないのでalertにしました。結果:
実装メモ(issue に書いた懸念の答え)
focused value に流すのは
WorkspaceUIState(クラス)で、WorkspaceEditorではありません。後者はBindingを包む値型なので focused value には乗せられない。メニューは確認を要求するだけで、ダイアログの所有と実際の削除はワークスペース側に残しています。おかげで alert は 1 つで済み(2 つ目は 1 つ目を黙って飲み込むため)、缶とメニューの両方が同じ確認を出します。確認
swift test119 tests green / 両ビルド green /swift format lint --strictclean未確認
実際にタップして消えるところと、macOS のメニュー項目の見え方は私からは操作できないので未確認です。iPad シミュレータに最新ビルドを入れて
き.tortoiseを開いてあります。缶をタップ →「ぜんぶけす」→ 空状態(みほんの一覧)に戻り、⌘Z で戻ることを見てもらえると受け入れ条件が埋まります。Fixes #48