Skip to content

Commit d35722a

Browse files
committed
Squashed commit of the following:
commit dbc1991 Author: asyncth <[email protected]> Date: Sun Jan 16 12:57:03 2022 +0500 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 commit 9b36e6a Author: Keavon Chambers <[email protected]> Date: Sat Jan 15 17:24:58 2022 -0800 Fix all remaining Vue/TS errors flagged in Volar commit 2cc39cd Author: Keavon Chambers <[email protected]> Date: Sat Jan 15 12:55:51 2022 -0800 Tweak whitespace around `use` statements and other lint fixes commit fa390c3 Author: Keavon Chambers <[email protected]> Date: Sat Jan 15 06:35:06 2022 -0800 Change canvas artboard background color to be 1 shade lighter commit ea2d003 Author: Keavon Chambers <[email protected]> Date: Fri Jan 14 20:54:38 2022 -0800 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 commit 9b6cbb5 Author: Keavon Chambers <[email protected]> Date: Fri Jan 14 14:58:08 2022 -0800 Massively reorganize and clean up the whole Rust codebase (#478) * Massively reorganize and clean up the whole Rust codebase * Additional changes during code review commit a535f5c Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 16:17:40 2022 -0800 Sort messages and message handlers commit e708588 Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 14:16:13 2022 -0800 Standardize FrontendMessage message names commit 0b4934b Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 12:45:07 2022 -0800 Rename document_file.rs to document_message_handler.rs commit ec7bf4a Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 12:19:14 2022 -0800 Rename DocumentsMessage to PortfolioMessage commit 0991312 Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 11:44:49 2022 -0800 Rename document_message_handler.rs to portfolio_message_handler.rs commit c76c92e Author: 0HyperCube <[email protected]> Date: Wed Jan 12 19:05:55 2022 +0000 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 095d577 Author: Keavon Chambers <[email protected]> Date: Mon Jan 10 18:06:12 2022 -0800 Fix NumberInput clamping regression with undefined bounds commit 9f54a37 Author: mfish33 <[email protected]> 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 <[email protected]> commit 61432de Author: 0HyperCube <[email protected]> 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 commit 5740283 Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 06:14:32 2022 -0800 Add `npm start` script alias for `npm run serve` commit 75e8fc6 Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 05:17:56 2022 -0800 Switch VS Code's Vue extension from Vetur to Volar commit 389b445 Author: Keavon Chambers <[email protected]> Date: Wed Jan 12 03:56:28 2022 -0800 Remove Charcoal references from the code for now commit 095d577 Author: Keavon Chambers <[email protected]> Date: Mon Jan 10 18:06:12 2022 -0800 Fix NumberInput clamping regression with undefined bounds commit 9f54a37 Author: mfish33 <[email protected]> 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 <[email protected]> commit 61432de Author: 0HyperCube <[email protected]> Date: Sat Jan 8 21:06:15 2022 +0000 Fix rotation input (#472) commit 3eeac79 Author: 0HyperCube <[email protected]> Date: Sat Jan 8 16:30:03 2022 +0000 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 <[email protected]> commit a2c2f7f Author: 0HyperCube <[email protected]> Date: Sat Jan 8 16:02:02 2022 +0000 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 <[email protected]> Co-authored-by: Keavon Chambers <[email protected]> commit 54e9121 Author: mfish33 <[email protected]> Date: Sat Jan 8 07:50:08 2022 -0800 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 <[email protected]> Co-authored-by: Keavon Chambers <[email protected]> commit 11f15bd Author: Leonard Pauli <[email protected]> Date: Sat Jan 8 14:25:24 2022 +0100 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 <[email protected]> Co-authored-by: caleb <[email protected]> Co-authored-by: otdavies <[email protected]> Co-authored-by: Dennis <[email protected]> commit 05e8a98 Author: Keavon Chambers <[email protected]> Date: Fri Jan 7 23:13:33 2022 -0800 Redesign the Layer Tree UI (#468) commit 8e3d237 Author: Oliver Davies <[email protected]> Date: Fri Jan 7 15:53:12 2022 -0800 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 <[email protected]> commit c1c7192 Author: TrueDoctor <[email protected]> Date: Fri Jan 7 04:15:08 2022 +0100 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 <[email protected]> commit f4707f9 Author: mfish33 <[email protected]> Date: Thu Jan 6 18:45:37 2022 -0800 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 commit 0219f06 Author: Keavon Chambers <[email protected]> Date: Wed Jan 5 05:40:32 2022 -0800 Fix build script to use correct branch name
1 parent 11672c0 commit d35722a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+268
-58
lines changed

editor/src/communication/dispatcher.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ impl Dispatcher {
4242

4343
#[remain::check]
4444
pub fn handle_message<T: Into<Message>>(&mut self, message: T) {
45+
use Message::*;
46+
4547
self.message_queue.push_back(message.into());
4648

47-
use Message::*;
4849
while let Some(message) = self.message_queue.pop_front() {
4950
// Skip processing of this message if it will be processed later
5051
if SIDE_EFFECT_FREE_MESSAGES.contains(&message.to_discriminant()) && self.message_queue.contains(&message) {
@@ -106,6 +107,7 @@ impl Dispatcher {
106107

107108
fn log_message(&self, message: &Message) {
108109
use Message::*;
110+
109111
if log::max_level() == log::LevelFilter::Trace
110112
&& !(matches!(
111113
message,

editor/src/document/artboard_message_handler.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ impl ArtboardMessageHandler {
2626
impl MessageHandler<ArtboardMessage, (&mut LayerMetadata, &GrapheneDocument, &InputPreprocessorMessageHandler)> for ArtboardMessageHandler {
2727
#[remain::check]
2828
fn process_action(&mut self, message: ArtboardMessage, _data: (&mut LayerMetadata, &GrapheneDocument, &InputPreprocessorMessageHandler), responses: &mut VecDeque<Message>) {
29-
// let (layer_metadata, document, ipp) = data;
3029
use ArtboardMessage::*;
30+
31+
// let (layer_metadata, document, ipp) = data;
3132
#[remain::sorted]
3233
match message {
3334
AddArtboard { top, left, height, width } => {

editor/src/document/document_message_handler.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ impl DocumentMessageHandler {
7878
let deserialized_result: Result<Self, DocumentError> = serde_json::from_str(serialized_content).map_err(|e| DocumentError::InvalidFile(e.to_string()));
7979
match deserialized_result {
8080
Ok(document) => {
81-
if document.version != GRAPHITE_DOCUMENT_VERSION {
82-
Err(DocumentError::InvalidFile("Graphite document version mismatch".to_string()))
83-
} else {
81+
if document.version == GRAPHITE_DOCUMENT_VERSION {
8482
Ok(document)
83+
} else {
84+
Err(DocumentError::InvalidFile("Graphite document version mismatch".to_string()))
8585
}
8686
}
8787
Err(e) => Err(e),
@@ -585,7 +585,7 @@ impl MessageHandler<DocumentMessage, &InputPreprocessorMessageHandler> for Docum
585585
}
586586
ExportDocument => {
587587
// TODO(MFISH33): Add Dialog to select artboards
588-
let bbox = self.document_bounds().unwrap_or([DVec2::ZERO, ipp.viewport_bounds.size()]);
588+
let bbox = self.document_bounds().unwrap_or_else(|| [DVec2::ZERO, ipp.viewport_bounds.size()]);
589589
let size = bbox[1] - bbox[0];
590590
let name = match self.name.ends_with(FILE_SAVE_SUFFIX) {
591591
true => self.name.clone().replace(FILE_SAVE_SUFFIX, FILE_EXPORT_SUFFIX),

editor/src/document/layer_panel.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ impl fmt::Display for LayerDataTypeDiscriminant {
114114
impl From<&LayerDataType> for LayerDataTypeDiscriminant {
115115
fn from(data: &LayerDataType) -> Self {
116116
use LayerDataType::*;
117+
117118
match data {
118119
Folder(_) => LayerDataTypeDiscriminant::Folder,
119120
Shape(_) => LayerDataTypeDiscriminant::Shape,

editor/src/document/movement_message_handler.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ impl MovementMessageHandler {
113113
impl MessageHandler<MovementMessage, (&Document, &InputPreprocessorMessageHandler)> for MovementMessageHandler {
114114
#[remain::check]
115115
fn process_action(&mut self, message: MovementMessage, data: (&Document, &InputPreprocessorMessageHandler), responses: &mut VecDeque<Message>) {
116-
let (document, ipp) = data;
117116
use MovementMessage::*;
117+
118+
let (document, ipp) = data;
119+
118120
#[remain::sorted]
119121
match message {
120122
DecreaseCanvasZoom { center_on_mouse } => {

editor/src/document/overlays_message_handler.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ pub struct OverlaysMessageHandler {
1414
impl MessageHandler<OverlaysMessage, (&mut LayerMetadata, &Document, &InputPreprocessorMessageHandler)> for OverlaysMessageHandler {
1515
#[remain::check]
1616
fn process_action(&mut self, message: OverlaysMessage, _data: (&mut LayerMetadata, &Document, &InputPreprocessorMessageHandler), responses: &mut VecDeque<Message>) {
17-
// let (layer_metadata, document, ipp) = data;
1817
use OverlaysMessage::*;
18+
19+
// let (layer_metadata, document, ipp) = data;
1920
#[remain::sorted]
2021
match message {
2122
ClearAllOverlays => todo!(),

editor/src/document/transform_layer_message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl MessageHandler<TransformLayerMessage, (&mut HashMap<Vec<LayerId>, LayerMeta
3939
let mut selected = Selected::new(&mut self.original_transforms, &mut self.pivot, layer_metadata, responses, document);
4040

4141
let mut begin_operation = |operation: TransformOperation, typing: &mut Typing, mouse_position: &mut DVec2, start_mouse: &mut DVec2| {
42-
if !(operation == TransformOperation::None) {
42+
if operation != TransformOperation::None {
4343
selected.revert_operation();
4444
typing.clear();
4545
} else {

editor/src/frontend/frontend_message.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::utility_types::FrontendDocumentDetails;
1+
use super::utility_types::{FrontendDocumentDetails, MouseCursorIcon};
22
use crate::document::layer_panel::{LayerPanelEntry, RawBuffer};
33
use crate::message_prelude::*;
44
use crate::misc::HintData;
@@ -37,6 +37,7 @@ pub enum FrontendMessage {
3737
UpdateDocumentRulers { origin: (f64, f64), spacing: f64, interval: f64 },
3838
UpdateDocumentScrollbars { position: (f64, f64), size: (f64, f64), multiplier: (f64, f64) },
3939
UpdateInputHints { hint_data: HintData },
40+
UpdateMouseCursor { cursor: MouseCursorIcon },
4041
UpdateOpenDocumentsList { open_documents: Vec<FrontendDocumentDetails> },
4142
UpdateWorkingColors { primary: Color, secondary: Color },
4243
}

editor/src/frontend/utility_types.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ pub struct FrontendDocumentDetails {
66
pub name: String,
77
pub id: u64,
88
}
9+
10+
#[derive(Clone, Copy, Debug, Eq, Deserialize, PartialEq, Serialize)]
11+
pub enum MouseCursorIcon {
12+
Default,
13+
ZoomIn,
14+
ZoomOut,
15+
Grabbing,
16+
Crosshair,
17+
}

editor/src/input/input_mapper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ impl Default for Mapping {
234234
impl Mapping {
235235
pub fn match_message(&self, message: InputMapperMessage, keys: &KeyStates, actions: ActionList) -> Option<Message> {
236236
use InputMapperMessage::*;
237+
237238
let list = match message {
238239
KeyDown(key) => &self.key_down[key as usize],
239240
KeyUp(key) => &self.key_up[key as usize],

0 commit comments

Comments
 (0)