Skip to content

Add text tool with rich editor#54

Merged
Microck merged 6 commits intomainfrom
feat/text-tool
Mar 7, 2026
Merged

Add text tool with rich editor#54
Microck merged 6 commits intomainfrom
feat/text-tool

Conversation

@Microck
Copy link
Collaborator

@Microck Microck commented Feb 17, 2026

Description

Add a text tool with rich in-app editor accessible via key 5.

Type of Change

  • New feature (non-breaking change which adds functionality)

Changes Made

  • Add text tool to tool selector with SVG icon
  • Create in-app text entry overlay (no browser prompts)
  • Support font family, size, weight, italic, alignment options
  • Add stroke/outline toggle with width control
  • Implement click-to-edit existing text
  • Add cursor preview support

Testing

  • Tested in Firefox

Test Configuration:

  • OS: Windows 10
  • Browser: Firefox

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have tested my changes thoroughly

Related Issues

N/A

@Microck Microck requested a review from hingler March 1, 2026 17:01
Copy link
Collaborator

@immalloy immalloy left a comment

Choose a reason for hiding this comment

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

Image adding text doesnt seem to work :C neither cancelling

@Microck
Copy link
Collaborator Author

Microck commented Mar 3, 2026

@immalloy pushed updates for your review:

  • fixed text modal actions: add text and cancel now work reliably.
  • text popup now only closes via the two buttons (no backdrop/escape close).
  • spacebar no longer triggers timeline playback while typing in the text input.
  • added text cursor preview behavior improvements and text-tool editing flow updates (including re-open/edit on existing text).
  • aligned text options with pr scope (align + outline controls).
  • these were working before, but they broke while splitting this work across multiple prs.

@Microck Microck requested a review from immalloy March 3, 2026 20:52
@hingler
Copy link
Collaborator

hingler commented Mar 3, 2026

  • Tested creating text with stroke, bold, various fonts
  • Tested creating text with different colors, and ensuring that they are bound to the correct swatches.
  • Ensure text creation can be undone/redone
  • Ensure text changes can be undone/redone (ie editing existing text)

These appear to be working.

Some design complaints:

  • Text can be partially deleted with the rect tool, which breaks text editing completely. Would it be alright to remove that feature altogether?
  • Text strokes do not abide by the "one color per swatch" rule. We could either draw the stroke to its corresponding "swatch," or treat text objects as "decoration" atop the cel layers. Alternatively, we remove stroke altogether.

@Microck
Copy link
Collaborator Author

Microck commented Mar 3, 2026

  • Tested creating text with stroke, bold, various fonts
  • Tested creating text with different colors, and ensuring that they are bound to the correct swatches.
  • Ensure text creation can be undone/redone
  • Ensure text changes can be undone/redone (ie editing existing text)

These appear to be working.

Some design complaints:

  • Text can be partially deleted with the rect tool, which breaks text editing completely. Would it be alright to remove that feature altogether?
  • Text strokes do not abide by the "one color per swatch" rule. We could either draw the stroke to its corresponding "swatch," or treat text objects as "decoration" atop the cel layers. Alternatively, we remove stroke altogether.

fixed:

  • text metadata now stays in sync during destructive edits (rect delete, lasso erase, brush eraser, fill-eraser), so partially erased text wont leave stale editable entries
  • text stroke color now follows the active swatch (with fill-color fallback) so it matches the one-color-per-swatch behavior

feel free to re-test

@hingler
Copy link
Collaborator

hingler commented Mar 7, 2026

Thanks for the changes! Both of those bugs appear to be fixed but there appears to be a new bug that appears when using the rect select tool after the erase tool, on text:

  • Create a text snippet on the canvas.
  • Erase part of the snippet, thereby invalidating the text node.
  • Use the rect select tool to attempt to highlight and move the text.

When this is done, the text disappears from view. Not sure what causes this, possibly the invalidated text nodes are never "committed" to the canvas, so when the node is invalidated and we perform a redraw, the text disappears too?

@Microck
Copy link
Collaborator Author

Microck commented Mar 7, 2026

fixed. this was caused by text invalidation rewriting old snapshots, so rect select could make erased text disappear. i changed invalidation to metadata-only.

@hingler
Copy link
Collaborator

hingler commented Mar 7, 2026

image

Modifications to a swatch within a text node's bounding box do not appear to invalidate the text node; not only that, but content behind the text is completely removed.

Totally up to you, but i would be up for removing the metadata feature altogether, until we can agree on behavior for these cases (ex. text and lasso fill/erase, text and brush, etc etc...)

@Microck
Copy link
Collaborator Author

Microck commented Mar 7, 2026

text is now editable only until the next draw operation on that cel/swatch. after the first draw, metadata is finalized (pixels stay as-is), which prevents the stale snapshot/invalidation artifacts.

uztSvEeEELxR-zd3.mp4

@hingler
Copy link
Collaborator

hingler commented Mar 7, 2026

LGTM! thanks for the help on this

@Microck Microck merged commit 24e07ed into main Mar 7, 2026
@Microck Microck deleted the feat/text-tool branch March 7, 2026 19:22
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.

3 participants