-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Feature(UI): Add text tool to canvas #8723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature(UI): Add text tool to canvas #8723
Conversation
…DustyShoe/InvokeAI into Feature/UI-Add-Text-tool-to-canvas
…ithout commiting text.
…llback, minor tweaks
invokeai/frontend/web/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx
Outdated
Show resolved
Hide resolved
…n CanvasTextOverlay.tsx Renamed containerMetrics to textContainerData in CanvasTextOverlay.tsx Fixed mouse cursor disapearing during typing.
lstein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a request about where to put the documentation file. I've tested the feature and it works as advertised, but I'm not strong enough with typescript to comment on the code.
|
Also it would be good if someone proficient in TS could take a look. This piece was a tricky one. |
|
Gave it a quick test. There's a few things I think this PR needs.
I'll add more as I test and find. |
Few things done with this commit. - The varying size of the font selector box has been fixed. The UI no longer shifts and moves with font change. - We no longer format the font size input to add px each time. Instead now just have a permanent px indicator. - The bug with the random text inputs on the slider value has also been fixed. - The font size value is only committed on blur keeping it consistent with other editing apps. - Fixed the spacing of the toolbar to make it look cleaner. - Font size now permits increments of 1.
|
Overall, I agree with the review and appreciate the fixes that were made. That said, I’d like to disagree with points 1 and 4 and clarify the original intent behind this tool.
I don’t want this tool to evolve into a full-featured text editor or introduce a new persistent “text layer” type. The original idea was to provide a very simple, unobtrusive way to add short annotations directly onto the canvas, mainly for mockups, references, or raw inputs for generation. The intended workflow is:
In this context, post-placement text editing doesn’t add much value. We’re not editing documents or long text blocks; most use cases involve a few words that are faster to retype than to maintain an editable text state. Introducing a new layer type would also increase UI and state complexity, especially considering the right panel is already quite dense with things like Inpaint Mask, Control Layers, Regional Guidance, etc.
I’d like to keep the ability to cancel text input with a single key. This is useful when intentions change mid-typing or any other reason. I agree that committing on canvas click is probably too aggressive and hurts UX. As a compromise, I’d suggest:
This keeps the behavior explicit, avoids accidental commits, and prevents unnecessary layers from being created without clear user intent. P.S.
|
…to select line spacing.
…discription to docs
…d message on canvas for better UX.
…DustyShoe/InvokeAI into Feature/Add-Text-tool-to-canvas
|
I'd like to ask to take another look at this PR. |
|
Sure, I'll take a look later today! |
|
I tried out the text interface again and found it to be a nice addition to the canvas. However, there were a few things I found counterintuitive:
Here's what I would suggest that does not involve creating a whole new vector graphics application.
|
|
I’ll try to defend my decisions while also agreeing with some of the points raised.
1.1 The click-away behavior is intentional. It allows users to copy and paste (or type) between the canvas text box and the prompt window without being locked into text input mode. 1.2 It also reserves the ability to use hotkeys. I personally found it useful to be able to change primary and secondary colors on the fly. That said, we can disable this for now if needed. 1.3 Keeping the tool always in typing mode causes issues with interacting with text option controls, especially numeric inputs like font size. Even if those controls are made interactable, clicking them exits text entry mode, which brings us back to the original problem.
I did not intend for this tool to become an advanced text editor for writing long-form content inside Invoke. The expected flow is simple: type the text, commit with Enter, optionally rotate or reposition it, and press Escape if you change your mind and decide to do something else. I do agree that hovering over the border to enable a Move mode makes sense, and I plan to implement that. However, I would still like to keep the Enter (commit) and Escape (cancel) behavior. Perhaps a small tooltip in a canvas corner could help users better understand this interaction model.
Honestly, why Backspace? Delete seems more intuitive here. Using Backspace for node or noodle deletion is generally a bad design choice, and I would prefer not to repeat it in this tool.
Answered in point 2.
The rotate handle was intentionally made the same length as in the Transform tool for consistency. I actually spent extra time aligning it with that behavior; it used to be shorter before.
Shift-Enter already creates a new line. If I misunderstood this point, please let me know. I hope this helps clarify my intentions, and I’m open to further discussion. Apologies if this response feels a bit messy; it’s late and I’m pretty tired after pushing this feature to the finish line. |
…r hit targets. Supress hotkeys on uncommitted text.
|
I may be missing an obvious use case here, but I’m having a hard time understanding why a user would intentionally continue typing after clicking away from the text editor. It feels like the user’s intent has already shifted at that point. At this point i have blocked all hotkeys while text is in uncommitted state. |
OK, leave click-away in.
This was driving me crazy, so appreciate disabling the hotkeys.
Ok, leave current behavior.
Ok. Just add the move mode for hovering and leave the Enter/Escape behavior
This was my error. I meant Delete, so we agree here.
Sure, leave it as is.
I'll have to try it again. I thought I'd tried shift-enter and it didn't behave as expected.
Nearly there! Don't get disheartened. |

Summary
Canvas Basic Text Tool!
Summary:
2025-12-30.13-29-23.mp4
Related Issues / Discussions
The fonts information is stored in
invokeai\frontend\web\src\features\controlLayers\text\textConstants.tsIf anyone have an opinion what fonts and fallbacks should be used, please write in comments. There's 10 fonts to choose ATM and i'd like to make selection as diverse as possible.
QA Instructions
Merge Plan
Checklist
What's Newcopy (if doing a release after this PR)