Commit Graph

464 Commits

Author SHA1 Message Date
0HyperCube fe8e1da8ed
Fix deleting the shape node (#1411) 2023-09-02 12:16:38 +01:00
Dhruv a2db95d18b New node: Color Overlay (#1391)
* [wip]feat: implement Color Overlay node's base logic

* [wip]feat: attempt implementing node

* feat: implement naive node logic
- this needs to accommodate coloring the image

* [wip]feat: attempt implementing ColorFillNode

* fix: color fill node implementation path

* Simplify document node definition

* [wip]feat: implement ColorFillNode

- correct the node implementation logic
-[wip]use node in Color Overlay node network

* Remove secondary image input

* chore: perform cleanup and minor optimization

- rename ColorFillNode node to Color Fill
- remove unneeded clone method call

* refactor: optimize node logic and hide optional params

* fix: color fill implementation
- fix broken color fill implementation logic
- add alpha multiplication data to the image

* Fix colour overlay node

* Blend mode

* chore: remove unused import

* Debug logging for overlay

* Use premultiplied alpha

* Comment out logging

* Code review nits

* Remove color debug logging

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-09-02 02:28:05 -07:00
Dhruv 81a7c2dfcf
Reconnect links when deleting a node (#1405)
* fix: avoid deleting inner network's input nodes

* [wip]feat: set primary input on node deletion

- set input's input value to deleted node's primary input

* fix: check deleting node's output is used by other node(s)

* feat: enable conditionally reconnecting input

- user can press a key to avoid reconnecting nodes during deletion

* refactor: improve and restructure code

- make code quality improvements
- add NodeGraphHandlerData struct to replace big tuple

* fix: avoid deleting inner network's input nodes

* [wip]feat: set primary input on node deletion

- set input's input value to deleted node's primary input

* fix: check deleting node's output is used by other node(s)

* feat: enable conditionally reconnecting input

- user can press a key to avoid reconnecting nodes during deletion

* refactor: improve and restructure code

- make code quality improvements
- add NodeGraphHandlerData struct to replace big tuple

* Remove unnecessary recursion

* Code review cleanup

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-09-02 08:32:37 +00:00
Keavon Chambers b30488bbb7
Add support for handling MMB/RMB double click inputs (#1407)
* Add support for handling MMB/RMB double click inputs

* Add todo comment

* Enforce types

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
2023-09-01 14:57:03 -07:00
Keavon Chambers a112ab27cf
Dialog redesign and content revamp (#1409)
* Revamp the content and design of dialogs

* Add the Licenses dialog
2023-09-01 01:58:20 -07:00
Chase 5acb2cff06
New nodes: Resample Points, Spline from Points (#1226)
* Create node (no implementation)

* Resampling - WIP

* use bezier::from_linear_dvec2

* Use from anchors instead of Bezier

* Tidy up anchor collection & subpath creation

* Add Spline from Points node (not implemented)

* Add spline from points node implementation

* Update resampling

* Update minimum density 0.01 -> 1.0

* Add a way to create a custom vector network

* Add spline from points node to spline tool

* Fix crash when no points

* Add anchor method to subpath

* Exact start and end point

* Fix compile errors from rebase

* Fix spline tool

* Rename 'Density' to 'Spacing'

* Fix transforms

* Only close subpaths with >1 anchor

* Fix compile

* Fix compile error

* Fix from points with many subpaths

* Fix new_cubic_spline crash with one point

* Rename to resample as polyline

* Fix div zero

* Fix missing file

* Fix resample

* Rename to resample points

---------

Co-authored-by: hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-30 05:21:39 -07:00
isiko 3419e739af
New nodes: Logical boolean operations (OR, AND, XOR, NOT) (#1399)
* Add Boolean Operations Nodes

Adds OR AND XOR and NOT operators

* Fix operand naming

Inputs to the 'Min' 'Max' 'Equality' and boolean operations nodes were
previously named 'First' and 'Second' and are now called 'Operand A' and
'Operand B'

* Rename Equality to Equals

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-29 23:55:14 -07:00
mobile-bungalow 48fdaddc37
Add Path tool options for editing X/Y point coordinates (#1404)
* implement path point selector in toolbar

* Transform point to art board space

* fix handle adjustment space

* remove unused branches

* tidy comments

* make function names more descriptive, add guards, fix comments

* add auxillary message for layout update

* change trace to warn, remove unneccessary messages, fix rustfmt

* rustfmt

* support handles

* style and dimensions corrections

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-29 21:41:01 -07:00
Prikshit Gautam fb1922b49d
Clean up and suppress Clippy warnings (#1402)
* fix: clear and suppress clippy warnings

* Simplification

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-27 16:56:53 -07:00
0HyperCube e77782aadb
Remove console spam (#1400)
* Remove console spam

* CSS Style

* Slight cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-27 16:12:32 -07:00
Ezbaze 226b96260c
New nodes: shape/curve primitives (#1389)
* Add new Primitive Shape/Curve Nodes

* Elipse Node and Debug

* N-input Spline node

* Debuging

* Debug

* fmt

* remov debug

* Changes from code review

* Debug: Empty Spline Input

* Changes from code review

* Fix spelling of ellipse

* Rename polygon to regular polygon

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-27 14:22:09 -07:00
0HyperCube b881385e3b
Update wasm-bindgen, syn and wgpu (#1398) 2023-08-23 14:53:56 +00:00
Keavon Chambers 0dcfafbf64 Add demo artwork 2023-08-22 03:26:59 -07:00
Keavon Chambers 8fbf0cbb69 Improve the Circular Repeat node 2023-08-19 22:46:44 -07:00
Keavon Chambers 980b692d46 Fix graph view button hotkey tooltip; fix layer CSS bug 2023-08-19 17:04:09 -07:00
isiko a566331f1c
New node: Pixel Noise (#1267)
Add Pixel Noise Node

Currently only White Noise is implemented, but the Code is written so that other's can be added easily
2023-08-19 11:30:03 -07:00
Keavon Chambers 185106132d Move node graph from panel to overlay on viewport 2023-08-19 01:21:37 -07:00
Keavon Chambers 5a7d230156 Improve the layers UI in the node graph 2023-08-18 14:26:59 -07:00
isiko 7558088727
Add more advanced math nodes (#1383)
Added nodes for the following operations:

* Floor
* Ceil
* Round
* Absolute Value
* Logarithm
* Natural Logarithm
* sin
* cos
* tan
2023-08-14 13:43:17 +00:00
xkef c9d3453e46
Fix undo not immediately removing copy/pasted layer (#1381)
Bugfix: Undo does not work when copy/pasting layers (or groups), it should remove the layer that was pasted
2023-08-13 12:47:43 -07:00
Dennis Kobert 752df128e3
Don't include the document node path in the stable node id by default (#1388)
* Don't include the document node path in the stable node id by default

Make the inclusion of the document path for the stable node id optional
and only enable it for the MonitorNode for now

* Fix tests
2023-08-13 10:25:42 +00:00
nat-rix dc4b16aead
Curves image adjustment node (#1214)
* Create ValueMapperNode and use it for brightness/contrast

* move spline code into seperate module

* Add GenerateCurvesNode

* add a `LuminanceMut`-trait
* add `lerp` to `Channel`

* Add frontend code to handle the curves widget's inputs

* Rename spline module to curve

* Make messages in CurveInput pass

* Improve curves widget design and fix sizing issue

* Implement proper bezier handling

* Use bezier_rs's intersections function instead of own cubic root solver

* Debounce CurveInput events and change how debouncer works

the first event issued to the debouncer was unneccessarily delayed.
Instead now the debouncer fires it instantaneously but blocks events
that come in until a timeout was reached.

* Make curve editing more user friendly

* Change code to use project terminology

* sample -> manipulator group or manipulator
* marker -> handle

* Fix small documentation mistake in bezier-rs

* Add find_tvalues_for_x function to bezier-rs

also integrate the function into curves node

* Add tests for find_tvalues_for_x in bezier-rs

* Fix formatting

* Revert BrightnessContrastNode changes

* Frontend cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-08-13 01:07:11 -07:00
Omar Magdy fd338c945f Fix crash from overflowing values given to NumberInput widgets (#1377)
* Added hints for brush tool size

* Added hints for brush tool size

* Solved the user being able to crash the editor by overflowing NumberInputs
2023-08-11 12:26:37 -07:00
Dhruv 1c11ebcc4e Correct snapping offsets after canvas transformation when using snap-reliant tools (#1370)
* fix: pen, spline tool incorrect snap offsets
- re-render snapping offsets if canvas transformed during line draw

* [wip]feat: add CanvasTransformed global message

* [wip]fix: synchronize line tool snap offsets

* fix: update offsets for shape tools on canvas transform

* chore: remove unneeded function parameter

* [wip]fix: use line tool at canvas level

* refactor: revert line tool changes
2023-08-11 12:26:19 -07:00
isiko 2377240d07 Add more math nodes (#1378)
* Adds Max, Min and Equal Nodes

* Add LogToConsoleNode

Logs the data given as the input to the browser console and returns it
as the output
2023-08-11 12:26:13 -07:00
isiko 77e5ec9d4f
Add bounding box node (#1376)
* Add bounding box node

Generates a rectangle based on the bounding box of the input vector data

* Remove redundant <>

* Fix formatting

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-08-08 18:44:14 +02:00
isiko f57fa2e7c9
Add Circular Repeat Node (#1373)
* Add Circular Repeat Node

Repeats a given set of Vector Data in a circular pattern a specified
amount of times.

* Remove debug statement from RepeatNode
2023-08-08 16:13:44 +00:00
Ezbaze 5c08248681
Additional Input and Math Nodes (#1369)
* Add Input Nodes and additional Math Nodes

* Add add node to node registry

* Update node-graph/gcore/src/ops.rs

Co-authored-by: Dennis Kobert <dennis@kobert.dev>

* Fix Color Input Node

Wrong input type

* Remove non Parameter variants

* Remove non Parameter variants

* Remove non Parameter variants

* Apply suggestions from code review

* mod to modulo

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-08-08 17:31:50 +02:00
Dennis Kobert e32d4c29c4
Fix shapes only showing up as outlines on document load (#1375)
No longer treat a graphic group as an error
2023-08-08 14:07:39 +02:00
Dennis Kobert 388d51deac
Add Vector Repeat Node (#1371)
* Implement skeleton for repeat node

* Implemen RepeatNode
2023-08-07 14:59:58 +02:00
Omar Magdy 8b9f279f12
Add hints for Brush tool resizing (#1363)
Added hints for brush tool size
2023-08-06 15:32:06 -07:00
Dennis Kobert 3262f637d1
Decrease graph compilation time significantly (#1368)
* Decrease compilation time significantly

* Refactor reorder_ids method to improve performance
2023-08-06 21:36:44 +02:00
Keavon Chambers 3450d638a6
Layer-based nodes redesign, just the basics so far (#1362)
* Redesign the nodes

* Basic vertical stacking syntax sugar

* Fix node connections

* Primary output and line thickness

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
2023-08-04 14:56:00 -07:00
Dhruv 50b67bf6f6
Fix Text Tool Overwriting Existing Text on Editing Text Layer (#1356)
fix: text edit overwriting existing text
2023-08-03 17:08:49 +01:00
Ezbaze 40c26af564
Fix stuck panning after releasing space bar but not LMB (#1353)
Remove modifier from lmb keydown
2023-08-02 22:48:05 -07:00
Keavon Chambers 2b05e1c270 Rename Shape tool to Polygon tool 2023-08-01 01:28:14 -07:00
Keavon Chambers b9e49623a3 Rename PropertyHolder to LayoutHolder 2023-08-01 00:46:30 -07:00
Keavon Chambers 8e87e42f3e Remove widgets built by methods on WidgetHolder 2023-07-31 23:36:12 -07:00
0HyperCube de27f2c006
Switch to the widget builder pattern on all remaining layouts (#1346)
* Prefer widget builder pattern

* Nits

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-31 23:21:42 -07:00
0HyperCube 2b9337406a
Fix artboard thumbnails (#1342)
* Fix artboard thumbnails

* Use GraphIdentifier instead of option

* Fix warnings introduced by artboard nodes
2023-07-30 19:37:37 +00:00
Keavon Chambers f151ba39b5
Add checkbox for a transparent BG when exporting image (#1344) 2023-07-30 10:57:07 -07:00
Christopher Mendoza 3f7d484398 Select tool's shallowest behavior improvements and refactoring (#1108)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-28 18:23:14 -07:00
Shouvik Ghosh 6d2ae02c19 Hide snapping overlays when snapping to a point (#1260)
Hide snap points/lines if we snap to a point
2023-07-29 05:25:34 +05:30
Dennis Kobert a49d96ed37 Embed git commit hash in the document file (#1325)
* Embed git commit hash in the document file

* Bump version in test document file

* Fixes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-28 22:52:26 +02:00
Dhruv 8bdc64bb8b Fix Transform node missing its Rotation slider (#1337)
* fix: transform node missing rotation slider

* chore: move variable's value in-line
2023-07-29 01:14:29 +05:30
0HyperCube 08f9be6aaf Artboard nodes (#1328)
* Create artboard nodes

* Update node when resizing artboard

* Render clipped artboards

* More stable feature

* Do not render old artboards

* Fix some issues with transforms

* Fix crash when drawing rectangle

* Format

* Allow renaming document from Properties panel

* Adjust artboard label styling

* Fix document graph refresh so artboards show up

* Make "Clear Artboards" coming soon

* Fix displaying an infinite canvas

* Show document name in node graph options bar

* info!() to debug!()

* Fix Properties panel not being cleared when all docs closed

* Remove dead code

* Remove debug logs added in this branch

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-27 07:35:17 +01:00
Dhruv ad0dc3276e Show disabled menu bar entries with no active document (#1332)
Making the change as advised. This change will allow the user to see all possible submenus without being able to use them if there is no active document.
This somewhat reverts the behaviour of one previous PR.
2023-07-27 11:26:37 +05:30
0HyperCube 80cc5bee73 Fix clippy lints (#1327)
* Fix clippy lints

* Update formatting

* Remove unsafe send impls

* New type for Rc<NodeContainer>
2023-07-19 16:38:23 +01:00
Dhruv 743803ce04 Add Snapping Options to the Snap Dropdown Menu (#1321)
* [wip]feat: add snapping options

* [wip]fix: use svelte component for optionsWidget

* fix: use apt PopoverButton types

* refactor: minor formatting improvements

* Fix popover layout

* [wip]feat: attempt implementing CheckboxInputData struct

* fix: use correct Checkbox struct 's default method

* fix: revert adding CheckboxInputData struct

- This reverts commit 2a481887fc89a94a459ef57ba4ab3024d3b60aa1.

* feat: use checkboxes for snapping options

* feat: add label to dropdown checkbox elements

* fix: separate Snap dropdown menu elements
- move each element into separate row

* [wip]feat: modularize snapping states
- maintain individual snapping states for document

* fix: snapping checkboxes' behavior
- checkboxes now update internal snapping state

* refactor: update snap states individually
- this prevents out-of-sync states
- enables reusing existing snap state object

* feat: snap to boxes and nodes conditionally

* [wip]feat: attempt to invert checkbox on update
- attempt implementing mutable WidgetCallback struct
- attempt using above struct to invert checkbox state on update

* Fix widget diffing

* refactor: remove unused code

* feat: align checkboxes consistently with labels

* feat: use separators to stylize snapping menu
- removes need for custom CSS and label property
- ensures consistency across the application

* refactor: remove unneeded css

---------

Co-authored-by: hypercube <0hypercube@gmail.com>, TrueDoctor <dennis@kobert.dev>
2023-07-15 15:07:18 +05:30
Dennis Kobert 4c9daadb01 Move Imaginate cache into the node 2023-07-14 16:40:56 +02:00