Commit Graph

1099 Commits

Author SHA1 Message Date
Firestar99 006209c5d0 Put all `#[test]` in a `mod tests` (#2728)
workspace: put all `#[test]` in a `mod tests`
2025-06-19 20:25:58 -07:00
Adesh Gupta 579bedd9ff Fix editor crash when anchor sliding, followup to #2682 (#2726)
Fix editor crash due to unwrap
2025-06-19 19:11:13 -07:00
mTvare e238753a35 Implement clipping masks, stroke align, and stroke paint order (#2644)
* refactor: opacity + blend_mode -> blend_style

* Add code for clipping

* Add alt-click masking

* Clip to all colors. Fill option

* Fix undo not working. Fix strokes not being white

* Allow clipped to be grouped or raster

* Switch to alpha mode in mask-type

* add plumbing to know if clipped in frontend and add fill slider

* Attempt at document upgrade code

* Fix fill slider

* Add clipped styling and Alt-click layer border

* Use mask attr judiciously by using clip when possible

* Fix breaking documents and upgrade code

* Fix fixes

* No-op toggle if last child of parent and don't show clip UI if last element

* Fix mouse styles by plumbing clippable to frontend

* Fix Clip detection by disallowed groups as clipPath according to SVG spec doesn't allow <g>

* Add opacity to clippers can_use_clip check

* Fix issue with clipping not working nicely with strokes by using masks

* Add vello code

* cleanup

* Add stroke alignment hacks to SVG renderer

* svg: Fix mask bounds in vector data

* vello: Implement mask hacks to support stroke alignment

* Move around alignment and doc upgrade code

* rename Line X -> X

* An attempt at fixing names not updating

* svg: add stroke order with svg

* vello: add stroke order with by calling one before the other explicitly

* fix merge

* fix svg renderer messing up transform det

* Code review; reorder and rename parameters (TODO: fix tools)

* Fixes to previous

* Formatting

* fix bug 3

* some moving around (not fixed)

* fix issue 1

* fix vello

* Final code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 19:11:01 -07:00
Timur Gainullin 8a3f133140 Fix undo bug returning to drawing a Pen tool rubber-band curve on prior parts of a previously drawn shape (#2710)
fix: add cleanup after pen path is closed

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 19:02:58 -07:00
Albar 643d7b4432 Add the `unit`, `display_decimal_places`, and `step` parameter widget macro attributes (#2706)
* UI working for spacing enum.

* Implementations.

* UI working for spacing enum.

* Undo all changes.

* unit, display_decimal_places, and step macro implementation.

* Fixing tests.

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 19:01:58 -07:00
Adesh Gupta f3720bf6f2 Add Pen tool support for starting and ending segment drawing on existing path edges for vector meshes (#2692)
* Start on segment

* Path tool ending on segment

* Overlays for feature

* Fixed merge build

* Fix overlays

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 19:01:07 -07:00
Adesh Gupta 781271782c Add anchor sliding along adjacent segments in the Path tool (#2682)
* Improved comments

* Add point sliding with approximate t value

* Add similarity calculation

* Numerical approach to fit the curve

* Reliable point sliding for cubic segments

* Fix formatting and clean comments

* Fix cubic with one handle logic

* Cancel on right click and escape

* Two parameter optimization

* Esc/ Right click cancellation

* Code review

* Fix dynamic hints

* Revert selected_points_counts and fix comments

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 18:59:22 -07:00
Keavon Chambers 96a0dada92 Replace 'Generate Handles' and 'Remove Handles' nodes with 'Auto-Tangents' node; rename vector2 data type to coordinate 2025-06-19 18:56:57 -07:00
Adesh Gupta f72263f4f8 Add molding segments to the Path tool (#2660)
* Moulding of cubic bezier

* Implemented falloff with interpolation

* remove conflict

* Move falloff to consts

* Spelling

* Refine falloff param and bug fix

* Code review

* Add colinear disable modes to molding degment feat

* Clean comments and unused code

* Code refactor

* Fix error

* Change colinear toggle behaviour

* Code review

* Remove KeyC feat + Fix overlay

* Dynamic hints in path tool

* Revamp molding logic

* Code review

* Remove unused Bezier algorithms (maybe useful for future reference)

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 18:55:57 -07:00
mTvare 4dfeafd65e Improve the click targets for the skew triangles of the transform cage (#2703)
Extend the bounding box over triangle to extend beyond the triangle
2025-06-19 18:54:13 -07:00
Adesh Gupta 33a31b4f17 Fix the Path tool's segment insertion line overlay having hysteresis with distance away from the cursor (#2677)
* Fix hysteresis in segment insertion

* Update editor/src/messages/tool/common_functionality/shape_editor.rs

* Update editor/src/messages/tool/common_functionality/shape_editor.rs

* Fix insert point overlay

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 18:53:14 -07:00
mTvare 04d7adb867 Fix grid overlay values getting wiped when switching between isometric/rectangular and back (#2702)
* Retain values present in previous git overlay state

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 18:51:56 -07:00
mTvare a1d85779ba Fix inability to deselect nodes, and nodes not being selected when pasted (#2691)
* Deselect on shift/alt click and paste selects multiple mode

* Grid values persistance

* reset

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 18:50:57 -07:00
seam0s 878f5d3bf7 Add overlays for free-floating anchors on hovered/selected vector layers (#2630)
* Add selection overlay for free-floating anchors

* Add hover overlay for free-floating anchors

* Refactor outline_free_floating anchor

* Add single-anchor click targets on VectorData

* Modify ClickTarget to adapt for Subpath and PointGroup

* Fix Rust formatting

* Remove debug statements

* Add point groups support in VectorDataTable::add_upstream_click_targets

* Improve overlay for free floating anchors

* Remove datatype for nodes_to_shift

* Fix formatting in select_tool.rs

* Lints

* Code review

* Remove references to point_group

* Refactor ManipulatorGroup for FreePoint in ClickTargetGroup

* Rename ClickTargetGroup to ClickTargetType

* Refactor outline_free_floating_anchors into outline

* Adapt TransformCage to disable dragging and rotating on a single anchor layer

* Fix hover on single points

* Fix comments

* Lints

* Code review pass

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 18:50:53 -07:00
James Lindsay bf7caef6fb Instance tables refactor part 8: Output the type of the input data with the Mirror node as well (#2699)
* Flatten output of mirror node

* Enable reflection based on pivot, not just bounds

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-06-19 18:42:01 -07:00
Keavon Chambers cea1a1c6a8 Instance tables refactor part 8: Make repeater nodes use pivot not bbox and output instance type not group; rename 'Flatten Vector Elements' to 'Flatten Path' and add 'Flatten Vector' (#2697)
Make repeater nodes use pivot not bbox and output instance type not group; rename 'Flatten Vector Elements' to 'Flatten Path' and add 'Flatten Vector'
2025-06-19 18:37:40 -07:00
Keavon Chambers 523cc27523 Improve the spreadsheet visualization details for VectorData 2025-06-19 18:37:39 -07:00
Keavon Chambers 6111440afd Instance tables refactor part 7: Remove RasterDataType and add Raster<CPU>/Raster<GPU> 2025-06-19 18:37:13 -07:00
Keavon Chambers 5cacab2e39 Instance tables refactor part 7: Rename "ImageFrame" -> "RasterData", "ImageFrameTable" -> "RasterDataType", and "RasterFrame" -> "RasterDataType" 2025-06-19 18:23:53 -07:00
Keavon Chambers 2696abc6b3
Replace Instances<T>::empty() with Instances<T>::default() and make it return an empty table for vector data instead of one empty row (#2689)
Make Instances<T>::default() return an empty table for everything, even vector, and replace ::empty() with ::default()
2025-06-04 21:00:21 -07:00
Keavon Chambers cb4289169d
Instance tables refactor part 6: unwrap VectorData and ImageFrame from single-row to multi-row tables (#2684)
* Start refactoring the boolean operations code

* Switch to iterators in the boolean operations code

* Make boolean operations work on rows of a table, not Vecs of single-row tables

* Remove more .transform()

* Simplify brush code

* Attempt to remove .transform() by using Instance<Image<Color>> in brush code, but a regression is introduced

* Improve blend_image_closure

* Simplify

* Remove leading underscore from type arguments

* Remove .transform() from ImageFrameTable<P> and fix Mask node behavior on stencils not fully overlapping its target image

* Remove more .one_instance_ref()

* Fully remove .one_instance_ref() and improve the 'Combine Channels' node robustness

* Fully remove .once_instance_mut()

* Fix tests

* Remove .one_empty_image()

* Make Instances<T>::default() return an empty table for images, but still not yet vector

---------

Co-authored-by: hypercube <0hypercube@gmail.com>
2025-06-04 20:40:15 -07:00
Dennis Kobert 76ecdc8f1b
Fix the 'Upload Texture' node (#2680)
* Fix upload texture node

* Feature gate gpu node implemenations
2025-05-29 04:35:35 -07:00
mTvare 4d2e1d57fd
Instance table refactor part 6: remove usage of `one_instance_*` functions (#2672)
* Refactor the spline node

* Refactor the jitter_points node

* Refactor the morph node

* Refactor the merge_by_distance node

* Refactor the area node

* Refactor the centroid node

* Refactor the bevel node

* Refactor the tests

* Code review

* Refactor the morph node

* Refactor the extend_image_to_bounds and sample_image node

* Refactor the dehaze node

* Refactor the blur node

* Refactor the vector_points node

* Refactor the blit node

* Refactor the blend_gpu_image node

* Refactor the path_modify node

* Refactor the image_color_palette

* Fix copy_to_points

* Code review

* Partially make progress toward fixing the Draw Canvas node

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-29 03:08:16 -07:00
Adesh Gupta b564579362
Make the Path tool only allow selecting points that are visible (#2668)
* Fix only visible points selection in point selection

* Fix comments

* Remove bug from box selection and lasso

* Code review

* Fix comment

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-28 02:24:23 -07:00
0SlowPoke0 f6e592da5b
New nodes: 'Point Inside Shape' and 'Close Path' (#2673)
* add point inside shape,close path,and disabled node to layer conversion

* removed the usage one_instance

* code review
2025-05-26 02:15:31 -07:00
Adesh Gupta 3496e22f55
Fix box selection bug in the Path tool where document and viewport space got mixed up (#2671)
* Fix box selection bug

* Fix all layers selected on paste
2025-05-25 16:33:49 -07:00
0SlowPoke0 8a8e496058
Implement angle locking when Ctrl is pressed over an adjacent anchor (#2663)
* Implement angle lock from adjacent anchors

* Reset offset state and added comments

* Code review

* fix selecting correct handle to lock

* Update comment

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-24 12:09:43 +00:00
Keavon Chambers c4678336e5
Add support for clicking checkboxes via their labels (#2667) 2025-05-24 04:46:15 -07:00
Keavon Chambers 899ed5ad85 Tidy up the Layers panel with a new bottom bar 2025-05-21 04:14:01 -07:00
Mohamed Osama 66a297df2c
Improve the distribution part of the snapping system (#2626)
* fix distribution snapper visualization going far from layers

* fix bugs

* Remove traces

* remove comment

* Fix tests

* Rename distribution snapper variables from x, y to horizontal, vertical

* Fix tests

* Fix bug where center point and corner point have to be enabled for distribution_snapper to work

* Cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-20 00:15:56 -07:00
0SlowPoke0 ddb2d744d4
Make the Path tool support multi-point conversion between smooth/sharp on double-click (#2498)
* kinda works

* solved merge conflicts

* implement the multi flip

* nit-picks

* removed extra functions

* Fix inputs not being passed to backend for repeated double-clicks

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-19 22:11:38 -07:00
mTvare 9236bfcec0
Transfer pasted layers to the viewport center when outside the current view area (#2306)
* Transfer pasted layers to viewport center when not in viewport

Fixes #2301

* Move a layer as a whole and use change

* Make a bbox and move content according to that

* partial fix

* Only move if none within viewport

* Fix import error

* Fix artboard

* tmp, skip ones being added to ab

* fix stuff

* fix formatting

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-20 01:16:06 +00:00
mTvare 6c1ccfb5bb
Fix regression causing last selected layer to not be deselected (#2656)
Fix last selected layer not being deselected because .take() was placed inside if block
2025-05-19 16:58:03 -07:00
Keavon Chambers e57637aab1
Make builds of the editor and the website serve their own local fonts (#2186)
* WIP

* Done?

* Install fonts in CI

* Use absolute path so minified inlined CSS works

* Fix Bezier-rs demo fonts?

* Use opsz

* Revert removal of text balancer

* Pull in the text balancer from our static host
2025-05-19 02:38:29 -07:00
seam0s ea59f10b50
Fix editor crash due to mismanaged selected points on layers (#2640)
* Add hash sets to hold ignored points in SelectedLayerState

* Fix non selected anchor dragging

* Update selected points when ignoring handles or anchors

* Refactor selected points status logic

* Refactor ignore_handles and ignore_anchors bools to ShapeState

* Add back in ignore_anchors and ignore_handles in SelectedLayerState

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-18 21:09:58 +00:00
Sidharth-Singh10 2615d86934
Add PTZ support for flipping the canvas (#2394)
* feat: flip canvas

* move canvas_flipped from NavigationMessageHandler to PTZ

* fix artboard overlay flip

* Code review

* Improvements

---------

Co-authored-by: hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-18 06:16:00 +00:00
Keavon Chambers a8e209e44c
Remove the old node macro and fix/clean up several raster nodes (#2650)
* Fix several broken raster nodes and clean up leftover old node system code

* Migrate Brightness/Contrast to the new node macro, and fix it

* Remove last usages of old_node_fn

* Remove old_node_fn
2025-05-17 21:24:32 -07:00
Keavon Chambers 77f8bfd9ed Improve clarify of type errors and tooltip diagnostics 2025-05-17 16:13:05 -07:00
0SlowPoke0 6e7f218068
Add Path tool support for Ctrl-dragging to pull out zero-length handles with angle locking (#2620)
* implement check-drag and angle-lock

* track bool

* flip-smooth-sharp

* fixed bugs

* fixed flip-smooth jump bug and random angle locking bug

* ctrl-alt 90 case

* aligned flip-smooth sharp and fixed arbitrary handle-length when flipped

* code-review change

* 0.5 instead of 0.8

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-17 13:23:11 -07:00
Keavon Chambers d3b5dc5712
Clean up 'Image' node by removing old 'Cull' node in sub-network (#2643)
* Clean up 'Image' node by removing old 'Cull' node in sub-network

* Fix gamma correction on Decode Image node
2025-05-12 18:40:48 -07:00
mTvare c9984a8f1a
Make Select tool hover overlay in 'shallow select' mode visualize the next deeper object (#2639)
* Fix overlay behaviour on hovering over a layer

* Add the deepen overlay code

* cleanup
2025-05-11 07:53:38 -07:00
mTvare 4487020efb
Fix skew triangles showing up when transform cage isn't selected (#2638)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-09 00:49:48 -07:00
Keavon Chambers a6ff221c1e Fix overlay clearing regression from #2521 with high-DPIs
Closes #2628
2025-05-08 16:48:49 -07:00
kythyria 9ef9b205d9
Auto-generate enum type widget boilerplate for radio buttons and dropdown menus (#2589)
* First draft of factoring out the dropdown boilerplate

* Add proc macro for enum boilerplate

* Detect whether to say `crate` or the name

* Clean up the input and naming of the enum macro

* Rename a file

* Do the rename of code too

* Use the attribute-driven selection of radio vs dropdown

* Add a metadata struct and tooltips

* Move the new traits to a better place.

* Use ChoiceType, part 1

* Use ChoiceType, part 2

* Introduce a builder API for choice widgets

* Start using the new new API

* DomainWarpType should be a dropdown still

* Handle the case where a node property can never have a socket

* Rustfmt

* Code review

* Update stable node IDs in test

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-05-01 04:14:26 -07:00
Sidharth-Singh10 2fc4896d01
Add tests for the Freehand tool (#2599)
* Add tests for freehand tool

* add test: line weight affects stroke width

* refactor
2025-04-30 19:53:59 +00:00
seam0s-dev 1a81e45673
Add the settings popover menu for the Overlays toggle (#2523)
* Added granular overlays control based on features

* Added basic support for pivot, path, anchors and handles overlay settings

* Added more overlay checks on anchors and handles

* Add new settings over measurements, hover and selection overlays

* Fix errors introduced while rebasing

* Disable anchors and handles functionality with their overlays, extended selection outline check

* Add check to enable/disable outlines on selected layers

* Toggle handles checkbox in sync with anchors checkbox

* Refactor overlays checks

* Remove debug statements

* Update select_tool.rs to resolve conflict

* Minor fix to reflect anchor checkbox state on the handles

* Minor fix to make anchors checkbox work

* Rearrange menu items, and code review

* Fix pivot dragging

* Add handles overlay check when drawing with pen tool

* Fix constrained dragging when transform cage is disabled

* Fix deselecting user selection when anchors are disabled

* Minor fix for disabling anchors

* Remove All from OverlaysType

* Remove debug statements

* Fix editor crash when selecting other layers with path tool and anchors disabled

* Minor fix on overlays check for all overlays

* Add proper code formatting

* Nits

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-04-30 04:15:46 -07:00
Adam Gerhant 1f7a9188ba
Improve the speed of SVG importing due to node positioning (#2625)
Fix slow svg import

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-04-30 03:38:09 -07:00
Mohamed Osama 0a65e570a9
Add snapping for a line's midpoint when it's being drawn (#2594)
* line midpoint snapper

* Add to snap option menu

* remove being_drawn_line_midpoint

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-04-30 05:12:04 +00:00
Boyu Dai 12896a2407
Fix node deletion being too greedy (#2619)
fix too greedy node deletion search

Co-authored-by: CaligulaAlucard <caligulaalucard@localhost.localdomain>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-04-30 04:22:17 +00:00
mTvare 90be1f42c6
Fix 'Shallow Select' mode behavior for selection context transference (#2604)
* Fix ancestor always returning None during shallow select

* Fixes

* fix shift remove on both

* cleanup

* one more cleanup

* final(?) fix

* some cleanup

* more stuff

* make shallow the default

* fixes

* fix

* fix

* fix

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-04-30 03:24:48 +00:00