Feat(UI): Add linear and radial gradient tools to canvas#8774
Feat(UI): Add linear and radial gradient tools to canvas#8774lstein merged 19 commits intoinvoke-ai:mainfrom
Conversation
|
@dunkeroni Could you take primary reviewer on this one? |
dunkeroni
left a comment
There was a problem hiding this comment.
This is a useful tool. Operating it is a bit clunky, but mostly because interacting with both colors on our color-picker is tedious right now.
Performance-wise it seems pretty good on my system; drawing is done on the user end and committed on release. Drawing many gradients quickly will slow down the UI a lot, but that is a limitation of the rasterization/update of the layer on the server, not a flaw that this PR can solve.
invokeai/frontend/web/src/features/controlLayers/components/Tool/ToolGradientButton.tsx
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/controlLayers/components/Tool/ToolGradientButton.tsx
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/controlLayers/components/Tool/ToolGradientButton.tsx
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/controlLayers/konva/CanvasObject/CanvasObjectGradient.ts
Outdated
Show resolved
Hide resolved
invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasGradientToolModule.ts
Show resolved
Hide resolved
…bject/CanvasObjectGradient.ts Co-authored-by: dunkeroni <dunkeroni@gmail.com>
…ol/ToolGradientButton.tsx Co-authored-by: dunkeroni <dunkeroni@gmail.com>
…ol/ToolGradientButton.tsx Co-authored-by: dunkeroni <dunkeroni@gmail.com>
…ol/ToolGradientButton.tsx Co-authored-by: dunkeroni <dunkeroni@gmail.com>
…opover mode buttons and group clip+mode cluster
That was my initial idea, but it was suggested to use popover instead in https://discord.com/channels/1020123559063990373/1457030215686422569. So i thought i'd reuse this suggestion here.
I couldn't figure out how to do that. Some searches claim that you can not do that. |
|
TBH I like the child set of icons and will investigate the issue with inconsistent rendering. |
|
Having settings at the top makes it consistent with the current brush tools, and would be a good pattern to follow with future tools as well. It doesn't obstruct the canvas view at all either. |
Cool! Let's keep it in top bar then. Can you push your change now or it is still blocking? |
|
No, you'd have to go to the settings on your own fork and send me an invite to be a collaborator. Otherwise, if you just want to merge them into this branch yourself, I pushed the edits to my own fork at https://github.com/dunkeroni/InvokeAI/tree/Feat(UI)/Canvas/Add_gradient_tool |
dunkeroni
left a comment
There was a problem hiding this comment.
Works as expected and adds an otherwise difficult to achieve effect. UI impact is minimal, and the structure can easily extend for new behaviors in the future if someone wants to add.
Merged upstream features: - Gradient tools (invoke-ai#8774) - Paged gallery view (invoke-ai#8772) - Encoder CPU toggle (invoke-ai#8777) - Various bug fixes Removed downstream pagination implementation in favor of upstream: - Deleted PaginatedGrid.tsx - Deleted GalleryModeCombobox.tsx - Deleted PageSizeCombobox.tsx - Removed galleryMode, paginationPageSize, currentPage from gallery state - Updated GallerySettingsPopover to use upstream's UsePagedGalleryViewCheckbox Kept downstream features: - LoRA category system - Folder hierarchy (recursiveFolderView) - Layout mode Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Summary
This PR adds a set of radial and linear gradients to available toolset on canvas.
Adds parent and child custom buttons.
Tool respects color transparency and both color swatches. It draws gradient in direction of mouse movement: from active color to inactive. Gradient is rasterized on mouse release on current active layer.
It is also possible to activate clipping by drag start-stop points.
Gradient is clipped by bbox to save on performance.
2026-01-18.16-30-16.mp4
Related Issues / Discussions
QA Instructions
Merge Plan
PR merge should be painless. Though, code might need a proper check.
Checklist
What's Newcopy (if doing a release after this PR)