mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 06:38:12 +08:00
108b8be59536e07733fbbe40113445c9c9d8694b
14
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
108b8be595 |
Overhaul Path Tool (#498)
* First pass cleanup omw to handles * Handles dragging with anchors, handles still not draggable and some bugs * Dragging single side of handle works, need to create mirror case * In progress addition of improved anchor / handle representation * partially working * Handle dragging working for non-end points, normal anchor drag bugged * Fixed corner cases, fixed anchors without handles bug * Add snapping * Change path tool selection by clicking on shape * Fixed path close point being draggable * Variable length handle, firstpass of alt to stop mirroring * Alt improved, not done. Only update structures when needed. Added snapping for selected shapes * Can now undo path edits * Do not maintain angle between non-mirrored handles * Replaced segment based overlay setup with anchor based setup * Cleanup, handle angle comparison bug remains. Investigating. * Added OverlayPooler. May closely associate overlays to VectorManipulatorAnchors instead. * Moved anchor / segment creation logic out of document_message_handler * Overlays are now managed by VectorManipulatorShapes * Fixed inconsistent handle mirroring. * Clearly shows which point you have selected * Removed OverlayPooler system * Added more comments * Removed all clones of the vector structures. A little uglier but better. * Resolved Text path initialization bug with a workaround. * Cleaned up comments * More comment cleanup * Fixed issue with quad handle dragging unwanted behavior, renamed VectorShapeManipulator * In progress refactor to allow multi-selection * In progress dragging multiple points, selection works, transform still has issues * Added Multiselect, major refactor * Commented out progress for selection change, bug with hop back on multiple shapes * Removed debug og * Resolved issue with merge * Minor cleanup, added a few comments * Review changes * Resolved unclear comment * Fixed snap back for now * Add todo comment for future snap back fix * Working situations where curve paths do not close. Thanks for points it out @pkupper * Tweaked selection size * Fix curve start point dragability, renames, cleanup * Separated into multiple files, applied @TrueDoctor review feedback * Resolved tests failing due to doc generation * Re-added closed, added concept of distance mirroring * Added shift distance mirroring, removed debounce from anchor Co-authored-by: Keavon Chambers <keavon@keavon.com> Thank you for the reviews @TrueDoctor and @pkupper |
||
|
|
599a9d076b |
Transformation cage (#502)
* Render corners and edges of selection box * Refactor * Add drag detection * Implement the transform handles * Implement rotation by dragging <40px from bounds * Refine clustered handle behaviour * Add cursors * Add snap angle * Fix MMB drag whilst in select tool * Convert calculate_pivot into a seperate function * rename start_vec to start_offset * Fix typo * Remove Undo transaction on <10px mouse move Co-authored-by: Keavon Chambers <keavon@keavon.com> |
||
|
|
3bf5023ef8 |
Add alignment overlays (#462)
* Add alignment overlays * Made snapping / overlays not render extra times, made snapping distance larger * Revert snap tolerance change until user testing can be done * WIP conversion to messages * Revert "WIP conversion to messages" This reverts commit |
||
|
|
f48d4e1884 |
Massively reorganize and clean up the whole Rust codebase (#478)
* Massively reorganize and clean up the whole Rust codebase * Additional changes during code review |
||
|
|
9d2718006f |
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> |
||
|
|
439418896a |
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> |
||
|
|
c548bd9584 |
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> |
||
|
|
0e33498b9b |
Layer snapping
* Test snapping * Snap new shapes * Fix snapping when zoomed * Refactor to use viewport bounds * Reduce snap tolerance to 3 * Snap line and path tool * Add disable snapping and refactor * new_snap -> new status * Rearrange import * Cleanup * Fix incorrect variable name * Store snap data in tool data |
||
|
|
134381f1bc |
(G)rab, (R)otate, and (S)cale layers with hotkeys (#356)
* Add handler and input mapping. * Selecting transform type * Add translation and axis constraints * Remove unnecessary Key:: * Add rotation * Centre pivot point for rotation * Add scaling * Select Tool bounding box now updates when transforming * Add typing * Shift to slow mouse movements * Add snapping * Refactor modifier keys * Refactor to apply only 1 operation per frame * Refactor to fix scale 0 issue * Remove logging * Avoid multiple decimol points in queue * Add typing negative * Add typing negative values * Fix bounding box on apply/abort; fix some variable names * Allow transform to daffine2 identity * Revert previous operation when changing operation * Remove repopulate transforms method * Code readability tweaks Co-authored-by: Keavon Chambers <keavon@keavon.com> |
||
|
|
e75714330c |
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> |
||
|
|
6deecad9c0 |
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 |
||
|
|
42c3b1f6e9 |
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.
Example document:
```json
{
"nodes": {},
"root": {
"blend_mode": "Normal",
"cache": "...",
"cache_dirty": false,
"data": {
"Folder": {
"layer_ids": [
3902938778642561358
],
"layers": [
{
"blend_mode": "Normal",
"cache": "...",
"cache_dirty": false,
"data": {
"Shape": {
"path": [
{
"MoveTo": {
"x": 0.0,
"y": 0.0
}
},
{
"LineTo": {
"x": 1.0,
"y": 0.0
}
},
{
"LineTo": {
"x": 1.0,
"y": 1.0
}
},
{
"LineTo": {
"x": 0.0,
"y": 1.0
}
},
"ClosePath"
],
"render_index": 1,
"solid": true,
"style": {
"fill": {
"color": {
"alpha": 1.0,
"blue": 0.0,
"green": 0.0,
"red": 0.0
}
},
"stroke": null
}
}
},
"name": null,
"opacity": 1.0,
"thumbnail_cache": "...",
"transform": {
"matrix2": [
223.0,
0.0,
-0.0,
348.0
],
"translation": [
-188.0,
-334.0
]
},
"visible": true
}
],
"next_assignment_id": 3902938778642561359
}
},
"name": null,
"opacity": 1.0,
"thumbnail_cache": "...",
"transform": {
"matrix2": [
1.0,
0.0,
0.0,
1.0
],
"translation": [
479.0,
563.0
]
},
"visible": true
},
"version": 0
}
```
* 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>
|
||
|
|
22947933b0 |
Improve document zooming to work based on nice steps (#336)
* Improve document zooming to work based on nice steps * Code review improvements |
||
|
|
53ad105f57 |
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)* |