Skip to content

Commit b77f5e2

Browse files
committed
Merge branch 'master' into 82-path-tool
2 parents a31387e + c55f4f0 commit b77f5e2

File tree

98 files changed

+4110
-2264
lines changed

Some content is hidden

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

98 files changed

+4110
-2264
lines changed

.deployment/cd.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ echo 📦 Install cargo-about
2020
cargo install cargo-about
2121

2222
echo 👷 Build Graphite web client
23+
export NODE_ENV=production
2324
npm run build

.github/workflows/ci.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,42 @@ jobs:
2323
node-version: '16.x'
2424

2525
- name: 🚧 Install Node dependencies
26-
run: cd frontend && npm ci
26+
run: |
27+
cd frontend
28+
npm ci
2729
2830
- name: 🔼 Update Rust to latest stable
29-
run: rustc --version && rustup update stable && rustc --version
30-
31-
- name: 📦 Install cargo-about
32-
run: cargo install cargo-about
31+
run: |
32+
rustc --version
33+
rustup update stable
34+
rustc --version
3335
3436
- name: 🌐 Build Graphite web code
35-
run: cd frontend && npm run build
37+
env:
38+
NODE_ENV: production
39+
SKIP_CARGO_ABOUT: true
40+
run: |
41+
cd frontend
42+
npm run build
3643
3744
- name: 👕 Lint Graphite web formatting
38-
run: export NODE_ENV=production && cd frontend && npm run lint
45+
env:
46+
NODE_ENV: production
47+
run: |
48+
cd frontend
49+
npm run lint
3950
4051
- name: 🔬 Check Rust formatting
41-
run: cargo fmt --all -- --check
52+
run: |
53+
cargo fmt --all -- --check
4254
4355
- name: 🦀 Build Rust code
44-
run: cargo build --verbose
56+
run: |
57+
cargo build --verbose
4558
4659
- name: 🧪 Run Rust tests
47-
run: cargo test --verbose
60+
run: |
61+
cargo test --verbose
4862
4963
cargo-deny:
5064
runs-on: ubuntu-latest

Cargo.lock

Lines changed: 25 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charcoal/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "graphite-charcoal"
3-
version = "0.1.0"
3+
publish = false
4+
version = "0.0.0"
45
rust-version = "1.56.0"
56
authors = ["Graphite Authors <[email protected]>"]
67
edition = "2021"

docs/editor/6-masking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Mask mode
44

5-
At any time while in the viewport, <kbd>Tab</kbd> may be pressed to enter mask mode. The underlying canvas seen before entering this mode is still shown, but masks are drawn as marching ants (or other optional overlays) above the main document content. While in this mode, an island layer group is provided as the destination for drawing new mask layers using the regular set of tools. The Layer Panel also still shows the underlying main document, which lets the user select layers as contextual inputs for tools that are aware of input layers, like the Fill Tool. Rather than showing the full-color shapes over the main document canvas, they are overlaid in wireframe view mode and surrounded by a marching ants marquee outline. The mask group may be isolated (meaning it becomes the render output to the viewport, and a breadcrumb trail is shown leading from the document to the isolated layer/group) which makes the viewport output show the mask in grayscale and has the Layer Panel host the contents of the mask group. While in mask mode, the working colors are temporarily replaced with a grayscale pair. Certain tools, such as the Freehand Tool and Pen Tool, may default to a "closed" form in mask mode by turning off stroke and setting fill to white in order to provide functionality akin to the lasso or polygonal lasso selection tools. <kbd>Tab</kbd> may be hit again to exit mask mode, but the marching ants still show up. However now, all tools used and commands performed will take into account the working mask. <kbd>Ctrl</kbd><kbd>D</kbd> will discard the working mask.
5+
At any time while in the viewport, <kbd>Tab</kbd> may be pressed to enter mask mode. The underlying canvas seen before entering this mode is still shown, but masks are drawn as marching ants (or other optional overlays) above the main document content. While in this mode, an island layer group is provided as the destination for drawing new mask layers using the regular set of tools. The Layer Panel also still shows the underlying main document, which lets the user select layers as contextual inputs for tools that are aware of input layers, like the Fill Tool. Rather than showing the full-color shapes over the main document canvas, they are overlaid in outline view mode and surrounded by a marching ants marquee outline. The mask group may be isolated (meaning it becomes the render output to the viewport, and a breadcrumb trail is shown leading from the document to the isolated layer/group) which makes the viewport output show the mask in grayscale and has the Layer Panel host the contents of the mask group. While in mask mode, the working colors are temporarily replaced with a grayscale pair. Certain tools, such as the Freehand Tool and Pen Tool, may default to a "closed" form in mask mode by turning off stroke and setting fill to white in order to provide functionality akin to the lasso or polygonal lasso selection tools. <kbd>Tab</kbd> may be hit again to exit mask mode, but the marching ants still show up. However now, all tools used and commands performed will take into account the working mask. <kbd>Ctrl</kbd><kbd>D</kbd> will discard the working mask.

