Skip to content

Commit 450bc20

Browse files
authored
Merge branch 'master' into arc-gizmo-bugs-fix
2 parents c8ce7bb + 4391f88 commit 450bc20

19 files changed

Lines changed: 814 additions & 54 deletions

File tree

.github/workflows/build-dev-and-ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ jobs:
4848
rustc --version
4949
5050
- name: ✂ Replace template in <head> of index.html
51-
if: github.ref != 'refs/heads/master'
52-
env:
53-
INDEX_HTML_HEAD_REPLACEMENT: ""
5451
run: |
5552
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
53+
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
5654
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
5755
5856
- name: 🌐 Build Graphite web code

.nix/flake.nix

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
# This is a helper file for people using NixOS as their operating system.
22
# If you don't know what this file does, you can safely ignore it.
3-
# This file defines both the development environment for the project.
3+
# This file defines the reproducible development environment for the project.
44
#
55
# Development Environment:
6-
# - Provides all necessary tools for Rust/WASM development
7-
# - Includes Tauri dependencies for desktop app development
6+
# - Provides all necessary tools for Rust/Wasm development
87
# - Sets up profiling and debugging tools
98
# - Configures mold as the default linker for faster builds
109
#
11-
#
1210
# Usage:
1311
# - Development shell: `nix develop`
1412
# - Run in dev shell with direnv: add `use flake` to .envrc
1513
{
1614
description = "Development environment and build configuration";
1715

1816
inputs = {
19-
# This url should be changed to match your system packages if you work on tauri because you need to use the same graphics library versions as the ones used by your system
2017
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2118
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2219
rust-overlay = {
@@ -96,7 +93,6 @@
9693
pkgs.pkg-config
9794
pkgs.git
9895
pkgs.gobject-introspection
99-
pkgs-unstable.cargo-tauri
10096
pkgs-unstable.cargo-about
10197

10298
# Linker

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ usvg = { workspace = true }
4646
once_cell = { workspace = true }
4747
web-sys = { workspace = true }
4848
bytemuck = { workspace = true }
49+
vello = { workspace = true }
4950

5051
# Required dependencies
5152
spin = "0.9.8"

editor/src/messages/portfolio/document/overlays/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ pub mod grid_overlays;
22
mod overlays_message;
33
mod overlays_message_handler;
44
pub mod utility_functions;
5+
#[cfg(target_arch = "wasm32")]
56
pub mod utility_types;
7+
#[cfg(not(target_arch = "wasm32"))]
8+
pub mod utility_types_vello;
9+
#[cfg(not(target_arch = "wasm32"))]
10+
pub use utility_types_vello as utility_types;
611

712
#[doc(inline)]
813
pub use overlays_message::{OverlaysMessage, OverlaysMessageDiscriminant};

editor/src/messages/portfolio/document/overlays/overlays_message_handler.rs

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub struct OverlaysMessageHandler {
2121
impl MessageHandler<OverlaysMessage, OverlaysMessageContext<'_>> for OverlaysMessageHandler {
2222
fn process_message(&mut self, message: OverlaysMessage, responses: &mut VecDeque<Message>, context: OverlaysMessageContext) {
2323
let OverlaysMessageContext { visibility_settings, ipp, .. } = context;
24-
#[cfg(target_arch = "wasm32")]
2524
let device_pixel_ratio = context.device_pixel_ratio;
2625

2726
match message {
@@ -69,9 +68,39 @@ impl MessageHandler<OverlaysMessage, OverlaysMessageContext<'_>> for OverlaysMes
6968
}
7069
}
7170
}
72-
#[cfg(not(target_arch = "wasm32"))]
71+
#[cfg(test)]
72+
OverlaysMessage::Draw => {}
73+
#[cfg(all(not(target_arch = "wasm32"), not(test)))]
7374
OverlaysMessage::Draw => {
74-
warn!("Cannot render overlays on non-Wasm targets.\n{responses:?} {visibility_settings:?} {ipp:?}",);
75+
use super::utility_types::OverlayContext;
76+
use vello::Scene;
77+
78+
let size = ipp.viewport_bounds.size().as_uvec2();
79+
80+
let scene = Scene::new();
81+
82+
if visibility_settings.all() {
83+
let overlay_context = OverlayContext {
84+
scene,
85+
size: size.as_dvec2(),
86+
device_pixel_ratio,
87+
visibility_settings,
88+
};
89+
90+
responses.add(DocumentMessage::GridOverlays(overlay_context.clone()));
91+
92+
for provider in &self.overlay_providers {
93+
let overlay_context = OverlayContext {
94+
scene: Scene::new(),
95+
size: size.as_dvec2(),
96+
device_pixel_ratio,
97+
visibility_settings,
98+
};
99+
responses.add(provider(overlay_context));
100+
}
101+
}
102+
103+
// TODO: Render the Vello scene to a texture and display it
75104
}
76105
OverlaysMessage::AddProvider(message) => {
77106
self.overlay_providers.insert(message);

0 commit comments

Comments
 (0)