* 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>
* 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
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
- 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
* 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>
* 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>
* 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.
* 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>
* 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>
* 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>
* 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>
* Create a history step when importing SVG files
* Removed additional usvg::Tree::from_str call based on feedback, used DocumentHistoryBackward in case it fails
* 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>
* 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>
* 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>
* 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>
* #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>
* Cache base64 representation of images when converting to graphic group
* Fix build
* Fix build again
* Actually fix it this time
---------
Co-authored-by: Keavon Chambers <keavon@keavon.com>
* WIP, transforms broken with rot/scale
* Transform around bounding box centre
* Add units and tooltips
---------
Co-authored-by: 0hypercube <0hypercube@gmail.com>
* Add Poisson-disk sampling node and Bezier-rs 0.4 release
* Additional optimizations
* More performance optimizations with help from 0Hypercube
* Add comments
* Display graph errors in the viewport
* Polish up the styling
* Clear click targets while graph can't be rendered
---------
Co-authored-by: Keavon Chambers <keavon@keavon.com>
* Add morph node
* Range slider time parameter, better lerping
* Lerp more fill and stroke parameters
---------
Co-authored-by: Keavon Chambers <keavon@keavon.com>
* Remove visible field from LegacyLayer
* Remove LegacyLayer wrapper around LegacyLayerType
* Remove FolderLegacyLayer and LayerLegacyLayer wrappers around their data
* Remove legacy layers
* Port gradient tool overlays
* Fix tests
* Text tool
* Artboard tool and some of select tool
* Port select tool drawing box
* Pen and path tool
* Remove overlays document
* Show the overlay refactor as done on the website roadmap
* Select tool bounds in layer space (first layer)
* Code review and fixes
---------
Co-authored-by: Keavon Chambers <keavon@keavon.com>
* Allow generic node input for type inference
* Make imaginate resolution picking depend on the image resolution instead of the transform
* Remove dead code
* Fix console spam after crash
* Fix crash when disconnecting Imaginate node input
* Update Imaginate tool tooltip
---------
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
* Fix crash when drawing on a deleted artboard
* Fix clear artboards button
* White background on no artboards
* Re-disable Clear Artboards since it still crashes
---------
Co-authored-by: Keavon Chambers <keavon@keavon.com>