Commit Graph
100 Commits
Author SHA1 Message Date
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
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
Keavon Chambers 05e8a98f46 Redesign the Layer Tree UI (#468) 2022-01-07 23:13:33 -08:00
Keavon Chambers 0219f060b8 Fix build script to use correct branch name 2022-01-05 05:42:30 -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
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
Keavon Chambers c0e675695b Implement input hints based on the active tool state (#388)
* Hook up user input hints to display in the frontend status bar

Closes #171

* MVP hint system based on tool FSM

* Fix hints for Fill and Eyedropper tools

* Add icons for keyboard shortcuts

* Fix hints for Pen Tool

* Cleanup
2021-12-24 01:46:03 -08:00
Keavon Chambers 3155f00483 Fix previous commit by mapping codes to keys 2021-12-23 16:09:04 -08:00
Keavon Chambers aad4aab383 Add a temporary solution to non-Latin keyboards being unusable 2021-12-23 13:29:02 -08:00
Keavon Chambers 9020dd7428 Make the Pen Tool confirm when leaving the tool 2021-12-21 18:48:21 -08:00
Keavon Chambers 8f100b4f0a Skip the web page close confirmation when crashed or in debug mode 2021-12-21 18:43:02 -08:00
Keavon Chambers 583e0e87bc Set Cargo.toml versions to 0.0.0 to avoid version confusion 2021-12-20 14:59:47 -08:00
Keavon Chambers cc0a733f46 Upgrade node packages (#413) 2021-12-20 13:09:24 -08:00
Keavon Chambers 6b26976778 Skip cargo-about in CI to save 5 minutes (#409) 2021-12-20 02:22:19 -08:00
Keavon Chambers 37be856884 Make deployment switch branch from HEAD to master 2021-12-16 03:21:52 -08:00
Keavon Chambers ab049db98f Add the Help > About Graphite dialog with build info
Closes #404
2021-12-16 02:49:36 -08:00
Keavon Chambers d07eab029a Clean up JS message dispatcher and fix a bug thrown on empty-data messages
Fixes bug in #394
2021-12-16 02:49:12 -08:00
Keavon Chambers 50ae24e478 Fix floating menus above scrollable content; they now respect content's preferred width at edges 2021-12-15 04:05:07 -08:00
Keavon Chambers fbefcb614b Update the project readme 2021-12-06 16:53:44 -08:00
Keavon Chambers 2255619a21 Fix bug in last commit that broke when scrolling on SVG elements 2021-12-06 02:55:05 -08:00
Keavon Chambers ee02b124ce Enable vertical scroll wheel on horizontal scrollable containers 2021-12-05 20:05:45 -08:00
Keavon Chambers 267ad207f9 Switch CI and CD scripts to use npm ci instead of npm install 2021-12-05 19:22:57 -08:00
Keavon Chambers 63e9552b4d Fix ESLint configuration triggering an error in the ESLint VS Code extension 2021-12-05 19:22:56 -08:00
Keavon Chambers ca4faabd5c CSS editor layout fixes and scrolling
Major CSS improvements to layout at small screen sizes. By adding min-width: 0 and min-height: 0 on the nested display: flex structure, widgets no longer coerce the whole layout into large-scale resizing. Scrollbars are now used to allow correct overflowing of the tab bar (fixes #177), Document Panel options bar, and tool shelf. Improvements to responsive resizing are also included for viewing the UI correctly on mobile now. Additional small fixes to styling of widget colors and corner roundness. The ruler has been darkened one shade to improve text contrast and aesthetics.
2021-12-04 22:30:07 -08:00
Keavon Chambers 027524833b Switch to Node.js 16 LTS, upgrade TypeScript, ESLint, and other dependencies (#395)
* Upgrade TypeScript, ESLint, and other dependencies

This also cleans up various other files where newer ESLint rules complained

* Set CI and CD to use Node.js version 16

* Small tweak

* Fix CD version printing

* Add nvm version for Cloudflare Pages
2021-11-29 03:32:09 -08:00
Keavon Chambers 7cb80359df Upgrade rustfmt to 2021 edition 2021-11-02 20:08:39 -07:00
Keavon Chambers 36093f4e40 Update various node dependencies (#391) 2021-11-01 02:57:08 -07:00
Keavon Chambers 31ca5fd533 Update notice for Safari users that BigInt64Array is now supported in 15 (#390) 2021-11-01 01:16:19 -07:00
Keavon Chambers c679e8fdc2 Replace vue-svg-loader dependency with simple JS file (fixes a security alert) (#389) 2021-11-01 00:49:44 -07:00
Keavon ChambersandDennis Kobert a6d1a2dd4b Upgrade Graphite to Rust 2021 edition; upgrade dependencies (#387)
* Upgrade Graphite to Rust 2021 edition; upgrade dependencies

* Fix CI

* Move changes to the project Cargo.tomls

* Remove unnecessary 2021 edition upgrade tweak

* Show version number before and after updating rustc

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2021-11-01 00:00:22 -07:00
Keavon ChambersandDennis Kobert 7822151fc7 Hook up layer tree structure with frontend (#372)
* Hook up layer tree structure with frontend (decoding and Vue are WIP)

* Fix off by one error

* Avoid leaking memory

* Parse layer structure into list of layers

* Fix thumbnail updates

* Correctly popagate deletions

* Fix selection state in layer tree

* Respect expansion during root serialization

* Allow expanding of subfolders

* Fix arrow direction

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2021-09-11 17:15:51 -07:00
Keavon Chambers cece89a9eb Add an intentional panic for debug 2021-09-11 09:46:55 -07:00
Keavon Chambers 06cf133324 Change scrollbar drag color 2021-09-11 08:17:05 -07:00
Keavon Chambers b0cadbc439 Additional improvements to license notice formatting 2021-09-06 23:55:51 -07:00
Keavon Chambers b66607e4a2 Auto-generate third-party license notices (#370)
Closes #294
Closes #371
2021-09-06 06:57:35 -07:00
Keavon Chambers 4f84c706f0 Upgrade wasm-pack to 0.10.1 (#369)
Closes #167
2021-09-05 18:43:16 -07:00
Keavon Chambers 0a592b1491 Postpone 0.1 launch in readme from Aug to early Sept 2021-09-01 06:18:43 -07:00
Keavon Chambers e192b0d8e0 Reorganize and clean up the WASM wrapper 2021-09-01 06:10:05 -07:00
Keavon Chambers 636e5d8280 Improve and clean up panic dialog code and wasm wrapper (#368)
Part of #357
2021-09-01 04:09:23 -07:00
Keavon Chambers 51c2494d43 Show a crash dialog when the editor panics (#362)
* Show a crash dialog when the editor panics

Closes #357

* Suppress console usage lints

* Proxy cleanup and comments
2021-08-31 18:34:19 -07:00
Keavon Chambers 9af1d9a7f7 Additional WASM translation layer cleanup 2021-08-31 01:40:11 -07:00
Keavon ChambersandDennis Kobert 9eb48a000c Add folders to frontend and folder creation to backend (#315)
* Add folders to frontend and folder creation to backend

Closes #149

* Add Group keybind

* Add logic to handle expanding of folders

* Send all paths as (u32, u32)

* Add custom serialization for path

* Merge two layer_panel files

* Refactor frontend layer merging

* Fix JS linting

* Update upstream thumbnail changes

* Add paste into selected folder + fix thumbnail dirtification

* Implement CollapseFolder function

* Skip folders on a different indentation level during reorder

* Only reorder within the same folder

* Add folder node icon for folder layers

* Add expand/collapse folder button; partly implement new layer tree design

* Update terminology in the docs

* Add number labels to ruler marks

* Replace promise with await in MenuList.vue

* Miscellaneous minor code cleanup

* Disallow snake_case variable names in frontend

* Add support for saving and opening files (#325)

* Add support for saving a document

This is similar to the "export" functionality, except that
we store all metadata needed to open the file again.

Currently we store the internal representation of the layer
which is probably pretty fragile.

* Add support for opening a saved document

User can select a file using the browser's file input selector.
We parse it as JSON and load it into the internal representation.

Concerns:
- The file format is fragile
- Loading data directly into internal data structures usually creates
security vulnerabilities
- Error handling: The user is not informed of errors

* Serialize Document and skip "cache" fields in Layer

Instead of serializing the root layer, we serialize the
Document struct directly. Additionally, we mark the
"cache" fields in layer as "skip" fields so they
don't get serialized.

* Opened files use the filename as the tab title

* Split "new document" and "open document" handling

Open document needs name and content to be provided so having a
different interface is cleaner. Also did some refactoring to reuse code.

* Show error to user when a file fails to open

* Clean up code: better variable naming and structure

* Use document name for saved and exported files

We pass through the document name in the export and save
messages. Additionally, we check if the appropriate file
suffixes (.graphite and .svg) need to be added before
passing it to the frontend.

* Refactor document name generation

* Don't assign a default of 1 to Documents that start with something
  other than DEFAULT_DOCUMENT_NAME
* Improve runtime complexity by using binary instead of linear search

* Update Layer panel upon document selection

* Add File>Open/Ctrl+O; File>Save (As)/Ctrl+(Shift)+S; browse filters extension; split out download()/upload() into files.ts; change unsaved close dialog text

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>

* Refactor ViewportPosition from u32 (UVec2) to f64 (DVec2) (#345)

* Refactor ViewportPosition from u32 (UVec2) to f64 (DVec2)

* Fix pseudo_hash call

* Replace hash function with proper function for uuid generation

* Cargo fmt

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

* Improve Frontend -> Backend user input system (#348)

Includes refactor that sends coordinates of the document viewports to the backend so input is sent relative to the application window
Closes #124
Fixes #291

* Improve Frontend -> Backend user input system

* Code review changes

* More code review changes

* Fix TS error

* Update the readme

* Make scrollbars interactable (#328)

* Make scrollbars interactable

* Add watcher for position change

* Fix case of data

* Fix updateHandlePosition capitalization

* Clean up class name thing

* Scroll bars between 0 and 1

* Allow width to be 100%

* Scrollbars reflect backend

* Include viewport in scrollbar

* Add half viewport padding for scrollbars

* Refactor scrollbar using lerp

* Send messages to backend

* Refactor

* Use glam::DVec2

* Remove glam::

* Remove unnecessary abs

* Add TrueDoctor's change

* Add missing minus

* Fix vue issues

* Fix viewport size

* Remove unnecessary log

* Linear dragging

* Improve scrollbar behavior (#351)

* Change scrollbar behavior

* Leave space at the end of the scrollbar

* Change mid to center

* Use shorter array initialization

* Add space around scrollbar

* Fix scrollbar spacing

* Smooth end of scrollbars

* Add page up and down

* Page up and down on click in scrollbar track

* Add shift pageup to translate horizontally

* Implement bounding box for selected layers (#349)

* Implement bounding box for selected layers

* Add shift modifier for multi selection

* Fix collapsing of folders

* Add have pixel offset to selection bounding box

* Don't panic on Ctrl + A

* Rename to camel case

* Add todo comment for Keavon

* Apply @Hypercubes review suggestions

* Fix many panics, improve behavior of copy/paste and grouping (but grouping still can panic)

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2021-08-29 08:27:49 -07:00
913b9365e2 Implement anchor and handle point rendering with the Path Tool (#353)
* Implement Path Tool

* Draw a red rectangle where the first point on the shape is

* Correctly render anchors, handles, and connecting lines

* Fix drain() which can panic

* Refactor frontend messages to work as return values not callbacks

* Reduce the number of unnecessary frontend updates

* Fix stack overflow by using a loop

* Group Document Render calls and put them at the end

* Speed hacks for dirtification

* Add performance

* Bunch folder changed updates

* Add triggers to redraw overlays to movement_handler

* Polish the pixel-perfect rendering of vector manipulators

* Restore scrollbars that were disabled

* Cleanup

* WIP Add shape outline rendering

* Fix compiling

* Add outlines to selected shapes

* Fix outlines rendering over handles and anchors

* Fix dirtification

* Add a comment

* Address code review feedback

* Formatting

* Small tweaks

Co-authored-by: Oliver Davies <oliver@psyfer.io>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2021-08-29 00:10:54 -07:00
Keavon Chambers 7513b174e3 Fix bug where swiching to the Fill Tool would trigger a fill operation 2021-08-27 05:06:41 -07:00
Keavon Chambers d6475cfd17 Minor code readability improvements 2021-08-27 03:43:03 -07:00
Keavon Chambers 07cc2c2b54 Improve web infrastructure
Upgrade npm packages that were locked to old versions due to now-resolved problems
Remove unused/unnecessary dependencies and their configurations
Fix VS Code format on save
Fix VS Code removing EOF newline in JSON files in conflict with npm
Remove JSON files from ESLint because it doesn't properly support JSON
Add detailed comments to web-related configuration files
2021-08-27 02:19:30 -07:00
Keavon Chambers 8ab15520d3 Update the readme 2021-08-15 02:40:30 -07:00
Keavon Chambers c15ab1af58 Improve Frontend -> Backend user input system (#348)
Includes refactor that sends coordinates of the document viewports to the backend so input is sent relative to the application window
Closes #124
Fixes #291

* Improve Frontend -> Backend user input system

* Code review changes

* More code review changes

* Fix TS error
2021-08-14 05:38:35 -07:00
Keavon ChambersandDennis Kobert 790647815b Refactor ViewportPosition from u32 (UVec2) to f64 (DVec2) (#345)
* Refactor ViewportPosition from u32 (UVec2) to f64 (DVec2)

* Fix pseudo_hash call

* Replace hash function with proper function for uuid generation

* Cargo fmt

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2021-08-14 02:45:24 -07:00
Keavon Chambers 88255997e8 Disallow snake_case variable names in frontend 2021-08-12 21:49:03 -07:00
Keavon Chambers 84ecfc86de Miscellaneous minor code cleanup 2021-08-12 20:34:36 -07:00
Keavon Chambers 2e8b133023 Replace promise with await in MenuList.vue 2021-08-12 19:25:57 -07:00
Keavon Chambers 9654683d16 Add number labels to ruler marks 2021-08-12 02:55:00 -07:00
Keavon Chambers ef93bed0ec Update terminology in the docs 2021-08-12 00:39:29 -07:00
Keavon Chambers 483f7d5893 Clean up popovers: background color and placeholder text 2021-08-11 23:53:05 -07:00
Keavon Chambers b184f2c974 Revert "Fix floating menu positioning behavior when web page has scrollbars (#263) (#341)"
This reverts commit 02fd00da10.
2021-08-11 23:49:31 -07:00
Keavon Chambers 01e66bcf79 Update npm dependencies 2021-08-10 20:25:21 -07:00
Keavon Chambers b87cd624c7 Fix documentation links 2021-08-10 20:03:30 -07:00
Keavon Chambers d5bc72ca07 Improve document zooming to work based on nice steps (#336)
* Improve document zooming to work based on nice steps

* Code review improvements
2021-08-10 16:21:18 -07:00
Keavon Chambers 67dc9f57ba Upgrade packages and a couple fix warnings 2021-08-09 18:41:29 -07:00
Keavon Chambers 89ee35b831 Add DisplayError to show user errors from the backend 2021-08-08 16:52:09 -07:00
Keavon Chambers fbf2c012c3 Restructure project directories (#333)
`/client/web` -> `/frontend`
`/client/cli` -> *delete for now*
`/client/native` -> *delete for now*
`/core/editor` -> `/editor`
`/core/document` -> `/graphene`
`/core/renderer` -> `/charcoal`
`/core/proc-macro` -> `/proc-macros` *(now plural)*
2021-08-07 05:17:18 -07:00
Keavon Chambers 3a2166375a Refactor RadioInput widget (#332) 2021-08-07 03:15:40 -07:00
Keavon Chambers 63a4ed64c8 Refactor document tab management from Panel.vue into utilities/documents.ts 2021-08-04 12:39:39 -07:00
Keavon ChambersandDennis Kobert 399111df53 Add a selected_layers() function and refactor code to use it (#314)
* Add a selected_layers() function 

* Refactor AlignSelectedLayers

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2021-08-01 10:29:23 +02:00
Keavon Chambers d3958f80fa Add checkbox to MenuBarInput widget 2021-07-31 18:20:51 -07:00
Keavon Chambers ed9883e0d8 Add DialogModal and use it for close confirmations and "coming soon" features (#322)
Closes #269
Closes #196

* Add DialogModal and use it for close confirmations and "coming soon" features

* Code cleanup; add Enter key to accept emphasized dialog button
2021-07-31 14:30:31 -07:00
Keavon Chambers 6064004606 Add TextButton widget (#321) 2021-07-31 04:58:25 -07:00
Keavon Chambers 561eea4560 Fix two small bugs introduced in #311 2021-07-30 18:46:23 -07:00
Keavon Chambers 9fbf6839e0 Add "Sides" label to Shape Tool's options bar number input 2021-07-30 15:45:49 -07:00
Keavon Chambers 0ddc84ba09 Add the ability for NumberInput widgets to display labels
Part of #313
2021-07-29 13:56:45 -07:00
Keavon Chambers edfbc27534 Layer opacity (#312)
Closes #187

* Add layer opacity input

* Improve Rust code cleanliness
2021-07-27 23:15:23 -07:00
Keavon Chambers 8c1532b0eb Add features to NumberInput widget; refactor widgets and tool options (#311)
Closes #310

* Add features to NumberInput widget; refactor widgets and tool options

* Fix swap/reset working colors using @click instead of :action
2021-07-27 18:28:21 -07:00
Keavon Chambers 9e92d48454 Fix antialiasing caused by <svg> width/height 100% 2021-07-25 17:25:39 -07:00
Keavon Chambers 8d444f4b20 Swap "Layer" and "Document" menu bar entries 2021-07-24 01:54:27 -07:00
Keavon Chambers ac7b5dd06e Fix inconsistent whitespace 2021-07-23 17:48:39 -07:00
Keavon Chambers f00601e5a7 Improve various code and docs spelling/grammar 2021-07-23 17:25:05 -07:00
Keavon Chambers bc733acb4c Fix tooltips in Document panel 2021-07-19 18:02:08 -07:00
Keavon Chambers 09f8f4444a Fix dropdown menu widget showing wrong active entry
Fixes #250
2021-07-19 15:03:08 -07:00
Keavon Chambers 131256ba0b Add (nonfunctional) rulers and scrollbars to the viewport (#279)
* Add nonfunctional rulers and scrollbars to viewport

* Switch from DOM divs to SVG lines

* Switch from SVG lines to a single SVG path

* Change variable names
2021-07-17 16:11:52 -07:00
Keavon Chambers 801bae103e Remove outdated todo comment 2021-07-17 03:36:35 -07:00
Keavon Chambers d57bfb87ee Clean up widget type naming conventions 2021-07-16 15:57:42 -07:00
Keavon Chambers 9c68ff2952 Categorize frontend widgets to match design system 2021-07-16 15:37:35 -07:00
Keavon Chambers 5261a373a6 Edit readme with various updates and simplifications 2021-07-16 04:01:32 -07:00
Keavon Chambers 1b37e78d64 Remove CLI client stub 2021-07-15 03:44:57 -07:00
Keavon Chambers 49ce3f0672 Adjust OptionalInput widget design to add back its right border 2021-07-15 01:01:05 -07:00
Keavon Chambers 928ef844c4 Rename tool icons 2021-07-15 00:46:32 -07:00
Keavon Chambers 98f1b123bb Switch all JS imports to absolute paths 2021-07-15 00:34:56 -07:00
Keavon Chambers 64050bc8b3 Make frontend request tab list on initialization 2021-07-15 00:07:21 -07:00
Keavon Chambers c76bb608d3 Cleanup of variable naming 2021-07-14 20:11:51 -07:00