Repository navigation
fix(main-editor): improvements in text layers and sized box - #904
Merged
Merged
Conversation
…d exports - A box shown while typing keeps following the text after a history step and leaves no trace in earlier steps, also when the layer is removed. - A tap on a line drawn past the box puts the caret there instead of ending the edit. - Captures of timed text, of masked layers and of shadows past the box match what the canvas shows, and capturePixelRatio gets the captured size.
# Conflicts: # CHANGELOG.md
Owner
|
Thank you so much @saif-ellafi for taking the time to build out the desktop side of the package like this. Inline editing, resizable text boxes and now all this polish make a huge difference, it's really great work! While testing I pushed a few fixes on top before merging:
One heads-up for hosts that anchor layers at their top-left corner: the grown capture stays centered on the layer, so the image has to be offset by half the growth. This is documented on Merged and released in 14.20.0, together with #905 and #906. Thanks again! |
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.
Collected some user feedback and purused further testing myself on the in-line editing and resizable text boxes. These are cumulative but related set of improvements during that session. AI-assisted.
Description
Improvements to text boxes (
TextLayerBox) and to editing text in place on the canvas.Empty text boxes survive an edit. A text layer that had a box before an edit and still has one afterwards is kept when its text is emptied, inline, in the full-screen editor, and through
applyTextLayerChanges, like an empty field on a form. Its background and its hit area are the box, so it stays visible and selectable. Text without a box, and a new text left empty, are still removed. One undo brings the text back.TextLayerBoxOverflow.visible. A new overflow mode: the text keeps its size and lines that do not fit are drawn past the box. The background, the hit area and the layer's size stay the box. A version that does not know the mode reads it asclip, which also keeps the text size. While the text is edited in place, the field grows with its lines instead of scrolling inside the box.TextEditorConfigs.boxOverflow(defaultshrink) picks the mode for boxes the editors fit with the box button.Layer captures include visible overflow. The images
Layer.captureAsPngandLayer.captureAllLayersproduce now hold the text drawn past the box instead of cutting it at the box. The capture grows evenly on both sides of an axis, so the image keeps the layer's center, andExportedLayer.logicalSizereports that size. Only the captured image grows: the layer's size, its hit area and its selection on the canvas stay the box.Turning the box on during an inline edit. The session puts the box it fits on the layer while the edit runs (
InlineTextEditSession.showBoxOn), following thecomes off before the edit ends, so a savedd a dropped edit leaves the layer as it was. A resize records its own history steped in gets its layer back without the box,so undo reaches the original layer.Resizing the text of an inline edit.
InlineTextEditSession.setFontScalechanges the size of the text being edited inside its layer, kept betweenTextEditorConfigs.minFontScaleand `so a host can offer text size controls for scale also resizing the box.Text no longer moves when an inline edit The field gives back the room a text fieits caret, which moved centered andright-aligned text by up to 3 px.
maxTextWidthwraps at the same width while edited (`RoundedBackgroundTextField.textWrapWidthpadding into that width, so the textwrapped earlier and gained lines.
TextEditorStyle.textHeight.Tests:
setFontScaleclamping and keeping theThe outline alignment test no longer sets a line height, since the field now keeps it rather than overriding it.
Related Issue: Closes #
Type of Change
🤖 Generated with Claude Code