feat(#83): text element follow-ups — double-tap, mid-edit styling, multi-text merge, commit semantics#118
Merged
Merged
Conversation
Add Event.TextEditRequested(id) and Intent.RequestTextEditAt to the frozen surface. DrawBox emits RequestTextEditAt on a double-tap in SELECT mode; the controller also emits TextEditRequested when an already-sole-selected text is tapped again (tldraw/Figma pattern). Reducer gains a hitTopmost passthrough so the controller can resolve the edit target without duplicating pick logic. Documents the text surface (shipped in 2.1.0-alpha01) + these additions in a retroactive RFC 0001, per docs/rfcs/README.md.
- #83.3: text chips apply to every selected text and show a dimmed "mixed" state (ContextBarState.*Mixed) when the selection disagrees on a property. - #83.1: while the inline editor is open, the selection context bar sits above the commit overlay and the overlay skips presses a chip already consumed — so tapping a chip restyles the element instead of committing. - #83.5: Esc cancels the edit without committing (deleting a freshly inserted empty element); losing focus (IME dismiss / window blur / tap-away) commits.
The commit overlay was a full-screen catcher sitting ABOVE the ContextBar and firing on pointer press, so tapping a style chip committed the editor before the chip could handle the tap. Rework by composition order, no zIndex: render the overlay BETWEEN the canvas and the toolbar layer, using release-based detectTapGestures. Now a chip tap reaches the ContextBar and restyles the element live; only a tap on empty canvas commits. A fillMaxSize Box WITH a zIndex captures pointer events (an earlier attempt to lift the toolbar layer that way silently broke element selection), so this relies purely on composition order and keeps empty-area pass-through. Also drop the focus-loss auto-commit: DrawBox re-grabs canvas focus on press, which made it fire spuriously. Verified on the JS web build: selection works, and tapping a size chip while editing enlarges the text with the editor still open (no commit).
… handles Add a `selectionStyle: SelectionChromeStyle` parameter to `DrawBox` for tuning the selection chrome — `padding`, `handleSize`, `cornerRadius`, `strokeWidth`, and `accent`. The selection box now draws with rounded corners; grips are hollow rounded-corner squares (no fill) so the element shows through, and the box outline plus rotation connector are clipped so no chrome line is drawn inside a handle. Resize hit-testing tracks the padded box so grab targets stay aligned.
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.
Implements five of the six #83 follow-ups. Item #4 (rotation) is left out — it needs a repro/video, not a blind fix.
Changes
SDK (frozen surface additions — see RFC 0001)
Event.TextEditRequested(id)+Intent.RequestTextEditAt.DrawBoxdispatches on a double-tap inSELECTmode; the controller resolves the hit (Reducer.hitTopmostpassthrough) and emits the event.TextEditRequestedwhen an already-sole-selected text is tapped again (tldraw/Figma pattern).Sample
Esccancels without committing (deleting a freshly inserted empty element); losing focus (IME dismiss / window blur / tap-away) commits.drawbox-ui + sample
ContextBarState.fontSizeMixed/textAlignmentMixed/fontFamilyMixed) when the selection disagrees on a property.Docs
Verification
:DrawBox:jvmTestpasses (covers the reducer/controller changes).Notes
:shared:jvmTestdoes not compile onmain—TopRightControlsScreenshotTestcallsTopRightControls(themeMode = …)but that parameter doesn't exist (confirmed onorigin/main). Left untouched; out of scope here.