Commit Graph

1765 Commits

Author SHA1 Message Date
Adesh Gupta 20a5f71bda
Add Pen and Path tool modes to avoid showing all handles (#2264)
* Path tool only show frontier overlays

* Implemented all modes for pen and path tool

* Fixed formatting issue

* Changes in selection behaviour of handles

* Selection toggle only on drag not click

* Changed comment

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-12 01:30:15 -08:00
Keavon Chambers 1700c3a650 Update website with improved student project details 2025-02-11 17:18:57 -08:00
James Lindsay f410efb8a8
Fix crash when ungrouping a direct child of the root in debug mode (#2241)
Fix crash when ungrouping a child of the root in debug mode
2025-02-11 10:45:08 +00:00
Tarun Prabhu bf3b05070c
Add a "Reverse" command to the "Order" menu (#2273)
* addded reverse for layer ordering

* added reverse to layer odering

* fixed indentation and spacing

* added reverse for layer ordering

* Added Reverse to layer ordering

* Update document_message_handler.rs

* Update document_message_handler.rs

* Cleanup, fix compiling, fix history bug

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-11 09:36:56 +00:00
Keavon Chambers ec8c8d6485
Polish and add aborting to several input widgets: no Esc closing parent menus; color picker axis align; repeat on arrow buttons (#2276)
* Remove color input outline; reduce antialiasing compositing artifacts in color widgets

* Rename ColorButton to ColorInput

* Add features and aborting to several other widgets

- Prevent Esc from closing parent floating menus when aborting
- Fix missing icon regression
- Gutter resizing abort
- Color picker aborts, Shift axis alignment, improve click/drag behavior for gradient spectrum
- Scrollbar abort, repeat when held, fix directional arrows when viewport is zoomed
- Number input abort, repeat when held

* Move ColorInput into the inputs folder

* Fix tiny logo
2025-02-10 05:46:41 -08:00
Keavon Chambers 0037f5158c Add new icons to all menu bar entries 2025-02-07 19:08:06 -08:00
Keavon Chambers 0ec91bfe01 Add pin and cut icons; improve menu bar shortcut labels to choose shortest 2025-02-05 18:30:10 -08:00
Keavon Chambers f13efd2d06 Standardize increment snapping to use the Shift key 2025-02-05 03:23:47 -08:00
mTvare 4de65c292a
Further polishing of G/R/S visualization and features (#2243)
* Further polishing of G/R/S visualisation and features

Followup to #2229.

* Begin typing only if constrained or not in G

* Prevent adding empty group in R mode. Order fn alphabetically as was before

* Always show typing hints unless can't begin typing

* Fix one frame bug

* Add cancel and confirm groups for GRS hints

* Fix inconsistency in call increments, snaps

* Use top/bottom left/right methods with quads where more readable

* Fix inconsistent use of narrow/flat

* Add hints to transform cage

Fixes https://discord.com/channels/731730685944922173/881073965047636018/939265895509925898.

* Rename some hints

* Fix scale radial behaviour, grab constraints and local edge orientation

* Fix not being able to remove the whole selection with delete modifier

Fixes https://discord.com/channels/731730685944922173/881073965047636018/1336221441716391937.

* Fix compiling

* Fix crash when single point bbox

Fixes #2267

* Fix the same crash in scale and use better name for bbox

* cargo fmt

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-05 02:57:47 -08:00
Nitish Choudhary da752e5324
Make primitive shape tools no longer draw transformed unit shapes (#2236)
* Line tool pt.1

* Line tool complete

* Fix hints

* Rectangle tool

* Fix bad naming

* Ellipse tool but cant get id

* Fix line tool

* Polygon tool

* Revert unrequested Line tool keybind change; code review cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-05 02:25:07 -08:00
prathmesh703 0865605f74
Fix some number input widgets becoming selected after dragging left/right in Firefox (#2250)
* fixes drag

* Cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-05 07:44:58 +00:00
Sidharth-Singh10 b60af758a9
Make joining path endpoints across layers work to merge the two layers (#2245)
* move merge_layers function to graph_modification_utils

* merge_layer before segment insertion

* Tidying up

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-05 07:25:54 +00:00
Adesh Gupta 12cd0c33a3
Fix copied/duplicated selected layers getting misordered (#2257)
* fixed duplicates ordering issues on alt drag

* Maintain order while copying

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-05 06:59:11 +00:00
James Lindsay 1f836cd2a1
Add support for skewing the transform cage by Ctrl-dragging its edges (#2251)
* Skew select bounds with ctrl

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-05 06:11:59 +00:00
Priyanshu 99a141c2e1
Fix shallow select mode not allowing a Ctrl-click select deepest if the target's ancestor is already selected (#2247)
* Fix deepselect with control key not working when shallow select mode set.

* refactor

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-04 21:39:40 -08:00
Utsav Singh 0f03762cff
Make the Select tool avoid updating hints just when clicking but not dragging (#2248)
* make Fsm update_hints function borrow tool_data and update individual tool implementations accordingly, use tool_data in select_tool update_hints function as well as add a UpdateHints response when the pointer moves after the change from  DragStart to Dragging state

* Also add for selection box drawing

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-05 04:45:57 +00:00
Keavon Chambers 0cda8e2bb4 Code cleanup around the input mapper system 2025-02-04 19:36:30 -08:00
0SlowPoke0 41ee1cf8bc
Improve the Pen tool's colinearity and equidistance controls (#2242)
* basic implementation done now refactor

* fixed overlays refactoring need to fix colinear(update it)

* more_refactoring ,only toggle C for grs to be done(if required)

* cleanup

* cleanup

* more formatting checks

* refactoring alt fixed hints fixed

* code-review-changes

* path-tool-tab-fix

* fixed bugs

* some refactor

* fixed ctrl_snap

* added lock-overlays and fixed grs bug

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-04 19:15:43 -08:00
Adesh Gupta 133d872a9f
Fix Path tool issue where the selected points could be dragged from afar within the layer interior (#2260)
Fixed point drag from inside shape

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-02-04 11:32:56 +00:00
Keavon Chambers 0d8b25d37f
Update most Rust dependencies (#2259) 2025-02-04 02:41:13 -08:00
Priyanshu 6d52151d60
Improve naming for variables from the lasso selection feature (#2244)
small correction in naming
2025-02-02 00:43:09 +00:00
Keavon Chambers 5fedd5c234 Fix demo artwork 2025-02-01 05:50:30 -08:00
Priyanshu 6802365e14
Add lasso selection mode (#2235)
* add document method to check intersection and insideness with polygon

* impl lasso selection

* impl lasso select to always add to selection

* add hint for lasso selection

* fix calculating selection mode based on direction on each pointer move

* fix lasso polygon lagging behing mouse position

* add overlay to draw lasso polygon with fill color same as quad

* fix comment

* change removing from selection key binding from Sift + Ctrl to just Alt

* impl Alt to shrink selection for quad in path tool

* refactor rename SelectionType to SelectionShape

* impl lasso overlay for path tool

* impl selecting anchors and handles intersection lasso in path tool

* add keys hint info

* fix converting lasso polygon to closed subpath which is has less than two points

* Code review

* impl preferences-based selection mode to the Path tool for only for overlays,

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-31 00:37:49 -08:00
Sidharth-Singh10 f462963a36
Add joining of path endpoints with Ctrl+J in the Path tool (#2227)
* feat(path-tool): ctrlJ to join endpoints

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-31 05:43:44 +00:00
Mohamed Osama 86f09be0ee
Group layers with Ctrl+G into independent groups if they're spread across artboards (#2239)
* Continuation of first attempt with unmerged PR #1992

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-30 20:27:35 -08:00
James Lindsay 5a8eb9dd1b
Make the transform cage resize about the pivot when Alt is pressed (#2226)
* Change the pivot behaviour when resizing bounds with alt in the select tool

* Add scale factor maximum

* Fix bug when encountering snapping; tidy up and comment the code

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-30 18:07:40 -08:00
mTvare fb7eae8f02
Polish the G/R/S feature behavior, visualizations, and hints (#2229)
* Fix GRS overlays bugs

- [ ] Another change: when typing values, we shouldn't round the number to 2 decimal places, instead it should show the exact number the user types, including trailing zeros if the user types those.
- [ ] For Scale, the solid vs. dashed line that follows the cursor is following the projected location of the cursor onto that line. It should not be doing that, instead it should be displaying the actual scale ratio. 0 means at the center. 1 means at the starting point of the Sscale. 0.5 means half is solid, half is dashed. Notice in my video below, I'm able to make the solid line's end go all the way to the center, which should occur at a scale factor of 0, without ever having the scale factor even go below 0.5. Because currently the two values aren't related. Furthermore, this is necessary to visualize snapping when Ctrl is pressed and to properly handle slowing when Shift is pressed.
    https://files.keavon.com/-/QuirkyYummyGrayfox/capture_38_.mp4
- [ ] Implement integer-value snapping for Grab when Ctrl is pressed? It should work whether we're freely moving or constrained to X or Y (but still mouse controlled; Ctrl doesn't affect typed numbers). So when Ctrl is held, we shouldn't see decimal values. You'll need to zoom in past 100% to see decimal values.
- [ ] We don't enter G, R, or S mode until after pressing one of those keys and then moving the mouse cursor. It should happen immediately upon pressing the key, before needing to move the cursor.
- [ ] The hints need to be updated to work dynamically with the state of global vs. local X and Y constraint, and include - negation, numbers, and Backspace if numbers are typed.
- [ ] In the Path tool, we actually do want the Rotation to start from the direction of the cursor rather than the local rotation of the layer. So if you can undo that change specifically for the Path tool, but keep it for the Select tool, that would be ideal.
- [ ] When G is constrained to Y in both Path and Select tools, the number label shouldn't swap sides based on moving the mouse left and right offset by the pivot-to-start-point X offset distance. Alternatively, you could keep this behavior but make it swap to the side that the mouse is currently on (removing the pivot-to-start-point X offset from the current mouse position). When solving this, just be sure you don't break the correct behavior for G when unconstrained to an axis, since we like how the Y component label swaps sides. Please also double-check that you're not drawing any extra (overlapping) overlay lines than the necessary 1 when in X or Y constraint mode, or when X or Y happen to be precisely 0. https://files.keavon.com/-/EachWeeArcticseal/capture_39_.mp4
- [ ] Remove the bottom-left viewport overlay labels for the G/R/S status

* Remove bottomleft GRS overlay

* Fix backspace minus

* Implement integer-value snapping for Grab when Ctrl

* Use built-in coordinates for translation

* Show the exact value in Typing including trailing zeros

* Make rotation overlay start along the cursor rather than the local rotation of the layer in path tool

* Properly handle slow down and other effects on scale

* Start the transformation overlay immediately rather than after first change

* Hints for typing and global/local axes

* Prevent drawing overlapping if X or Y is 0

* Fix number being replaced by - when in negated transformation

* Fix fixes

* Invert scale delta in inverted mode

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-30 15:29:17 -08:00
Keavon Chambers 303c1d45f8 Avoid adding an unnecessary Transform node with the TransformChange message 2025-01-30 03:17:31 -08:00
Mohamed Osama 618190d6e4
Fix Document > Clear Artboards so it doesn't also clear everything else (#2177)
* Clear Artboards, Closes #2015

* Memory optmization

* - Fix transactions
- Fix node positions
- Optimize nodes' deletion

* no message

* Fix layers shift to wrong positions

* fix bugs

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-30 01:29:24 -08:00
mTvare a0f8f89e71
Make the transform cage show/hide resize grips as space allows (#2209)
* Changes rotation handles to be around overlay squares

Fixes https://discord.com/channels/731730685944922173/931942323644928040/1330785941786329209

* Fix zero width objects not being selected by slightly nudging the transform

* Follow the categorical limits to render overlay quads

As discussed here: https://discord.com/channels/731730685944922173/931942323644928040/1331166336923074600

* Replace area based calculations with edge based calculations

* Fix 3rd category vis

* Code review

* Add missing powi(2)

* Fixes to handle logic

* Remove single axis prioritisation

* Explicitly check for distance to find nearest handle

* Replace threshold check based on corner vis bounds

* Fix discrepancy at h=12px

* Allow grab when box is too small by disabling resizing within bounds

* Replace inside resize pixel limit

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-30 01:10:40 +00:00
James Lindsay c5a3c32114
Fix regression causing pasted images to have a zero-size transform (#2238)
* Use the identity matrix as the default for an image frame

* Fix all usages to be equivalent to their pre-refactor versions, opting to keep ZERO not IDENTITY as the default image size

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-29 21:09:02 +00:00
James Lindsay dbf917ef71
Fix a minor regression in monitor nodes with VectorData (#2237)
* Fix a minor regression in monitor nodes with VectorData

* Use type alias instead of full type

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-29 11:53:46 -08:00
mTvare 95f6bb82ff
Fix regression where Pen tool resumes segment placement after returning from another tool (#2234)
Fix penfsm not clearing resources and returing to ready when aborting

Fixes https://discord.com/channels/731730685944922173/1332187131623506095/1333775276160585788.
2025-01-29 03:39:28 -08:00
Keavon Chambers eb0ff20d3c
Instance tables refactor part 1: wrap graphical data in the new Instances<T> struct (#2230)
* Port VectorData to Instances<VectorData>

* Port ImageFrame<P> and TextureFrame to Instances<ImageFrame<P>> and Instances<TextureFrame>

* Avoid mutation with the TransformMut trait

* Port GraphicGroup to Instances<GraphicGroup>

* It compiles!

* Organize debugging

* Document upgrading

* Fix Brush node

* Restore TransformMut in lieu of TransformSet trait

* Fix tests

* Final code review
2025-01-28 23:51:12 -08:00
Adam Gerhant 408f9bffa1
Fix regressions from #2105 (more control over subgraph imports/exports handling) (#2213)
* Fix regressions

* Fix copy to points properties

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-26 20:19:11 +00:00
0SlowPoke0 9e2bda36b0
Add G/R/S to the Pen tool to control the outgoing segment handle (#2211)
* more_refactoring_solve_conflict

* overlays-target-fix

* Code review

* select-broken-fix

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-26 04:14:51 -08:00
Pratik Agrawal 96c57605b7
Add an editor preference for touched/enclosed/directional based selection (#2156)
* implemented left selection logic

* added logic for right ward selection

* removed the logs code

* corrected capitalization error

* corrected capitalization error

* added radio buttons for selection_mode

* fixed multiple selection of checkboxes

* adapted to the RadioEntryData

* State management bug

* integrated message system to selection_mode

* updated

* updated

* added selection mode to transition arms

* removed from portfolio message and added preference in ToolMessageData

* removed dead code of selection_mode from frontend logic

* removed dead code for zoomWithScroll

* Cleanup

* Rename, simplify, use dashed box, and highlight only outlines of layers that'll get selected

* More code review

---------

Co-authored-by: Pratik Agrawal <patrik@Pratiks-MacBook-Air.local>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-26 06:34:37 +00:00
James Lindsay 93880abc4c
Experimental vector meshes (#2223)
* Experimental vector meshes

* Clarify limitations in label and tooltip

* Restore old traversal direction

* Fix Bezier-rs crashes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-25 17:13:35 -08:00
James Lindsay 26d66298cf
Give the current snapping target layer(s) an outline (#2224)
* Outline layer when snapping

* Outline layers when snapping to anchors
2025-01-25 13:00:01 -08:00
Keavon Chambers eada1eba54 Update content on the website hoe page, roadmap, and donate page 2025-01-25 04:29:40 -08:00
Priyanshu f7b7f6b9f4
Implement extending, joining, and creating new subpaths with the Spline tool (#2203)
* visualize spline end points using overlays

* implement for spline tool to extend path by draging end points

* allow holding Shift to begin drawing a new spline subpath in the same layer

* implement spline tool to join two endpoints

* fix naming

* refactor spline tool

* impl spline tool snapping and overlays

* fix joining path and refactor

* improve join_path comment

* fix snapping overlays flickering by ignoring snapping in current layer

* fix inserting single point on aborting spline tool

* add snapping for endpoint even when regular snapping is disabled

* fix extending

* fix inserting new point instead of extending and Add hint for Shift to append

* fix grammatical errors and code style

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-25 11:24:08 +00:00
Andy Day 33ac141fb8
Fix blurry overlay rendering when the pixel display ratio isn't 100% (#2204)
* support hi dpi overlay rendering

* Code review and make scaling ratio dynamic

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-25 09:37:49 +00:00
mTvare 9954e49530
Make the document auto-save system initially restore the last-viewed tab before loading the rest (#2194)
* Fixes last tab being opened instead of last active tab

Fixes https://discord.com/channels/731730685944922173/881073965047636018/937518022548131891

* Defers node initialisation to SelectDocument message instead of load_document

* Fix warning regarding attempt to load closed document

* Defer loading resources and running nodes to selection time

* Make last active tab load before others

* Load last active saved document instead of last autosaved doc

* Fix failing tests

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-25 06:41:47 +00:00
mTvare de36d4967d
Add visualization overlays to G/R/S (#2195)
* Make HintInfo label use Cow<'static, str> instead of String

Fixes https://discord.com/channels/731730685944922173/881073965047636018/931942323644928040

tmp, will amend later

* Replaces dynamic hint used by transform layer with overlays

* Adds a scaling factor accounting for document and viewport scales

Also moves whole code to single unit

* Make overlays relative to viewport rather than document

* Add visualization overlays to G/R/S in the Select tool

* Prevents quick measurements from showing up when resizing bounds

Fixes https://discord.com/channels/731730685944922173/881073965047636018/1328282633456713762

* Add local axes which activates on double constraints.

* Handle the bounding box of a collection of layers as select tool does

* Replaced hard coded transparent color and removed debug! which slipped in

* Make rotation axes start along local axis

* Fix typed distance being in doc space and negatives

* Fix missing undo transactions for some actions

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-24 23:31:55 +00:00
Sidharth-Singh10 3048466e86
Remove errant line following cursor in snap overlays during constrained line drawing (#2206)
* fix(line-tool): disable snap overlays during constrained drawing

* Update editor/src/messages/tool/tool_messages/line_tool.rs

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-24 14:10:01 -08:00
Ayush Chauhan 6effb2d6e6
In Path tool when dragging a handle, make Alt recover the opposing handle if it's not cubic rather than zero-length (#2196)
* follow up for PR #2160

* now `alt` restores zero-length handles

* Update editor/src/messages/tool/tool_messages/path_tool.rs

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-24 08:49:43 +00:00
mTvare 37db9b1392
Retain transforms of layers when transferred between transformed groups (#2212)
* Retain position of layers when transfered between artboards.

Fixes #861

* Apply same fixes to grouped layers
2025-01-23 13:22:41 -08:00
Keavon Chambers 8505ed3f10
Improve older document upgrading compatibility and make node type errors clearer (#2201)
* Improve older document upgrading compatibility and make node type errors clearer

Misc.

* Fixes

* Avoid unwrap
2025-01-21 01:40:43 -08:00
Adam Gerhant eec0ef761c
Polish user-created subgraph nodes: imports in the Properties panel; reorder/delete/rename imports/exports (#2105)
* Remove imports/exports

* WIP: Autogenerated properties

* WIP: Input based properties

* WIP: Hashmap based input overrides

* Migrate noise pattern node to input properties

* Reorder exports

* Continue migrating properties

* WIP: Improve reorder exports

* Automatically populate all input properties for sub networks

* Complete reorder import and export

* Add widget override to node macro

* Migrate assign colors to input based properties

* WIP: Full node property override

* Node based properties override for proto nodes

* Migrate all node properties to be input based

* Rename imports/exports

* improve UI

* Protonode input valid implementations

* Valid type list

* Small formatting fixes

* Polishing small issues

* Document upgrade

* fix tests

* Upgrade noise pattern node

* remove console log

* Fix upgrade script for Noise Pattern

* Improve the Properties panel representation for graphical data

* Re-export demo art

* Code review

* code review improvements

* Cleanup for node properties overrides

* Reexport demo art

* Fix clippy lints

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-20 21:13:14 -08:00
mTvare ad68b1e5c8
Restore Pen tool undo/redo and fix incorrect triggering of undo when changing tools (#2193)
Fixes ghost anchors, and allows undo in pentool

Fixes https://discord.com/channels/731730685944922173/881073965047636018/1267365764231598186.
Fixes https://discord.com/channels/731730685944922173/881073965047636018/1327376421034922045.
Fixes #2152.

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2025-01-18 23:46:28 -08:00