Commit Graph

752 Commits

Author SHA1 Message Date
Tayfun Yaşar cf496668fb
Add artboard displayed names in the viewport (#1795)
* possible location of the change is decided.

* fix for issue #1774

* possible location of the change is decided.

* fix for issue #1774

* fix for #1706

* fix for #1706, code reformatted

* fix for #1706, Label input removed from Properties

* fix for #1706

* deleted the comment
2024-06-22 01:10:52 -07:00
adamgerhant 84ac2e274e
Code cleanup after migrating node graph interaction to the backend (#1790)
* Cleanup transforms and click targets

* Improve click target caching

* Fix click target bugs

* Add auto panning

* update_modified_click_targets

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-06-20 23:11:41 -07:00
0HyperCube 68a6065f2b
Arrange layers in top level (#1786) 2024-06-17 11:56:31 +01:00
Tayfun Yaşar 5b6a2518e4
Fix clicking a selected anchor not deselecting all other selected points (#1782)
* possible location of the change is decided.

* fix for issue #1774
2024-06-16 04:02:09 +00:00
adamgerhant d8973ec8da
Fix Poisson-Disk Points node transform of input shape (#1784)
Fix poisson-disk, node gap spacing
2024-06-15 15:16:12 -07:00
adamgerhant 02360c7bc8
Migrate node graph UI interaction from frontend to backend (#1768)
* Click node using click targets based

* Display graph transform based on state stored in Rust, fix zoom and pan.

* Migrate node selection logic

* Move click targets and transform to NodeNetwork

* Keep click targets in sync with changes to node shape

* Click targets for import/export, add dragging

* Basic wire dragging

* complete wire dragging

* Add node selection box when dragging

* Fix zoom operations and dragging nodes

* Remove click targets from serialized data, fix EnterNestedNetwork

* WIP: Auto connect node when dragged on wire

* Finish auto connect node when dragged on wire

* Add context menus

* Improve layer width calculations and state

* Improve context menu state, various other improvements

* Close menu on escape

* Cleanup Graph.svelte

* Fix lock/hide tool tip shortcuts

* Clean up editor_api.rs, fix lock/hide layers

* Start transferring network and node metadata from NodeNetwork to the editor

* Transfer click targets to NodeGraphMessageHandler

* Fix infinite canvas

* Fix undo/redo, scrollbars, and fix warnings

* Unicode-3.0 license and code cleanup

* License fix

* formatting issue

* Enable DomRect

* Fix layer move crash

* Remove tests

* Ignore test

* formatting

* remove white dot

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-06-15 08:55:33 -07:00
Keavon Chambers a9a4b5cd19
Move gradient picking into the color picker (#1778)
* Gradient picker

* Fix up color picker layout CSS problems

* Begin hooking up SpectrumInput for gradient in the ColorPicker

* Working gradient picking on the frontend only

* Plumb FillColorChoice into the backend

* Hook everything else up, just with a weird bug remaining

* Fix some svelty reactivity issues

* Add and remove stops

* Cleanup

* Rename type

* Fill node document format upgrading

* Fix lint

* Polish the color picker UX and fix a bug

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
2024-06-09 22:55:13 -07:00
Keavon Chambers 449729f1e1
Fix crash and clean up frontend -> backend input handling code (#1770) 2024-06-03 01:09:22 -07:00
adamgerhant 6d74abb4de
Node network subgraph editing (#1750)
* Breadcrumb visualization, nested network consistency, create definitions for Merge internal nodes

* Add index to network inputs, remove imports usage from flatten network

* Replace NodeOutput with NodeInput::Node

* Fully remove imports field, remove unnecessary identity nodes, move Output node to encapsulating network

* Replace previous_outputs with root_node, fix adding artboard/layer to empty network

* Import/Export UI nodes

* Display input/output types dynamically from compiled network

* Add LayerNodeIdentifer::ROOT_PARENT

* Prevent .to_node() on ROOT_PARENT

* Separate NodeGraphMessage and GraphOperationMessage

* General bug fixes with nested networks

* Change layer color, various bug fixes and improvements

* Fix disconnect and set node input for proto nodes and UI export node

* Dashed line to export for previewed node

* Fix deleting proto nodes and nodes that feed into export

* Allow modifications to nodes outside of nested network

* Get network from Node Id parameter

* Change root_node to previous_root_node

* Get TaggedValue from proto node implementation type when disconnecting

* Improve preview functionality and state

* Artboard position and delete children fix

* Name inputs/outputs based on DocumentNodeDefinition or type, fix new artboard/layer insertion

* replace "Link" with "Wire", adjust previewing

* Various bug fixes and improvements

* Modify Sample and Poisson-Disk points, fix incorrect input index and deleting currently viewed node

* Open demo artwork

* Fix opening already upgraded documents and refactor FrontendGraphDataType usages

* Fix deleting within network and other bugs

* Get default node input from compiled network when copying, fix previews, tests, demo artwork

* Code cleanup

* Hide EditorApi and add a comment describing unresolved Import node input types

* Code review

* Replace placeholder ROOT_PARENT NodeId with std::u64::MAX

* Breadcrumb padding

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-06-02 08:01:56 +00:00
Keavon Chambers e4d3faa52a Update website roadmap 2024-06-01 02:38:38 -07:00
0HyperCube 61292500e6
Fix tool drawing start point offset when an artboard has a transform (#1763)
* Fix offset artboard

* Multiply in transform sometimes
2024-05-28 01:09:48 -07:00
Keavon Chambers d40fb6caad
Add boolean operations (#1759) 2024-05-25 22:02:00 -07:00
Elbert Ronnie 5a1c171fc3
Add Area and Centroid nodes (#1749)
* initial attempt for area node

* allow node preview for more types

* make AreaNode sync and add CentroidNode

* cargo fmt

* preview of DVec2

* make the nodes async again

* use segment domain instead of region domain

* modify the check for linearity

* create a limit for area in centroid calculation

* cargo fmt

* reverse unnecessary changes

* add threshold to area calculation too.

* handle zero area edge case

* add todo comment

* implement 1D centroid and use it as fallback

* formatting floats to skip last zero

* add Centroid Type radio button to Centroid Node

* rename docs to use area and perimeter centroid

* add web demos for perimeter centroid

* add tests for perimeter centroid

* add fallback to use average of points

* Fix for broken area

* missing fixes

* Code review and rename Perimeter Centroid to Length Centroid

* Use dummy footprint in Area and Centroid nodes

* add doc and todo to clarify when `is_linear` fails

* use epsilon instead of zero

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2024-05-22 13:11:11 -07:00
Elbert Ronnie 4587457bfa
Fix primitive tool shapes appearing at document origin before dragging; fix Ctrl+0 recenter shifting (#1751)
* fix ghost shape when starting to draw

* fix indeterminate recenter

* fix typo infinate

* cargo fmt

* Code review and add to Line tool

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-05-22 09:31:26 +00:00
0HyperCube af6dae29fc
Fix off by one subpath and unrelated crash (#1754)
* Fix off by one in subpath code

* Fix crash with selected handles and anchor

* Sort the correct way I have no idea why the origional code was so overly verbose but it has caused significant confusion and wasted effort
2024-05-20 14:44:24 -07:00
adamgerhant cce1bc644e
Fix artboards not being included in Export menu's bounds list (#1748)
Show artboards when exporting
2024-05-09 05:08:02 +00:00
Keavon Chambers 6b0822d318 Add Isometric Fountain demo artwork 2024-05-08 19:00:31 -07:00
Keavon Chambers de84e39c4e Improve backwards compatability robustness of serde-based document format 2024-05-08 17:45:31 -07:00
adamgerhant bc33eabc3c
Add grid color customization and choice to display as dots (#1743)
* dot grid

* fix warning: unreachable pattern

* grid color select

* add color for all grid types

* Dot grid checkbox and remove prefixed Color functions

* Display dot grid as grid aligned pixels

* Dashed line comment

* Code review and UI design widget placement updates

* Isometric dotted grid

* Early return when cos = 0

* Add spacing, x offset, and color to dot grids

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-05-08 21:36:15 +00:00
Dennis Kobert 1bfbe306be
Fix image loading and remove resolve_empty_stacks() function (#1746)
* Fix Image loading and remove `resolve_empty_stacks()`

* Revert noise pattern change

* Add todo comment
2024-05-08 01:31:41 -07:00
Keavon Chambers 244c8ad10a Enable Merge nodes to take vector data inputs from the bottom, not just left
Known bug: click targets aren't calculated for bottom input vector data.
2024-05-07 16:41:44 -07:00
Dennis Kobert ce96ae66f2
Loosen the Graphene type system to allow contravariant function arguments (#1740)
* Accept any input for nodes that expect () as input

* Add comments

* More comments

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-05-07 16:36:25 -07:00
Keavon Chambers 07fd2c2782 Add visibility and delete buttons to node sections in the Properties panel 2024-05-07 02:53:30 -07:00
Keavon Chambers 7845302c50 Store overlays, snapping, and grid state in saved documents and toggle them with hotkeys 2024-05-06 22:08:53 -07:00
adamgerhant 14262e1527
Fix duplicate selection when holding Alt and dragging with Select tool (#1739)
Fix duplicate selection when holding alt and dragging with select tool
2024-05-06 18:33:58 -07:00
adamgerhant 4c3856833b
Code cleanup and refactor for generalized layers (#1738)
* Move functions to messages to fix undo bugs for UnGroup and Group

* Copy+Paste for generalized layer nodes

* Fix MoveSelectedLayersTo and GroupSelectedLayers by extracting functions into messages

* Fix tests, replace FrontendMessage:TriggerPaste with PortfolioMessage::PasteIntoFolder

* Formatting

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-05-04 22:11:48 -07:00
adamgerhant 8d83fa7079
Generalize layers as merge nodes to enable adjustment layers (#1712)
* WIP, backward traversal issues

* Fix some tool issues

* Remove debugging

* Change some indices

* WIP: new artboard node

* WIP: add artboard node

* WIP: Artboard node and create_artboard

* WIP: Artboard node implementation complete

* WIP: Artboards input for output node

* Complete Artboard node

* Generalize LayerNodeIdentifier,  monitor_nodes support for Artboard node, adjust ResizeArtboard/ClearArtboards, move alias validation to Rust

* Fix misaligned artboard click targets

* Generalize/clarify create_layer and insert_between

* non-negative dimensions for resize_artboard

* Show artboards in layer panel

* Generalize create_layer for layer output node

* Generalize delete_layer/delete_artboard to NodeGraphMessage::DeleteNodes. Fixed upstream flow Iter

* remove old primary_input function

* Vertical node visuals, remove is_layer function, rename Layer node to Merge node, toggle display as layer

exposed_value_count type fix

Vertical node visuals, remove is_layer function, rename Layer node to Merge node, toggle display as layer

* Fix demo artwork

* Layer display context menu

* Automatically select artboard, fix warnings

* Improvements to context menu and layer invariant enforcement

* Remove display_as_layer and update load_structure

* Improve load_structure to show more layers, improve FlowIter, improve layer naming, layer rearrangement validation.

* Clean up demo artwork using generalized layers

* Improve design of Layers panel and graph nodes

* MoveSelectedLayersTo rewrite to support generalized layer nodes

* Include artboards in deepest_common_ancestor, fix resize_artboard/delete_artboard, sync artboard tool to layer panel

* MoveSelectedLayersTo adjustments

* Sync non layer node visibility with metadata

* Include non layer nodes when moving/creating layer

* Fix group layers and get_post_node_with_index

* Include non layer nodes in UngroupSelectedLayers

* GroupSelected for all selected nodes, UnGroupSelected position adjustments

* Add grouping for layers in different folders

* Fix hidden layers

* Prevent node from connecting to itself, fix undo automatic node insertion,

* Fix undo CreateEmptyFolder, fix grouping nested layer nodes

* Formatting

* Remove test and check if node is layer from network

* Fix undo group layers

* Check off roadmap

* MoveUpstreamSiblingsToChild adjustments

* Replace tabs with spaces, remove mut from argument

* Final code review pass

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-30 23:03:42 -07:00
zhiyuan e769f50877
DropdownInput preview support and ColorButton history improvements (#1598)
* DropdownInput support preview

* fix typo and rm logs

* Add previewable flag

* fix cr typos

* Improve color button history

* rename

* update dropdown preview behaviour

* Color picker preset color

* Another way to handle blend mode preview

* Apply suggestions from code review

* Use on_commit instead of on_update for some dropdowns

* Debugging progress

* add debug

* active not equal to highlight in some cases

* rm logs

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-29 17:03:58 -07:00
Tiger3018 282969df3d
Fix shallow/deep selection (#1725)
* fix: remove folder #1595 when clicked, except for shallow select.

This should also fix other tools, like Fill tool which hook Lmb hints.

* TODO: shallow select is not working when interval clicks.
* TODO: shallow hover is showed same as deep hover.

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-29 16:04:27 -07:00
Keavon Chambers 19eb6ce0ab Remove editor instances concept and clean up JS interop code 2024-04-29 04:17:09 -07:00
Keavon Chambers 597c96a7db Polish and fix small bugs with tilt and zoom navigation 2024-04-28 02:13:18 -07:00
Keavon Chambers 72ba4ddfe4 Add rotation to Repeat node 2024-04-26 15:06:36 -07:00
Sahil gill 5f4960db9b
Fix crash when Pen tool's in-progress point snaps along an angle with its previous anchor (#1701)
changes
2024-04-19 16:35:58 +01:00
Haikal 1ccd8ae4ec
Insert duplicated layers directly above their selected source layers (#1726)
Make insert index of duplicated layer on top of layer that's being duplicated
2024-04-17 22:01:21 -07:00
Shyam Jayakannan e55578a016
Fix interactive outlining of layers within the Select tool's box selection (#1727)
* changes made to correct outlining behavior

* Comment fixups

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-18 04:48:29 +00:00
Shyam Jayakannan 67ba5bcecf
Added fine-grained choices to Snapping options popover (#1730)
* Added Customised Snapping

* Fix snapping choice to Anchors; clean up popover menu code

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-18 04:24:15 +00:00
Karthik Prakash 3019cc7253
Add alpha to Extract Channel node and remove Extract Alpha node (#1731)
* add `TaggedValue::RedGreenBlueAlpha`

* add alpha to `ExtractChannelNode`

* remove `ExtractAlphaNode` from `Split Channels`

* remove `ExtractAlphaNode`
2024-04-17 15:44:14 -07:00
Karthik Prakash 438c45eb80
Add corner rounding to the Rectangle node (#1648)
* add skeleton implementation

* add corner rounding

* fix crash when `border_radius` is zero

* rename `Border Radius` to `Corner Radius`

* add clamped property

* add `TaggedValue::F64Array4`

* add frontend support for individual corner rounding

* added individual corner rounding

* fix rebase

* change default values when switching rounding type

* fix crash caused by negative scale

* remove `Any` trait

* add `Message::Batched`

* fix stale property bug

* add smarter clamping for individual rounding

* Rearrange widgets in properties panel

* update individual clamping algorithm

* add better variable names

* make variable names clearer

* Final code cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-06 05:09:55 +00:00
Haikal bf81a31ff9 Add layer locking feature (#1702)
* Add locking layer feature

* Update locked state data to adjust the refactor

* Make the locked layer cannot be selected using pointer and select all key

* Make locked layer cannot be moved and disable bounding box

* Add locked status selected node on CopyBuffer

* Make locked layer cannot be selected when selected all layers, and disabled GRS and nudging operation on locked layer

* Add refresh document metadata before update button on visible and locked

* Updated from master

* Fix icon logic on panel locked layer

* Make the child locked when the parent is locked, and the child cannot be unlocked if the parent is locked

* Revert "Make the child locked when the parent is locked, and the child cannot be unlocked if the parent is locked"

This reverts commit 7c93259bc2bef492e203d6ac9c48852112e6c3a3.

* Revert "Fix icon logic on panel locked layer"

This reverts commit 33939f2e84431d64e6bc2bef07161eafcfba0c0e.

* Delete Make Lock button in the node graph top bar

* Add ToggleSelectedLocked to action_with_node_graph_open

* Fix parent and child locking behavior icon on panel

* Fix boolean operator on icon button locking layer

* Make bolean logic more readable in icon button locking layer

* Fix locking layer can be moved or resizing when selected with unlocking layer, disabled pivot widget on locking layer, disable all action on pivot point, alignment, flipping, and boolean operation for locking layer

* Fix axis align drag crash

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
2024-04-03 16:08:26 -07:00
Keavon Chambers 938a688fa0 Polish up the Layers panel design 2024-04-01 02:09:01 -07:00
Haikal 5bab38e173
Exclude hidden layers from Ctrl+A selection; prevent G/R/S/nudging hidden layers (#1697)
* Exclude hidden layer to be selected on Select All Layer

* Add hide layer action to history

* Fix error call the function

* Add hide layer action to history state

* Make hidden layer cannot be transform like G/R/S and nudges

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-31 07:48:17 +00:00
Muhammad Aqdas e22db31738
Fix "contrain" typo (#1717)
Fix typo 'contrain' to true 'constrain

Fix typo 'contrain' to true 'constrain'
2024-03-31 06:15:57 +00:00
Keavon Chambers 27f9e3f00e
Move node visibility flag from NodeNetwork to DocumentNode (#1708)
* protonode -> proto node

* Move node visibility flag from NodeNetwork to DocumentNode

* Add serde default for new field

* Logic improvements
2024-03-27 05:17:08 -07:00
Haikal d3e3e19822
Fix hidden state missing from copy/paste, causing hidden layers to reappear when pasted or grouped (#1698)
Add data state visiblity of node when copy-paste
2024-03-25 13:27:30 -07:00
Elbert Ronnie e9510c5fee
Fix Select tool's scale nudging with multi-layer selection (#1699)
* Fix scale nudging for multiple selection

* Use message discriminant for filtering where possible

* Remove unnecessary parameter from `selected_bounds_document_space`

* Fix the error `target.closest is not a function`

* Minor cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-25 13:20:30 -07:00
Keavon Chambers 0a9bd41be1
Code cleanup and refactoring to enhance consistency (#1695)
- Move message handler payload data into structs
- Organize the file structure used by `editor/src/messages/portfolio/document` `/node_graph` and `/graph_operation`
- Make derive attributes use `serde::Serialize, serde::Deserialize` consistently instead of `use serde::{Deserialize, Serialize};` imports
- Various other code cleanup and refactoring
2024-03-20 21:28:51 -07:00
Nicolás Mayora ed3f7acdd7
Fix the Path tool's point dragging getting offset when viewport is panned (#1693)
fix: moving a point with the path tool after panning

Co-authored-by: Nico Mayora <mayoranicolas0104@gmail.com>
2024-03-17 23:30:53 -07:00
Mohamed Osama 058aa7121c
Fix ungrouping bugs to preserve layer ordering and prevent incorrect layer deletion (#1672)
* Ungroup layer external consistency and fix bug

* no message

* no message

* no message

* no message

* fix-bug

* Code review: make code more idiomatic

* Fix layres reversed when ungroup with index != -1

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-16 11:44:30 -07:00
Keavon Chambers d8255ebb72 Block page render when loading web fonts 2024-03-16 02:52:52 -07:00
Karthik Prakash 8bc389a3b4
Fix artboard deletion (#1651)
* Fix `Document > Clear Artboards`

* Fix `Artboard Tool > Delete`

* fix graph disconnection when deleting artboard

* fix empty artboard deletion

* Code readability improvements

* fix `Clear Artboards`

* add comments

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-16 01:56:39 -07:00
Keavon Chambers 1a2a0e8757 Minor code cleanup and spelling fix 2024-03-16 00:30:29 -07:00
Mohamed Osama 6630e2b964
Place new folders in the correct stack order relative to other selected layers (#1678)
* New folder placed directly above the topmost selected layer in the hierarchy (at the level of the least nested layer)

* fix bug

* Replace `.collect().contains()` with `.any()` and `if` statement with `.then_some()`

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-16 07:26:46 +00:00
Elbert Ronnie 42c822020e
Make auto-panning speed uniform (#1690)
* Make auto-panning speed uniform

* Abstract time-delta calculation to `TimeInfo`

* Update docs and add additional check

* Apply code review changes
2024-03-16 06:36:22 +00:00
shipp02 56f8ecacc9
Refresh graph view overlay if it's open when switching documents (#1691)
* Update Graph View Overlay if it is open when switching documents

* Resolve comments
2024-03-15 19:52:20 -07:00
Keavon Chambers 5bca931813 Rename handle mirroring to colinear 2024-03-14 07:44:55 -07:00
Elbert Ronnie ea4f3d8bba
Add auto-panning to all remaining tools (#1682)
* Add auto-panning to Gradient tool

* Add auto-panning to Path tool

* Add auto-panning to Pen tool

* Add auto-panning to Spline tool

* Add auto-panning to Line tool

* Add auto-panning to Rectangle tool

* Add auto-panning to Ellipse tool

* Add auto-panning to Polygon tool

* Hide `PointerOutsideViewport` in debug messages

* cargo fmt

* Code review cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-14 06:05:33 +00:00
milan-sedivy 9ac10cdcf8
Comprehensively polish up the input hints across all tools and states (#1670)
* Add missing keyhints to most tools

* Standardize hints further

* Improve GRS numerical display values

* Additional hints improvements

* Improve Path tool hints; add Ctrl+Shift+A point deselection

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-12 20:20:25 -07:00
Roshan P 2263b0ab89
New node: Solidify Stroke (#1650)
* added struct and registered fill from stroke node. not functional yet.

* properly registered new node

* finished fill-from-stroke feature. works on both closed and open shapes. supports line caps and line joins.

* fixed import issues and miter limit handling

* fix outline function. use both subpaths for solid shapes now

* code quality improvements

* use radius instead of diameter, functionality not yet working for shapes as transform is not properly applied before calculating new shapes.

* Updated to follow new VectorData structure. Fully functional.

* fix repeat node

* remove comment

* add a test, remove unused code.
2024-03-11 17:19:29 -07:00
milan-sedivy c3a886116a
Block the undo shortcut while dragging with a tool (#1675)
Add NOOP message and bind it to CTRL + Z + LMB
2024-03-11 16:03:08 -07:00
milan-sedivy 01da53eba0
Make the Fill tool's fill click operation cancellable (#1666)
* Make FillTool a draggable tool with abortable fills

* Unify keyhints across tools

* Apply suggestions from code review

* Formatting

* Fix FillTool when draged outside of shape's layer and add toolswitch abort

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-11 14:18:49 -07:00
milan-sedivy 343523ab34
Improve the Select tool's input hints (#1667)
* Refactor hints in SelectTool

* Unify Keyhints and fix DrawingBox state so that it holds nested behaviour info

* Code review cleanup; rename hints

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-11 02:11:17 -07:00
milan-sedivy dcce519426
Fix switch to/from Artboard tool firing an undo (#1668)
* Fix tool switch causing abort of ArtboardTool transaction when it shouldn't

* Add cancellation keyhints

* Unify the cancel keyhints with other tools

* Consolidate hints

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-11 00:46:38 -07:00
Keavon Chambers fd54cda445 Rename NodeNetwork inputs/outputs to imports/exports 2024-03-11 00:13:01 -07:00
milan-sedivy d714166c69
Don't save undo/redo history when aborting transactions (#1660)
* Create a forgetable undo/redo function used by AbortTransaction

* Rework and fix new undo/redo functions

* Add space before comments

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-10 18:39:33 -07:00
milan-sedivy aa9a3e648a
Fix cancellation of drag actions in all tools where it's missing (#1664)
* Change message sent from DocumentMessage::Undo to DocumentMessage::AbortTransaction while aborting select tool

* Fix NavigationTool not aborting

* Fix NavigationTool tilt

* Make gradient tool abortable

* Make PathTool drag actions abortable

* Make FreeHand Tool abortable

* Make BrushTool abortable

* Fix filename typo

* Make artboards also abortable

* Rearrange key bindings for consistency

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-09 16:19:56 -08:00
0HyperCube 218e9675fd
Attribute-based vector format refactor (#1624)
* Initial vector format structure

* Click targets

* Code review pass

* Remove subpaths from vector data

* Morph node & vector node tests

* Insignificant change

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-09 10:27:30 -08:00
Haikal c8ea9e05a6
Fix orphaned child layers left behind when a group is ungrouped or deleted (#1655)
* Fix Incomplete Deletion of Children Nodes in delete_layer Function

* delete debug message

* change variable name on iterator of child_layers
2024-03-09 17:09:30 +00:00
0HyperCube b31e8f7b6d
Make menu lists searchable (#1499)
* Searchable font list

* Bug fixes and UX polish for edge cases

* More work, still more bugs to fix

* Don't update highlight when not open

* Bug fixes

* Additional bug fixes and code review

* Fix keyboard input being sent to backend

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-09 10:58:13 +00:00
milan-sedivy 4cbba3d92b
Allow cancellation of pivot drag in Select tool (#1658)
* Add Abort to SelectToolFsmState::DragginPivot state

* Remove trailing whitespace (rustfmt error)
2024-03-09 00:22:20 -08:00
Mohamed Osama 69c6f44373
Fix internal consistency of layer ordering when grouping (#1645)
* Internal consistency: Grouping layers preserve the order that they were sorted once those layers end up in the new group

* optimizations
2024-03-09 05:18:37 +00:00
Keavon Chambers 9f84661fac Switch Eyedropper/Fill tools from Rmb to Shift+Lmb 2024-03-08 20:33:53 -08:00
Elbert Ronnie d780602ecd
Add auto-panning to the Artboard tool (#1652)
* Move panning functionality to auto_panning.rs

* Add auto-panning to Artboard tool

* Hide debug messages containing AnimationFrame
2024-03-08 20:32:46 -08:00
milan-sedivy ea3f834b64
Create a history step when importing SVG files (#1656)
* Create a history step when importing SVG files

* Removed additional usvg::Tree::from_str call based on feedback, used DocumentHistoryBackward in case it fails
2024-03-08 14:44:49 -08:00
Karthik Prakash 0c60fd95fa
Remove `remain` alphabetical sorting enforcement macros (#1647)
remove `remain`

Co-authored-by: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
2024-03-06 16:43:51 +00:00
Elbert Ronnie 2f44b156d1
Fix regression from #1630 for Layers panel blend modes missing labels (#1649)
Specify label instead of value
2024-03-05 04:10:57 +00:00
Elbert Ronnie 9479abe114
Fix dropdown keyboard movement bug (#1630)
* Add a value to all `MenuListEntry`

* cargo fmt

* Make `value` as constructor in `MenuListEntry`

* Make `value` as constructor in `RadioEntryData`
2024-03-02 17:06:08 -08:00
Mohamed Osama a1f2a2b256
Fix layers losing their names upon being grouped (#1637)
* no message

* no message

* no message

* Make layers reserve their names when grouped

* remove redundancy

* replace String::from("") with String::new()

* Fix test

* Restore unrequested line break changes

* Avoid unwraps

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-02 23:34:25 +00:00
Haikal 128f76af7e Add clear artboards button to undo history (#1643) 2024-03-02 16:39:41 +00:00
Keavon Chambers f02dd5c0f6 Launch the Alpha 3 release series 2024-02-29 23:47:11 -08:00
zhiyuan 5cf0b8893a
Fix Freehand tool extending after transforming the path (#1623)
Fix extending after transforming
2024-02-29 19:50:02 -08:00
Keavon Chambers 70dce1c230 Resolve most Clippy lint issues 2024-02-29 00:48:28 -08:00
Elbert Ronnie 8e769e37f6 Add auto-panning when pointer goes beyond viewport edge with Select tool (#1625)
* Add code to shift viewport if mouse is beyond edge

* Allow shifting viewport if mouse is stationary too

* Group all modifier keys into SelectToolPointerKeys

* Cleanup message ordering to remove shifting during resize

* Slow down shifting by half

* Clamp speed; code review cleanup

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-28 23:52:36 -08:00
Keavon Chambers 4405e01f55 Fix displayed ordering of keyboard shortcuts 2024-02-28 21:51:49 -08:00
Mohamed Osama 96e52c18eb Fix external consistency of grouping layers so they don't jump to the top of the hierarchy (#1627)
* Calculate insert_index when grouping multiple layers

* no message

* Fix wrong commits

* no message

* restore frontend/package-lock.json

* Fix formatting matches

* Code review to make it idiomatic

* remove wrong line

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-28 15:01:23 -08:00
Elbert Ronnie 39401f0be0
Fix point translation bug in Path tool (#1626)
Fix point translation bug
2024-02-25 14:50:30 +00:00
Keavon Chambers a02b162e30
Consolidate and rename Graphene data types, and add many comments (#1620)
* Document ProtoNodeInput

* More comments

* Comment improvements

* Comment and split ProtoNodeInput::NodeLambda from ProtoNodeInput::Node

* Combine NodeImplementation into DocumentNodeImplementation

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2024-02-20 17:53:04 -08:00
Comeza dc7de4d973
Save work periodically to reduce loss from crashes (#1580)
* Add auto saving

* Fix autosave dispatching message but not saving document

* Clamp set_timeout delay

* Auto save all documents instead of only the active

* Add with_editor to simplify code

* Update consts

* Simplify some more

* Fix typo

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-20 03:23:25 +00:00
0HyperCube 229b5dbb20
Use f64 not f32 throughout graph; add Vector2 value node (#1618)
* Use doubles in graph

* Format .graphite files onto one line

* Rename new node to Vector2

* No primary input

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-18 22:16:37 +00:00
0HyperCube 6f6fb3bcd4
Upgrade several Rust dependencies (#1613)
`specta` from Hypercube's fork commit to latest upstream commit
`wasm-bindgen` 0.2.87 -> 0.2.91
`spirv-std` from 0.9 to not-yet-merged commit in https://github.com/EmbarkStudios/rust-gpu/pull/1115
`wgpu` 0.17 -> 0.19
`winit` 0.28.6 -> 0.29
`vello` and `vello_svg` from latest upstream commit to not-yet-merged commit in https://github.com/linebender/vello/pull/427
`resvg` 0.36.0 -> 0.39
`glam` 0.24 -> 0.25
`rustybuzz` 0.8.0 -> 0.10.0
`js-sys` and `web-sys` 0.3.55 -> 0.3.67
`usvg` 0.36.0 -> 0.39
`spirv` 0.2.0 -> 0.3

* Update a couple of dependencies

* More test fixing…

* Use upstream Specta instead of fork

* Update comments in Cargo.toml

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-17 15:02:41 -08:00
Ezbaze a50b6b0a09
Fix Subtract Node from adding instead of subtracting (#1614) 2024-02-17 03:06:21 +00:00
Keavon Chambers fc8b41914b
Fix anti-aliasing in overlays by aligning everything with the pixel grid (#1603) 2024-02-13 20:47:16 -08:00
Keavon Chambers 1bf62d92c2 Automatically include all demo artwork in test 2024-02-08 01:15:32 -08:00
Keavon Chambers 12e16b9a4e Add Red Dress demo artwork 2024-02-05 14:41:07 -08:00
zhiyuan e1735ddf84 Fix Select tool's broken undo (#1597)
Fix select tool undo
2024-02-05 14:40:27 -08:00
Keavon Chambers 7e5069f638 Copy to Points node: Add "Random Scale Bias" parameter 2024-02-05 05:31:28 -08:00
zhiyuan 9530e55ace
Split widget callbacks into update and commit so only the latter adds a history state (#1584)
* feat: split commit and update layout

* feat: add on_commit callback

* Code review

* fix: refactor

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-05 01:32:15 -08:00
Nikita-str f25038067e
Path tool: sliding point insertion (#1581)
* #1578 sliding point works(1st approx)

TODO:
* don't move too close to the side points
* double click works incorrect?
* do we need to jump from segment to segment?

* #1578 disallow move slide point too close to side points

* fix double click + ctrl insertion

* #1578 select insertion point (except `ctrl` case)

* #1578 far depends on line width & more accurate seg finding

* #1578 insert point on most top suitable selected layer

* #1581 draw insertion point by overlay  + `Esc` abort

* #1581 sharp stay unchanged on double click

* #1581 fix incorrect handle of scaling

* #1581 `square` selection point & too close in px(instead of magic)

* #1581 bug fix: insertion point on unselection

* #1581 use `color: Option` instead of `SelectionType`

* Some code review, still need to review shape_editor.rs

* #1581 insert sharp point on a straight segment

Also correct insertion on quadratic segments

`ManipulatorGroup::have_handle` have such form because `handle = Some(self.anchor)` often used instead of `handle = None`

* Final code review pass

* Code review pass

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-05 08:45:25 +00:00
zhiyuan a412a77062
Support for deleting points to break path (#1593)
* feat: break closed curve

* feat: update hotkeys and handles

* feat: break an open path

* feat: elegantly handle breaking at multi points in a subpath

* feat: handle break at end points

* feat: ctrl+delete to remove segments and break path

* fix: rm unused

* First code review pass

* fix: closed eclipse handles after breaking path

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-04 21:02:09 -08:00
zhiyuan a4a2680ac4
Freehand tool: Allow extension of existing paths (#1594)
* feat: extend freehand path

* fix: rm logs

* fix: rename variable
2024-02-04 13:36:25 -08:00
zhiyuan 05b4582cd7
Properly handle pen tool undo and redo (#1587)
feat: properly handle pen tool undo and redo
2024-02-04 19:23:48 +00:00