editor/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "graphite-editor"
3-
version = "0.1.0"
3+
publish = false
4+
version = "0.0.0"
45
rust-version = "1.56.0"
56
authors = ["Graphite Authors <[email protected]>"]
67
edition = "2021"

editor/src/communication/dispatcher.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ pub struct Dispatcher {
1717
pub responses: Vec<FrontendMessage>,
1818
}
1919

20-
const GROUP_MESSAGES: &[MessageDiscriminant] = &[
20+
// For optimization, these are messages guaranteed to be redundant when repeated
21+
// The last occurrence of the message in the message queue is sufficient to ensure correctness
22+
// In addition, these messages do not change any state in the backend (aside from caches)
23+
const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[
2124
MessageDiscriminant::Documents(DocumentsMessageDiscriminant::Document(DocumentMessageDiscriminant::RenderDocument)),
2225
MessageDiscriminant::Documents(DocumentsMessageDiscriminant::Document(DocumentMessageDiscriminant::FolderChanged)),
2326
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateLayer),
2427
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::DisplayFolderTreeStructure),
28+
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateOpenDocumentsList),
2529
MessageDiscriminant::Tool(ToolMessageDiscriminant::SelectedLayersChanged),
2630
];
2731

@@ -31,10 +35,11 @@ impl Dispatcher {
3135

3236
use Message::*;
3337
while let Some(message) = self.messages.pop_front() {
34-
if GROUP_MESSAGES.contains(&message.to_discriminant()) && self.messages.contains(&message) {
38+
// Skip processing of this message if it will be processed later
39+
if SIDE_EFFECT_FREE_MESSAGES.contains(&message.to_discriminant()) && self.messages.contains(&message) {
3540
continue;
3641
}
37-
log_message(&message);
42+
self.log_message(&message);
3843
match message {
3944
NoOp => (),
4045
Documents(message) => self.documents_message_handler.process_action(message, &self.input_preprocessor, &mut self.messages),
@@ -74,18 +79,18 @@ impl Dispatcher {
7479
responses: vec![],
7580
}
7681
}
77-
}
7882

79-
fn log_message(message: &Message) {
80-
use Message::*;
81-
if log::max_level() == log::LevelFilter::Trace
82-
&& !(matches!(
83-
message,
84-
InputPreprocessor(_) | Frontend(FrontendMessage::SetCanvasZoom { .. }) | Frontend(FrontendMessage::SetCanvasRotation { .. })
85-
) || MessageDiscriminant::from(message).local_name().ends_with("MouseMove"))
86-
{
87-
log::trace!("Message: {:?}", message);
88-
//log::trace!("Hints:{:?}", self.input_mapper.hints(self.collect_actions()));
83+
fn log_message(&self, message: &Message) {
84+
use Message::*;
85+
if log::max_level() == log::LevelFilter::Trace
86+
&& !(matches!(
87+
message,
88+
InputPreprocessor(_) | Frontend(FrontendMessage::SetCanvasZoom { .. }) | Frontend(FrontendMessage::SetCanvasRotation { .. })
89+
) || MessageDiscriminant::from(message).local_name().ends_with("MouseMove"))
90+
{
91+
log::trace!("Message: {:?}", message);
92+
// log::trace!("Hints: {:?}", self.input_mapper.hints(self.collect_actions()));
93+
}
8994
}
9095
}
9196

@@ -191,7 +196,7 @@ mod test {
191196
const LINE_INDEX: usize = 0;
192197
const PEN_INDEX: usize = 1;
193198

194-
editor.handle_message(DocumentMessage::CreateFolder(vec![]));
199+
editor.handle_message(DocumentMessage::CreateEmptyFolder(vec![]));
195200

196201
let document_before_added_shapes = editor.dispatcher.documents_message_handler.active_document().graphene_document.clone();
197202
let folder_id = document_before_added_shapes.root.as_folder().unwrap().layer_ids[FOLDER_INDEX];

0 commit comments

Comments
 (0)