Commit Graph

452 Commits

Author SHA1 Message Date
asyncth
dbc19912ca Set the mouse cursor in the canvas based on the current tool and its state (#480)
* Add FrontendMouseCursor and DisplayMouseCursor

* Add update_cursor method to the Fsm trait and implement it for all tools

* Rename DisplayMouseCursor to UpdateMouseCursor

* Add 'To CSS Cursor Property' transform decorator and change the mouse cursor in the canvas based on the current tool and its state

* Implement update_cursor for Navigate tool properly

* Keep the cursor when dragging outside of the canvas

* Change the mouse cursor to 'zoom-in' when LMB dragging on canvas with Navigate tool

* Rename FrontendMouseCursor to MouseCursorIcon

* Rename 'event' to 'e' and replace v-on with @

* Change the definition of the MouseCursorIcon type in TS

* Replace switch with dictionary look-up

* Move the definition of MouseCursorIcon closer to where it's used
2022-01-15 23:57:03 -08:00
Keavon Chambers
9b36e6a909 Fix all remaining Vue/TS errors flagged in Volar 2022-01-15 18:04:34 -08:00
Keavon Chambers
2cc39cdb37 Tweak whitespace around use statements and other lint fixes 2022-01-15 12:55:51 -08:00
Keavon Chambers
fa390c3875 Change canvas artboard background color to be 1 shade lighter 2022-01-15 06:35:06 -08:00
Keavon Chambers
ea2d003484 Modify all message enum data to use named struct values, not tuples (#479)
* Massively reorganize and clean up the whole Rust codebase

* Modify all message enum data to use named struct values, not tuples
2022-01-14 20:54:38 -08:00
Keavon Chambers
9b6cbb5f50 Massively reorganize and clean up the whole Rust codebase (#478)
* Massively reorganize and clean up the whole Rust codebase

* Additional changes during code review
2022-01-14 14:58:08 -08:00
Keavon Chambers
a535f5c1c1 Sort messages and message handlers 2022-01-12 16:17:40 -08:00
Keavon Chambers
e70858884d Standardize FrontendMessage message names 2022-01-12 14:16:13 -08:00
Keavon Chambers
0b4934b4f3 Rename document_file.rs to document_message_handler.rs 2022-01-12 12:45:07 -08:00
Keavon Chambers
ec7bf4a771 Rename DocumentsMessage to PortfolioMessage 2022-01-12 12:19:14 -08:00
Keavon Chambers
0991312ba0 Rename document_message_handler.rs to portfolio_message_handler.rs 2022-01-12 11:57:36 -08:00
0HyperCube
c76c92e500 Migrate to using MoveSelectedLayersTo (#469)
* migrate to using MoveSelectedLayersTo

* Fix dragging a selected layer with multiple selected layers

* Fix CreatedLayer overriding selection

* Fix MoveSelectedLayersTo behaviour

* Squashed commit of the following:

commit 095d577a49
Author: Keavon Chambers <keavon@keavon.com>
Date:   Mon Jan 10 18:06:12 2022 -0800

    Fix NumberInput clamping regression with undefined bounds

commit 9f54a376c4
Author: mfish33 <32677537+mfish33@users.noreply.github.com>
Date:   Sun Jan 9 15:52:55 2022 -0800

    Fix bounds with artboards for zoom-to-fit and scrollbar scaling (#473)

    * - document load keeps postition
    - zoom to fit
    - scrollbars use artboard dimensions

    * - review comments
    - svg export uses all artboard bounds

    Co-authored-by: Keavon Chambers <keavon@keavon.com>

commit 61432de480
Author: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
Date:   Sat Jan 8 21:06:15 2022 +0000

    Fix rotation input (#472)

* Fix insert with no nesting at end of panel

* Deselect other layers on paste

* Resolve logging
2022-01-12 19:05:55 +00:00
Keavon Chambers
574028375b Add npm start script alias for npm run serve 2022-01-12 06:14:32 -08:00
Keavon Chambers
75e8fc6614 Switch VS Code's Vue extension from Vetur to Volar 2022-01-12 05:17:56 -08:00
Keavon Chambers
389b445ef1 Remove Charcoal references from the code for now 2022-01-12 03:56:28 -08:00
Keavon Chambers
095d577a49 Fix NumberInput clamping regression with undefined bounds 2022-01-10 18:06:12 -08:00
mfish33
9f54a376c4 Fix bounds with artboards for zoom-to-fit and scrollbar scaling (#473)
* - document load keeps postition
- zoom to fit
- scrollbars use artboard dimensions

* - review comments
- svg export uses all artboard bounds

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-01-09 15:52:55 -08:00
0HyperCube
61432de480 Fix rotation input (#472) 2022-01-08 13:06:15 -08:00
0HyperCube
3eeac79f5a Enhance the Navigate Tool zoom behavior (#461)
* Snap zoom

* Navigate zoom from centre

* Ctrl to snap zoom in navigate

* Use ctrl for global snap rotate

* Fix the rotation input on snap rotate

* Update hint to use ctrl

* Fix mouse centre on drag

* Click to zoom in

* Clean up centre zoom

* Update user input hints; tweak some variable names for clarity and standardization

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-01-08 08:30:03 -08:00
0HyperCube
a2c2f7fc9d Add support for resizing workspace panels (#443)
* Resize panels

* Removing move_selection test pending #444 resolved

* Bind event listners and cursor to the document

* Fix flex grow on document being reset when drawing

* Call onresize when the boundry is dragged

* Add min panel size

* Add explicit function return types

* Dispatch resize event

* Lock pointer instead of setting cursor on document

Co-authored-by: otdavies <oliver@psyfer.io>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-01-08 08:02:02 -08:00
mfish33
54e9121115 Implement artboards and document version enforcement (#466)
* - graphite document artboard implementation
- autosave document load hitch fix
- Autosave will delete saved files when graphite document version changes

* formating

* - top left 0,0
- fixed hitch on first document
- vue calls first render

* Revert

* Merge branch 'master' into artboards

* Small bug fixes and code review tweaks

Co-authored-by: Oliver Davies <oliver@psyfer.io>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-01-08 07:50:08 -08:00
Leonard Pauli
11f15bd6af Path Tool: Implement anchor point dragging (#451)
* #82 path-tool: WIP selecting control point working

* Fix bug where duplication with Ctrl+D doesn't properly duplicate (#423)

* bug fix: duplication didn't properly duplicate

* cargo fmt

* changed the formatting slightly for readability

* Small cleanups, changed color of handles upon selection

* Fix changes from merge

* Remove duplicate anchor points on top of one another

* Fix possible issues with thumbnails not being updated from Graphene operations

* path-tool: attempt to move control points on click

* Add dragging for control points

* Editing shape anchors functional. Handles next.

* Comment cleanup & slight cleanup of closest_anchor(..)

* Removing conflict with master

* Tiny code tweaks

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: caleb <56044292+caleb-ad@users.noreply.github.com>
Co-authored-by: otdavies <oliver@psyfer.io>
Co-authored-by: Dennis <dennis@kobert.dev>
2022-01-08 05:25:24 -08:00
Keavon Chambers
05e8a98f46 Redesign the Layer Tree UI (#468) 2022-01-07 23:13:33 -08:00
Oliver Davies
8e3d237228 Ungroup layers (#465)
* WIP handling corner cases, like ungrouping subfolders

* Resolved hanging

* Fix recursive ungrouping

* Functional, corner case free Ungroup. Small Undo issue & warnings

* Update layertree upon undo

* Also update  layerdata upon redo

* Add some polish

* Resolved TODOs

* Oops didn't save all after rename, ha.

Co-authored-by: Dennis <dennis@kobert.dev>
2022-01-07 15:53:12 -08:00
TrueDoctor
c1c7192948 Tidy up path handling in document_file (#464)
* Tidy up path handling in document_file

+ Improve #455

* Cargo Clippy lints

* Rename to_vec to map_to_vec

Co-authored-by: Oliver Davies <oliver@psyfer.io>
2022-01-06 19:15:08 -08:00
mfish33
f4707f9b74 Better decimal rounding in the NumberInput widget (#457)
* better decimal rounding in NumberInput

* - created function to reuse
- used math instead of string manipulation

* updated comment to be correct

* updated comment

* updated comment
2022-01-06 18:45:37 -08:00
Keavon Chambers
0219f060b8 Fix build script to use correct branch name 2022-01-05 05:42:30 -08:00
Oliver Davies
6a2ae55702 Fix group creation parenting (#455)
* WIP fix of folder crash / indent

* Fixed most crashes

* Known cases of crash / incorrect behavior resolved

* Removed todo & readability tweak

* Removed left over test

* Resolved clippy issue resulting from merging master

* Replace recursive tree traversal with prefix matching

* Reverted changes for #453 and added undo functionality to Paste

* Make uuid generator thread local for tests

* Maintain layer order, test still failing 50% of the time

* Reverting back to known working with the knowledge we can optimize later.

This reverts commit 1aaf5c0d7d.

* Revert "Make uuid generator thread local for tests"

This reverts commit d68e3b9c4e.

* Revert "Reverted changes for #453 and added undo functionality to Paste"

This reverts commit d66992ac94.

* Revert "Replace recursive tree traversal with prefix matching"

This reverts commit 6bcbb9f82f.

* Reverted to working state and added comment back to optimized commit hash

* Re-removed the changes involving #453

Co-authored-by: Dennis <dennis@kobert.dev>
2022-01-04 19:18:28 -08:00
mfish33
7da03d7ddd Fix to send panic message to all editor instances immediately upon crash (#460) 2022-01-03 13:15:43 -08:00
Keavon Chambers
463ff1a9d8 Vue/TS bug and bad typing fixes 2022-01-02 20:02:35 -08:00
Keavon Chambers
c64f858387 Major frontend code cleanup (#452)
Many large changes, including:
- TypeScript enums are now string unions throughout
- Strong type-checking throughout the TS and Vue codebase
- Vue component props now all specify `as PropType<...>`
- Usage of annotated return types on all functions
- Sorting of JS import statements
- Explicit usage of Vue bind attribute function call arguments (`@click="foo"` is now `@click=(e) => foo(e)`)
- Much improved code quality related to the color picker
- Consistent camelCase Vue bind and v-model attributes
- Consistent Vue HTML attribute strings with single quotes
- Bug fix and clarity improvement with incorrect hint class parameters
- Empty Vue component objects like `props: {}` and `components: {}` removed
2022-01-02 06:00:02 -08:00
Keavon Chambers
90d725f682 Rename Editor's LayerData to LayerMetadata 2021-12-31 00:02:29 -08:00
Keavon Chambers
5a184a179c Fix all clippy lint errors 2021-12-30 23:05:54 -08:00
0HyperCube
401bba878a Add navigate tool (#441)
* Remove transformations from layerdata

* Clean up snap rotate

* Enable the navigate tool

* Implement navigate tool

Co-authored-by: otdavies <oliver@psyfer.io>
2021-12-30 19:43:26 -08:00
0HyperCube
1c834ba67f Remove transformations from LayerData (#439)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2021-12-30 19:10:30 -08:00
0HyperCube
4689e47e50 Fix one item folders (#442) 2021-12-31 01:00:31 +01:00
Keavon Chambers
dfa303a139 New overlay system that reimplements how overlays are drawn (#418)
* New overlay system that reimplements how overlays are drawn

* Fix overlay message declaration

* Fix small mistake

* WIP (broken) changes to plumb the overlay document

* Fix confusion over messaging system architecture

* Removed log

* Overlay system working

* (broken) WIP overlay association

* Finish the overlay system (except test failure)

* Change back IDs in test

* Fixed test, but stilled fails due to revealed real problem with layer reordering selection

* Disable broken test that has a bug in issue #444

Co-authored-by: Dennis <dennis@kobert.dev>
Co-authored-by: otdavies <oliver@psyfer.io>
2021-12-30 09:48:39 -08:00
0HyperCube
cc560cb83b Drag to rearrange layers in the layer panel (#434)
* Add insert line

* Implement dragging

* Improve CSS and variable naming consistency

* Resolved folder crash, added Undo/Redo support

* Removed marker TODO leftover

* JS cleanup

* WIP preserving expanded state (via LayerData) when copy/pasting and moving layers in layer panel

* Finish making folders copy/paste preserving expanded state, but not recursively yet

* Add cut, copy, and paste to the Edit menu (#440)

* Add cut

* Hook up edit dropdown

* Use copy message

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: otdavies <oliver@psyfer.io>
2021-12-30 09:18:18 -08:00
0HyperCube
62fc88264e Add cut, copy, and paste to the Edit menu (#440)
* Add cut

* Hook up edit dropdown

* Use copy message
2021-12-30 11:02:57 +00:00
0HyperCube
82e63ea167 Populate layer entry cache (#437)
* Populate layer entry cache

* Serialize the DocumentMessageHandler

* Fix restoring of collapsed/expanded state, add iter impl for Layer, and clean up layer_data() functions

* Fixed bug with CreateEmptyLayer revealed by test

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: otdavies <oliver@psyfer.io>
2021-12-28 20:32:44 -08:00
Oliver Davies
612732fa67 Fix the File > Close All crash (#438) 2021-12-28 19:40:00 -08:00
0HyperCube
9ee95d4c57 Remove snap rotate from layerdata (#435) 2021-12-28 18:30:41 +01:00
0HyperCube
573468db7d Update intoiter syntax (#436)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2021-12-28 05:10:22 -08:00
TrueDoctor
eac9999303 Change the select tool to immediately start dragging when clicking a shape (#424)
* Change the select tool to immediately start dragging when clicking a shape

* Fix operation order

* Fix holding shift to add to selection
2021-12-28 14:05:02 +01:00
TrueDoctor
b142423669 Implement multiple clipboards (#425)
* Imeplement multiple Clipboards

* Cargo fmt

* Fix unit tests

* Fix console error caused by the Pen Tool (#432)

* Fix error in pen tool

* Cleanup

* Split make operation and remove preview

Co-authored-by: Keavon Chambers <keavon@keavon.com>

* Fix line centering (#431)

* cargo fmt

Co-authored-by: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
2021-12-27 21:17:41 -08:00
0HyperCube
0e24c7d25b Fix line centering (#431) 2021-12-27 20:29:05 -08:00
0HyperCube
3aa08ce691 Fix console error caused by the Pen Tool (#432)
* Fix error in pen tool

* Cleanup

* Split make operation and remove preview

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2021-12-27 20:06:02 -08:00
0HyperCube
b391b038ee Snap while dragging with select tool (#433)
* Snap while dragging with select tool

* Remove unnecessary mut

* Snap to 90 degrees instead of 45

* Removed (coming soon) text

Co-authored-by: otdavies <oliver@psyfer.io>
2021-12-27 14:29:27 -08:00
0HyperCube
618b7f755c Fix Ctrl+scroll wheel zoom point relative to the mouse position (#429)
* Fix zoom

* Cleanup maths
2021-12-27 03:30:42 -08:00
mfish33
7e7c499995 Implement IndexedDB document auto-save (#422)
* removed all use of document indicies

* -add u64 support for wasm bridge

* fixed rust formating

* Cleaned up FrontendDocumentState in js-messages

* Tiny tweaks from code review

* - moved more of closeDocumentWithConfirmation to rust
- updated serde_wasm_bindgen to add feature flag

* working initial auto save impl

* auto save is a lifetime file

* - cargo fmt
- fixc error message
- move document version constant

* code review round 1

* generate seed for uuid in js when wasm is initialized

* Resolve PR feedback

* Further address PR feedback

* Fix failing test

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: otdavies <oliver@psyfer.io>
2021-12-27 01:56:47 -08:00