before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cef_window_size_sender: window_size_sender,
wgpu_context,
app_event_receiver,
app_event_scheduler,
desktop_wrapper: DesktopWrapper::new(),
last_ui_update: Instant::now(),
avg_frame_time: 0.,
start_render_sender,
web_communication_initialized: false,
web_communication_startup_buffer: Vec::n... | We need to ensure that all auto saved documents are loaded at this point. You assume this message is handled after Portfolio::Init, this works because of the current ordering of message dispatch in desktop wrapper, but this assumption should not be made in my opinion. Maybe a special `FrontendMessage::OpenDocumetnsSupp... | cef_schedule: Some(Instant::now()),
graphics_state: None,
cef_window_size_sender: window_size_sender,
wgpu_context,
app_event_receiver,
app_event_scheduler,
desktop_wrapper: DesktopWrapper::new(),
last_ui_update: Instant::now(),
avg_frame_time: 0.,
start_render_sender,
web_communication... | @@ -91,6 +94,20 @@ impl App {
};
self.send_or_queue_web_message(bytes);
}
+ DesktopFrontendMessage::Init => { | desktop/src/app.rs | 26 | Rust | 0.786 | suggestion | 470 | 51 | 51 | false | Desktop: Add support for opening a .graphite file from a path passed as a launch argument | 3,059 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | c-mateo | Review this pull request change.
Language: Rust
File: desktop/src/app.rs
PR Title: Desktop: Add support for opening a .graphite file from a path passed as a launch argument
BEFORE CODE: cef_window_size_sender: window_size_sender,
wgpu_context,
app_event_receiver,
app_event_scheduler,
desktop_wrapper:... | We need to ensure that all auto saved documents are loaded at this point. You assume this message is handled after Portfolio::Init, this works because of the current ordering of message dispatch in desktop wrapper, but this assumption should not be made in my opinion. Maybe a special `FrontendMessage::OpenDocumetnsSupp... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
use std::path::PathBuf;
use clap::{Parser, ValueEnum};
#[derive(Debug, Clone, ValueEnum)]
pub enum UIAceleratedPainting {
Auto,
Yes,
No,
}
#[derive(Debug, Parser)]
#[clap(name = "graphite-cli", version)]
pub struct Cli {
pub files: Option<Vec<PathBuf>>,
#[arg(long, value_enum, default_value_t = UIAceleratedPai... | I would prefer only a `--disable-ui-accaleration` flag. Users should never run into a situation were acceleration is possible but we disable it. | #[derive(clap::Parser)]
#[clap(name = "graphite-editor", version)]
pub struct Cli {
#[arg(help = "Files to open on startup")]
pub files: Vec<std::path::PathBuf>,
#[arg(long, action = clap::ArgAction::SetTrue, help = "Disable hardware accelerated UI rendering")]
pub disable_ui_acceleration: bool,
}
| @@ -0,0 +1,19 @@
+use std::path::PathBuf;
+
+use clap::{Parser, ValueEnum};
+
+#[derive(Debug, Clone, ValueEnum)]
+pub enum UIAceleratedPainting {
+ Auto,
+ Yes,
+ No,
+}
+
+#[derive(Debug, Parser)]
+#[clap(name = "graphite-cli", version)]
+pub struct Cli {
+ pub files: Option<Vec<PathBuf>>,
+
+ #[arg(long, value_enum,... | desktop/src/cli.rs | 18 | Rust | 0.571 | suggestion | 144 | 20 | 10 | false | Desktop: Add support for opening a .graphite file from a path passed as a launch argument | 3,059 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | c-mateo | Review this pull request change.
Language: Rust
File: desktop/src/cli.rs
PR Title: Desktop: Add support for opening a .graphite file from a path passed as a launch argument
BEFORE CODE: use std::path::PathBuf;
use clap::{Parser, ValueEnum};
#[derive(Debug, Clone, ValueEnum)]
pub enum UIAceleratedPainting {
Auto,... | I would prefer only a `--disable-ui-accaleration` flag. Users should never run into a situation were acceleration is possible but we disable it. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Calculates the point on the curve which lies closest to `point`.
///
/// ## Algorithm:
/// 1. We first perform a coarse scan of the path segment to find the most promising starting point.
/// 2. Afterwards we refine this point by performing a binary search to either side assuming that the segment contains at m... | ```suggestion
/// 0.25 0.375 0.5
``` | /// Calculates the point on the curve which lies closest to `point`.
///
/// ## Algorithm:
/// 1. We first perform a coarse scan of the path segment to find the most promising starting point.
/// 2. Afterwards we refine this point by performing a binary search to either side assuming that the segment contains at m... | @@ -322,6 +324,99 @@ struct SnapCandidatePath {
bounds: Option<Quad>,
}
+impl SnapCandidatePath {
+ /// Calculates the point on the curve which lies closest to `point`.
+ ///
+ /// ## Algorithm:
+ /// 1. We first perform a coarse scan of the path segment to find the most promising starting point.
+ /// 2. Afterwar... | editor/src/messages/tool/common_functionality/snapping/layer_snapper.rs | 26 | Rust | 0.571 | suggestion | 50 | 51 | 51 | false | Improve snapping performance | 3,067 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | TrueDoctor | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/common_functionality/snapping/layer_snapper.rs
PR Title: Improve snapping performance
BEFORE CODE: /// Calculates the point on the curve which lies closest to `point`.
///
/// ## Algorithm:
/// 1. We first perform a coarse scan of th... | ```suggestion
/// 0.25 0.375 0.5
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// Midtones (Range: 0-1)
let color = color.gamma(gamma);
// Output levels (Range: 0-1)
let color = color.map_rgb(|c| c * (output_maximums - output_minimums) + output_minimums);
color.to_linear_srgb()
});
image
}
// Aims for interoperable compatibility with:
// https://www.adobe.com/devnet-apps/photoshop/... | Please verify that changing `Table<Color>` -> `Color` indeed changes absolutely nothing, since with the table you're just using the first entry of the table anyway. Affects both this `black_and_white` node and the `color_overlay` node. | // Midtones (Range: 0-1)
let color = color.gamma(gamma);
// Output levels (Range: 0-1)
let color = color.map_rgb(|c| c * (output_maximums - output_minimums) + output_minimums);
color.to_linear_srgb()
});
image
}
// Aims for interoperable compatibility with:
// https://www.adobe.com/devnet-apps/photoshop/... | @@ -304,7 +307,7 @@ async fn black_and_white<T: Adjust<Color>>(
GradientStops,
)]
mut image: T,
- #[default(Color::BLACK)] tint: Table<Color>, | node-graph/graster-nodes/src/adjustments.rs | 26 | Rust | 0.643 | suggestion | 235 | 51 | 51 | false | Shaders: more `graster-nodes` no-std fixups | 3,090 | GraphiteEditor/Graphite | 17,935 | Rust | Firestar99 | Firestar99 | Review this pull request change.
Language: Rust
File: node-graph/graster-nodes/src/adjustments.rs
PR Title: Shaders: more `graster-nodes` no-std fixups
BEFORE CODE: // Midtones (Range: 0-1)
let color = color.gamma(gamma);
// Output levels (Range: 0-1)
let color = color.map_rgb(|c| c * (output_maximums - ou... | Please verify that changing `Table<Color>` -> `Color` indeed changes absolutely nothing, since with the table you're just using the first entry of the table anyway. Affects both this `black_and_white` node and the `color_overlay` node. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
compute_circular_subpath_details(left, arc_point, right, center, Some(angle))
}
/// Returns `true` if the `bezpath1` is completely inside the `bezpath2`.
/// NOTE: `bezpath2` must be a closed path to get correct results.
pub fn bezpath_is_inside_bezpath(bezpath1: &BezPath, bezpath2: &BezPath, accuracy: Option<f64... | ```suggestion
if !bezpath1.elements().iter().filter_map(|el| el.end_point()).all(|point| bezpath2.contains(point)) {
``` | }
compute_circular_subpath_details(left, arc_point, right, center, Some(angle))
}
/// Returns `true` if the `bezpath1` is completely inside the `bezpath2`.
/// NOTE: `bezpath2` must be a closed path to get correct results.
pub fn bezpath_is_inside_bezpath(bezpath1: &BezPath, bezpath2: &BezPath, accuracy: Option<f64... | @@ -621,12 +622,12 @@ pub fn bezpath_is_inside_bezpath(bezpath1: &BezPath, bezpath2: &BezPath, accurac
// Reasoning:
// If the inner bezpath bounding box is larger than the outer bezpath bounding box in any direction
// then the inner bezpath is intersecting with or outside the outer bezpath.
- if !outer_bbox.con... | node-graph/gcore/src/vector/algorithms/bezpath_algorithms.rs | 26 | Rust | 0.714 | suggestion | 121 | 51 | 51 | false | Fix box selection regression where only intersected, not contained, objects get selected | 3,093 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | indierusty | Review this pull request change.
Language: Rust
File: node-graph/gcore/src/vector/algorithms/bezpath_algorithms.rs
PR Title: Fix box selection regression where only intersected, not contained, objects get selected
BEFORE CODE: }
compute_circular_subpath_details(left, arc_point, right, center, Some(angle))
}
///... | ```suggestion
if !bezpath1.elements().iter().filter_map(|el| el.end_point()).all(|point| bezpath2.contains(point)) {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
F64Array4([f64; 4]),
NodePath(Vec<NodeId>),
// ===========
// TABLE TYPES
// ===========
GraphicUnused(Graphic), // TODO: This is unused but removing it causes `cargo test` to infinitely recurse its type solving; figure out why and then remove this
#[cfg_attr(target_family = "wasm", serde(deserialize_with = "gra... | Let's please call this `FVec2` because the user-facing name for `DVec2` is already "Vec2" and we need to avoid the confusion of the internal version being given the opposite name of the user-facing version. And probably the same for `Affine2` -> `FAffine2` for consistency. This also lets us discriminate between them in... | F64Array4([f64; 4]),
NodePath(Vec<NodeId>),
// ===========
// TABLE TYPES
// ===========
GraphicUnused(Graphic), // TODO: This is unused but removing it causes `cargo test` to infinitely recurse its type solving; figure out why and then remove this
#[cfg_attr(target_family = "wasm", serde(deserialize_with = "gra... | @@ -201,6 +202,8 @@ tagged_value! {
// ============
// STRUCT TYPES
// ============
+ Vec2(Vec2), | node-graph/graph-craft/src/document/value.rs | 26 | Rust | 0.786 | style | 480 | 51 | 51 | false | Add node input type support for `f32` to enable usage on GPU | 3,095 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Firestar99 | Review this pull request change.
Language: Rust
File: node-graph/graph-craft/src/document/value.rs
PR Title: Add node input type support for `f32` to enable usage on GPU
BEFORE CODE: F64Array4([f64; 4]),
NodePath(Vec<NodeId>),
// ===========
// TABLE TYPES
// ===========
GraphicUnused(Graphic), // TODO: This ... | Let's please call this `FVec2` because the user-facing name for `DVec2` is already "Vec2" and we need to avoid the confusion of the internal version being given the opposite name of the user-facing version. And probably the same for `Affine2` -> `FAffine2` for consistency. This also lets us discriminate between them in... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
image,
mouse: None,
parent_and_insert_index: None,
};
dispatcher.queue_editor_message(message.into());
}
DesktopWrapperMessage::PollNodeGraphEvaluation => dispatcher.poll_node_graph_evaluation(),
DesktopWrapperMessage::UpdatePlatform(platform) => {
let platform = match platform {
Platform... | This is the rebase conflict I fixed, since I introduced this `select_after_open` field in a PR I added yesterday. You may want to check if `false` is appropriate here, or if you want to feed this in as a variable (like `to_front` on the line above gets fed in as a variable) so callers of this message can decide on a ca... | image,
mouse: None,
parent_and_insert_index: None,
};
dispatcher.queue_editor_message(message.into());
}
DesktopWrapperMessage::PollNodeGraphEvaluation => dispatcher.poll_node_graph_evaluation(),
DesktopWrapperMessage::UpdatePlatform(platform) => {
let platform = match platform {
Platform... | @@ -118,5 +118,22 @@ pub(super) fn handle_desktop_wrapper_message(dispatcher: &mut DesktopWrapperMess
let message = AppWindowMessage::AppWindowUpdatePlatform { platform };
dispatcher.queue_editor_message(message.into());
}
+ DesktopWrapperMessage::LoadDocument { id, document, to_front } => {
+ let message... | desktop/wrapper/src/handle_desktop_wrapper_message.rs | 26 | Rust | 0.571 | suggestion | 337 | 36 | 41 | false | Desktop: Move autosave persistence to native | 3,134 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/wrapper/src/handle_desktop_wrapper_message.rs
PR Title: Desktop: Move autosave persistence to native
BEFORE CODE: image,
mouse: None,
parent_and_insert_index: None,
};
dispatcher.queue_editor_message(message.into());
}
DesktopWrappe... | This is the rebase conflict I fixed, since I introduced this `select_after_open` field in a PR I added yesterday. You may want to check if `false` is appropriate here, or if you want to feed this in as a variable (like `to_front` on the line above gets fed in as a variable) so callers of this message can decide on a ca... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
on:click={(e) => {
e.stopPropagation();
clickAction?.(tabIndex);
}}
on:auxclick={(e) => {
// Middle mouse button click
if (e.button === BUTTON_MIDDLE) {
e.stopPropagation();
closeAction?.(tabIndex);
}
}}
on:mouseup={(e) => {
// Middle mouse butt... | ```suggestion
<TextLabel>*</TextLabel>
``` | on:click={(e) => {
e.stopPropagation();
clickAction?.(tabIndex);
}}
on:auxclick={(e) => {
// Middle mouse button click
if (e.button === BUTTON_MIDDLE) {
e.stopPropagation();
closeAction?.(tabIndex);
}
}}
on:mouseup={(e) => {
// Middle mouse butt... | @@ -131,6 +131,9 @@
bind:this={tabElements[tabIndex]}
>
<TextLabel>{tabLabel.name}</TextLabel>
+ {#if tabLabel.isUnsaved}
+ <span>*</span> | frontend/src/components/window/workspace/Panel.svelte | 26 | Svelte | 0.429 | suggestion | 48 | 51 | 51 | false | Fix the ellipses of a long document name causing the tab's unsaved asterisk to be hidden | 3,146 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | derfl007 | Review this pull request change.
Language: Svelte
File: frontend/src/components/window/workspace/Panel.svelte
PR Title: Fix the ellipses of a long document name causing the tab's unsaved asterisk to be hidden
BEFORE CODE: on:click={(e) => {
e.stopPropagation();
clickAction?.(tabIndex);
}}
... | ```suggestion
<TextLabel>*</TextLabel>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
self.svg.push(">".into());
} else {
self.svg.pop();
self.svg.push("/>".into());
}
}
}
impl Default for SvgRender {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Default)]
pub struct RenderContext {
#[cfg(feature = "vello")]
pub resource_overrides: Vec<(peniko::Image, wgpu::Texture)... | I think this change is still unnecessary, right? | self.svg.push(">".into());
} else {
self.svg.pop();
self.svg.push("/>".into());
}
}
}
impl Default for SvgRender {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Default)]
pub struct RenderContext {
#[cfg(feature = "vello")]
pub resource_overrides: Vec<(peniko::Image, wgpu::Texture)... | @@ -160,7 +160,8 @@ pub struct RenderContext {
pub enum RenderOutputType {
#[default]
Svg,
- Vello,
+ Texture,
+ Buffer, | node-graph/gsvg-renderer/src/renderer.rs | 26 | Rust | 0.143 | question | 48 | 51 | 51 | false | Desktop: Native export | 3,188 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: node-graph/gsvg-renderer/src/renderer.rs
PR Title: Desktop: Native export
BEFORE CODE: self.svg.push(">".into());
} else {
self.svg.pop();
self.svg.push("/>".into());
}
}
}
impl Default for SvgRender {
fn default() -> Self {
Self::new()
}
}
#... | I think this change is still unnecessary, right? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
TriggerSaveDocument {
document_id: DocumentId,
name: String,
path: Option<PathBuf>,
content: Vec<u8>,
},
TriggerSaveFile {
name: String,
content: Vec<u8>,
},
TriggerExportImage {
svg: String,
name: String,
mime: String,
size: (f64, f64),
},
#[cfg(feature = "gpu")]
#[serde(skip)]
TriggerExpo... | Hmm, I'm wondering if this is the correct abstraction level. I'd prefer if the encoding was handled in the editor crate (e.g. when we add quality options etc. it would make it easier to keep them in sync between frontend and desktop) | TriggerSaveDocument {
document_id: DocumentId,
name: String,
path: Option<PathBuf>,
content: Vec<u8>,
},
TriggerSaveFile {
name: String,
content: Vec<u8>,
},
TriggerExportImage {
svg: String,
name: String,
mime: String,
size: (f64, f64),
},
TriggerFetchAndOpenDocument {
name: String,
file... | @@ -82,6 +82,16 @@ pub enum FrontendMessage {
mime: String,
size: (f64, f64),
},
+ #[cfg(feature = "gpu")]
+ #[serde(skip)]
+ TriggerExportImageBuffer {
+ data: Vec<u8>,
+ width: u32,
+ height: u32,
+ transparent: bool,
+ file_type: super::utility_types::FileType,
+ name: String,
+ }, | editor/src/messages/frontend/frontend_message.rs | 26 | Rust | 0.643 | refactor | 233 | 51 | 51 | false | Desktop: Native export | 3,188 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: editor/src/messages/frontend/frontend_message.rs
PR Title: Desktop: Native export
BEFORE CODE: TriggerSaveDocument {
document_id: DocumentId,
name: String,
path: Option<PathBuf>,
content: Vec<u8>,
},
TriggerSaveFile {
name: String,
content: Vec<u8... | Hmm, I'm wondering if this is the correct abstraction level. I'd prefer if the encoding was handled in the editor crate (e.g. when we add quality options etc. it would make it easier to keep them in sync between frontend and desktop) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
use graphite_desktop_wrapper::WgpuContext;
pub(crate) mod consts;
mod app;
mod cef;
mod dirs;
mod event;
mod native_window;
mod persist;
mod render;
use app::App;
use cef::CefHandler;
use event::CreateAppEventSchedulerEventLoopExt;
fn main() {
tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()... | Was this included by accident or do we want this to be a debug!? | use graphite_desktop_wrapper::WgpuContext;
pub(crate) mod consts;
mod app;
mod cef;
mod dirs;
mod event;
mod native_window;
mod persist;
mod render;
use app::App;
use cef::CefHandler;
use event::CreateAppEventSchedulerEventLoopExt;
fn main() {
tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()... | @@ -27,7 +27,7 @@ fn main() {
// We are in a CEF subprocess
// This will block until the CEF subprocess quits
let error = cef_context_builder.execute_sub_process();
- tracing::error!("Cef subprocess failed with error: {error}"); | desktop/src/main.rs | 26 | Rust | 0.357 | bug | 64 | 51 | 51 | false | Desktop: Browser console message forwarding | 3,193 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/main.rs
PR Title: Desktop: Browser console message forwarding
BEFORE CODE: use graphite_desktop_wrapper::WgpuContext;
pub(crate) mod consts;
mod app;
mod cef;
mod dirs;
mod event;
mod native_window;
mod persist;
mod render;
use app::App;
use cef::... | Was this included by accident or do we want this to be a debug!? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
b_vals.push(px.b());
a_vals.push(px.a());
}
}
}
let r = median_quickselect(&mut r_vals);
let g = median_quickselect(&mut g_vals);
let b = median_quickselect(&mut b_vals);
let a = median_quickselect(&mut a_vals);
output.set_pixel(x, y, Color::from_rgbaf32_unchecked(r, g, b, a));
... | By putting it at the end in parentheses, this comment is unclear to me whether the `(O(n log n))` refers to this function's runtime or if it refers to `the cost of full sorting`. | use core_types::color::Color;
use core_types::context::Ctx;
use core_types::registry::types::PixelLength;
use core_types::table::Table;
use raster_types::Image;
use raster_types::{Bitmap, BitmapMut};
use raster_types::{CPU, Raster};
/// Blurs the image with a Gaussian or box blur kernel filter.
#[node_macro::node(cate... | @@ -179,3 +211,69 @@ fn box_blur_algorithm(mut original_buffer: Image<Color>, radius: f64, gamma: boo
y_axis
}
+
+fn median_filter_algorithm(mut original_buffer: Image<Color>, radius: u32, gamma: bool) -> Image<Color> {
+ if gamma {
+ original_buffer.map_pixels(|px| px.to_gamma_srgb().to_associated_alpha(px.a()))... | node-graph/nodes/raster/src/filter.rs | 26 | Rust | 0.5 | performance | 178 | 33 | 265 | false | Feature: Add median filter option to blur node | 3,196 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | youssefelzedy | Review this pull request change.
Language: Rust
File: node-graph/nodes/raster/src/filter.rs
PR Title: Feature: Add median filter option to blur node
BEFORE CODE: b_vals.push(px.b());
a_vals.push(px.a());
}
}
}
let r = median_quickselect(&mut r_vals);
let g = median_quickselect(&mut g_... | By putting it at the end in parentheses, this comment is unclear to me whether the `(O(n log n))` refers to this function's runtime or if it refers to `the cost of full sorting`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let blurred_image = if radius < 0.1 {
// Minimum blur radius
image.clone()
} else if box_blur {
Raster::new_cpu(box_blur_algorithm(image.into_data(), radius, gamma))
} else {
Raster::new_cpu(gaussian_blur_algorithm(image.into_data(), radius, gamma))
};
row.element = blurred_image;
row... | We may need to test if other graphics tools use gamma or linear space for their implementations. | let blurred_image = if radius < 0.1 {
// Minimum blur radius
image.clone()
} else if box_blur {
Raster::new_cpu(box_blur_algorithm(image.into_data(), radius, gamma))
} else {
Raster::new_cpu(gaussian_blur_algorithm(image.into_data(), radius, gamma))
};
row.element = blurred_image;
row... | @@ -42,6 +42,38 @@ async fn blur(
.collect()
}
+/// Applies a median filter to reduce noise while preserving edges.
+#[node_macro::node(category("Raster: Filter"))]
+async fn median_filter(
+ _: impl Ctx,
+ /// The image to be filtered.
+ image_frame: Table<Raster<CPU>>,
+ /// The radius of the filter kernel. Lar... | node-graph/nodes/raster/src/filter.rs | 26 | Rust | 0.286 | suggestion | 96 | 51 | 51 | false | Feature: Add median filter option to blur node | 3,196 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | youssefelzedy | Review this pull request change.
Language: Rust
File: node-graph/nodes/raster/src/filter.rs
PR Title: Feature: Add median filter option to blur node
BEFORE CODE: let blurred_image = if radius < 0.1 {
// Minimum blur radius
image.clone()
} else if box_blur {
Raster::new_cpu(box_blur_algorithm(image... | We may need to test if other graphics tools use gamma or linear space for their implementations. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
use std::time::Instant;
use winit::dpi::PhysicalPosition;
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, WindowEvent};
mod keymap;
use keymap::{ToNativeKeycode, ToVKBits};
use super::consts::{MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, SCROLL_LINE_HEIGHT, SCROLL_LINE_WIDTH, SCROLL_SP... | Make this a one-liner, please. | use std::time::Instant;
use winit::dpi::PhysicalPosition;
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, WindowEvent};
mod keymap;
use keymap::{ToNativeKeycode, ToVKBits};
use super::consts::{MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, SCROLL_LINE_HEIGHT, SCROLL_LINE_WIDTH, SCROLL_SP... | @@ -11,14 +11,24 @@ use super::consts::{MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, SCROLL_LINE_H
pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputState, event: &WindowEvent) {
match event {
- WindowEvent::PointerMoved { position, .. } => {
+ WindowEvent::PointerMoved { position, ..... | desktop/src/cef/input.rs | 26 | Rust | 0.071 | suggestion | 30 | 51 | 51 | false | Desktop: Forward the pointer leave event to CEF | 3,197 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/cef/input.rs
PR Title: Desktop: Forward the pointer leave event to CEF
BEFORE CODE: use std::time::Instant;
use winit::dpi::PhysicalPosition;
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, WindowEvent};
mod keymap;
use... | Make this a one-liner, please. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
editor.handle.selectDocument(BigInt(currentDocumentId));
} else {
const length = orderedSavedDocuments.length;
for (let i = length - 2; i >= 0; i--) {
const { documentId, document, details } = orderedSavedDocuments[i];
const { name, isSaved } = details;
editor.handle.openAutoSavedDocument(BigInt... | Can we pass `undefined` instead of `null`? We ban the `null` keyword for style reasons. Otherwise we may need an alternate way to do that. Hopefully I can also get style linting working in CI again soon. | editor.handle.selectDocument(BigInt(currentDocumentId));
} else {
const length = orderedSavedDocuments.length;
for (let i = length - 2; i >= 0; i--) {
const { documentId, document, details } = orderedSavedDocuments[i];
const { name, isSaved } = details;
editor.handle.openAutoSavedDocument(BigInt... | @@ -147,9 +147,7 @@ export function createPersistenceManager(editor: Editor, portfolio: PortfolioSta
async function loadPreferences() {
const preferences = await get<Record<string, unknown>>("preferences", graphiteStore);
- if (!preferences) return;
-
- editor.handle.loadPreferences(JSON.stringify(preferences)... | frontend/src/io-managers/persistence.ts | 26 | TypeScript | 0.786 | question | 203 | 51 | 51 | false | Ensure the LoadPreferences message is dispatched with None when no preferences exist | 3,198 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | timon-schelling | Review this pull request change.
Language: TypeScript
File: frontend/src/io-managers/persistence.ts
PR Title: Ensure the LoadPreferences message is dispatched with None when no preferences exist
BEFORE CODE: editor.handle.selectDocument(BigInt(currentDocumentId));
} else {
const length = orderedSavedDocumen... | Can we pass `undefined` instead of `null`? We ban the `null` keyword for style reasons. Otherwise we may need an alternate way to do that. Hopefully I can also get style linting working in CI again soon. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
c
}
Err(cef::InitError::AlreadyRunning) => {
tracing::error!("Another instance is already running, Exiting.");
exit(0);
}
Err(cef::InitError::InitializationFailed(code)) => {
tracing::error!("Cef initialization failed with code: {code}");
exit(1);
}
Err(cef::InitError::BrowserCreationFailed) ... | I don't think this is the right place to put this function. I'd generall prefer if the reusable logic was moved directly into the wgpu executor (e.g. such that it can also be used by the graphene cli etc.) and for the desktop specific parts I'd like to move those to a different file in order to not clutter up the `main... | use std::process::exit;
use tracing_subscriber::EnvFilter;
use winit::event_loop::EventLoop;
pub(crate) mod consts;
mod app;
mod cef;
mod dirs;
mod event;
mod native_window;
mod persist;
mod render;
mod gpu_context;
use app::App;
use cef::CefHandler;
use event::CreateAppEventSchedulerEventLoopExt;
fn main() {
tra... | @@ -67,3 +67,60 @@ fn main() {
event_loop.run_app(&mut app).unwrap();
}
+
+async fn init_wgpu_context() -> WgpuContext { | desktop/src/main.rs | 26 | Rust | 0.643 | refactor | 324 | 51 | 70 | false | Desktop: Add rudimentary support for custom WGPU adapter selection | 3,201 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/main.rs
PR Title: Desktop: Add rudimentary support for custom WGPU adapter selection
BEFORE CODE: c
}
Err(cef::InitError::AlreadyRunning) => {
tracing::error!("Another instance is already running, Exiting.");
exit(0);
}
Err(cef::Init... | I don't think this is the right place to put this function. I'd generall prefer if the reusable logic was moved directly into the wgpu executor (e.g. such that it can also be used by the graphene cli etc.) and for the desktop specific parts I'd like to move those to a different file in order to not clutter up the `main... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
use std::process::exit;
use tracing_subscriber::EnvFilter;
use winit::event_loop::EventLoop;
pub(crate) mod consts;
mod app;
mod cef;
mod dirs;
mod event;
mod native_window;
mod persist;
mod render;
mod gpu;
use app::App;
use cef::CefHandler;
use event::CreateAppEventSchedulerEventLoopExt;
fn main() {
tracing_sub... | maybe call this `(w)gpu_context`? I thing `gpu` on its own is a bit vague | use std::process::exit;
use tracing_subscriber::EnvFilter;
use winit::event_loop::EventLoop;
pub(crate) mod consts;
mod app;
mod cef;
mod dirs;
mod event;
mod native_window;
mod persist;
mod render;
mod gpu_context;
use app::App;
use cef::CefHandler;
use event::CreateAppEventSchedulerEventLoopExt;
fn main() {
tra... | @@ -14,6 +12,8 @@ mod native_window;
mod persist;
mod render;
+mod gpu; | desktop/src/main.rs | 15 | Rust | 0.357 | suggestion | 73 | 40 | 40 | false | Desktop: Add rudimentary support for custom WGPU adapter selection | 3,201 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/main.rs
PR Title: Desktop: Add rudimentary support for custom WGPU adapter selection
BEFORE CODE: use std::process::exit;
use tracing_subscriber::EnvFilter;
use winit::event_loop::EventLoop;
pub(crate) mod consts;
mod app;
mod cef;
mod dirs;
mod ev... | maybe call this `(w)gpu_context`? I thing `gpu` on its own is a bit vague | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
backends: self.backends,
..Default::default()
})
}
async fn request_adapter(&self, instance: &Instance) -> Option<Adapter> {
let request_adapter_options = wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: None,
force_fallback_adapter: false,... | this cfg does not need to be repeated right? | backends: self.backends,
..Default::default()
})
}
async fn request_adapter(&self, instance: &Instance) -> Option<Adapter> {
let request_adapter_options = wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: None,
force_fallback_adapter: false,... | @@ -1,53 +1,152 @@
use std::sync::Arc;
-use wgpu::{Device, Instance, Queue};
+use wgpu::{Adapter, Backends, Device, Features, Instance, Queue};
#[derive(Debug, Clone)]
pub struct Context {
pub device: Arc<Device>,
pub queue: Arc<Queue>,
pub instance: Arc<Instance>,
- pub adapter: Arc<wgpu::Adapter>,
+ pub ad... | node-graph/wgpu-executor/src/context.rs | 26 | Rust | 0.071 | question | 44 | 51 | 51 | false | Desktop: Add rudimentary support for custom WGPU adapter selection | 3,201 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: node-graph/wgpu-executor/src/context.rs
PR Title: Desktop: Add rudimentary support for custom WGPU adapter selection
BEFORE CODE: backends: self.backends,
..Default::default()
})
}
async fn request_adapter(&self, instance: &Instance) -> Option<Adapter>... | this cfg does not need to be repeated right? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
memory_hints: Default::default(),
trace: wgpu::Trace::Off,
};
adapter.request_device(&device_descriptor).await.ok()
}
}
#[cfg(not(target_family = "wasm"))]
impl ContextBuilder {
#[cfg(not(target_family = "wasm"))]
async fn build_with_adapter_selection_inner<S>(self, select: Option<S>) -> Option<Context>
w... | I'm a bit confused by these cfg attributes, the whole block should be disabled, right? | memory_hints: Default::default(),
trace: wgpu::Trace::Off,
};
adapter.request_device(&device_descriptor).await.ok()
}
}
#[cfg(not(target_family = "wasm"))]
impl ContextBuilder {
async fn build_with_adapter_selection_inner<S>(self, select: Option<S>) -> Option<Context>
where
S: Fn(&[Adapter]) -> Option<us... | @@ -1,53 +1,152 @@
use std::sync::Arc;
-use wgpu::{Device, Instance, Queue};
+use wgpu::{Adapter, Backends, Device, Features, Instance, Queue};
#[derive(Debug, Clone)]
pub struct Context {
pub device: Arc<Device>,
pub queue: Arc<Queue>,
pub instance: Arc<Instance>,
- pub adapter: Arc<wgpu::Adapter>,
+ pub ad... | node-graph/wgpu-executor/src/context.rs | 26 | Rust | 0.286 | question | 86 | 51 | 51 | false | Desktop: Add rudimentary support for custom WGPU adapter selection | 3,201 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: node-graph/wgpu-executor/src/context.rs
PR Title: Desktop: Add rudimentary support for custom WGPU adapter selection
BEFORE CODE: memory_hints: Default::default(),
trace: wgpu::Trace::Off,
};
adapter.request_device(&device_descriptor).await.ok()
}
}
#... | I'm a bit confused by these cfg attributes, the whole block should be disabled, right? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let dx = position.x.abs_diff(record.position.x);
let dy = position.y.abs_diff(record.position.y);
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
let within_time = now.saturating_duration_since(record.time) <= MULTICLICK_TIMEOUT;
let count = if within_time && within_dist... | could we derive copy here to avoid having to write `.clone()` ? | *record = match state {
ElementState::Pressed => ClickRecord { down_count: count, ..*record },
ElementState::Released => ClickRecord { up_count: count, ..*record },
};
count
}
}
#[derive(Clone, Copy, PartialEq, Default)]
enum ClickCount {
#[default]
Single,
Double,
}
impl From<ClickCount> for i32 {
fn... | @@ -278,7 +300,7 @@ impl ClickTracker {
}
}
-#[derive(Clone)]
+#[derive(Clone, PartialEq)] | desktop/src/cef/input.rs | 26 | Rust | 0.429 | question | 63 | 51 | 51 | false | Desktop: Forward multi-clicks (double/triple/etc.-clicks) to CEF correctly | 3,224 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/cef/input.rs
PR Title: Desktop: Forward multi-clicks (double/triple/etc.-clicks) to CEF correctly
BEFORE CODE: let dx = position.x.abs_diff(record.position.x);
let dy = position.y.abs_diff(record.position.y);
let within_dist = dx <= MULTICLICK_... | could we derive copy here to avoid having to write `.clone()` ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
MouseButton::Left => &mut self.left,
MouseButton::Right => &mut self.right,
MouseButton::Middle => &mut self.middle,
_ => return ClickCount::Single,
};
let now = Instant::now();
let Some(record) = record else {
*record = Some(ClickRecord {
time: now,
position: position.clone(),
down_c... | Also could you use the struct initializer syntax here? | MouseButton::Left => &mut self.left,
MouseButton::Right => &mut self.right,
MouseButton::Middle => &mut self.middle,
_ => return ClickCount::Single,
};
let Some(record) = record else {
*record = Some(ClickRecord { position, ..Default::default() });
return ClickCount::Single;
};
let now = Ins... | @@ -253,6 +253,28 @@ impl ClickTracker {
return ClickCount::Single;
};
+ match state {
+ ElementState::Pressed if record.down_count == ClickCount::Double => {
+ *record = ClickRecord {
+ time: now,
+ position: position.clone(),
+ down_count: ClickCount::Single,
+ up_count: record.up_count... | desktop/src/cef/input.rs | 26 | Rust | 0.286 | question | 54 | 51 | 51 | false | Desktop: Forward multi-clicks (double/triple/etc.-clicks) to CEF correctly | 3,224 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/cef/input.rs
PR Title: Desktop: Forward multi-clicks (double/triple/etc.-clicks) to CEF correctly
BEFORE CODE: MouseButton::Left => &mut self.left,
MouseButton::Right => &mut self.right,
MouseButton::Middle => &mut self.middle,
_ => retur... | Also could you use the struct initializer syntax here? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn extract_vector(ctx: impl Ctx + ExtractVarArgs) -> Table<Vector> {
let Ok(var_arg) = ctx.vararg(0) else { return Default::default() };
let var_arg = var_arg as &dyn std::any::Any;
var_arg.downcast_ref().cloned().unwrap_or_default()
}
... | ```suggestion
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn instance_vector(ctx: impl Ctx + ExtractVarArgs) -> Table<Vector> {
let Ok(var_arg) = ctx.vararg(0) else { return Default::default() };
let var_arg = var_arg as &dyn std::any::Any;
var_arg.downcast_ref().cloned().unwrap_... | }
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn instance_vector(ctx: impl Ctx + ExtractVarArgs) -> Table<Vector> {
let Ok(var_arg) = ctx.vararg(0) else { return Default::default() };
let var_arg = var_arg as &dyn std::any::Any;
var_arg.downcast_ref().cloned().unwrap_or_default()... | @@ -969,6 +969,26 @@ async fn separate_subpaths(_: impl Ctx, content: Table<Vector>) -> Table<Vector>
})
.collect()
}
+#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
+fn extract_vector(ctx: impl Ctx + ExtractVarArgs) -> Table<Vector> {
+ let Ok(var_arg) = ctx.vararg(0) else { retu... | node-graph/gcore/src/vector/vector_nodes.rs | 26 | Rust | 1 | refactor | 963 | 51 | 51 | false | Add 'Instance Map' and 'Instance Vector' nodes | 3,229 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/gcore/src/vector/vector_nodes.rs
PR Title: Add 'Instance Map' and 'Instance Vector' nodes
BEFORE CODE: }
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn extract_vector(ctx: impl Ctx + ExtractVarArgs) -> Table<Vector> ... | ```suggestion
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn instance_vector(ctx: impl Ctx + ExtractVarArgs) -> Table<Vector> {
let Ok(var_arg) = ctx.vararg(0) else { return Default::default() };
let var_arg = var_arg as &dyn std::any::Any;
var_arg.downcast_ref().cloned().unwrap_... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<EOF
Usage: $0 <owner> <repo> <branch> <target-path> <artifact-file> <commit-message> <github-token>
Arguments:
owner : GitHub user or organization of the target repo
repo : Target repo name
branch : Branch name (e.g. main)
t... | ```suggestion
If a file already exists at that path, it will auto-detect the SHA and update; otherwise it will create a new one.
``` | #!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<EOF
Usage: $0 <owner> <repo> <branch> <target-path> <artifact-file> <commit-message> <github-token>
Arguments:
owner : GitHub user or organization of the target repo
repo : Target repo name
branch : Branch name (e.g. main)
t... | @@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+usage() {
+ cat <<EOF
+Usage: $0 <owner> <repo> <branch> <target-path> <artifact-file> <commit-message> <github-token>
+
+Arguments:
+ owner : GitHub user or organization of the target repo
+ repo : Target repo name
+ branch :... | .github/workflows/scripts/artifact-upload.bash | 18 | Shell | 0.714 | suggestion | 132 | 43 | 43 | false | Provide shaders via artifact repo | 3,250 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Shell
File: .github/workflows/scripts/artifact-upload.bash
PR Title: Provide shaders via artifact repo
BEFORE CODE: #!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<EOF
Usage: $0 <owner> <repo> <branch> <target-path> <artifact-file> <commit-message> <github-token>
... | ```suggestion
If a file already exists at that path, it will auto-detect the SHA and update; otherwise it will create a new one.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
pub fn target_type(&self) -> &ClickTargetType {
&self.target_type
}
pub fn bounding_box(&self) -> Option<[DVec2; 2]> {
self.bounding_box
}
pub fn bounding_box_center(&self) -> Option<DVec2> {
self.bounding_box.map(|bbox| bbox[0] + (bbox[1] - bbox[0]) / 2.)
}
pub fn bounding_box_with_transform(&self,... | Do we really want to clear the cache completely here?
Did you do performance tests on the number of max cache entries, could be interesting. | }
// Check each position with matching fingerprint for exact rotation match
while mask != 0 {
let pos = mask.trailing_zeros() as usize;
if rotation == self.elements[pos].0 {
// Found cached rotation - apply scale and translation to cached bounds
let transform = DAffine2::from_scale_angle_translatio... | @@ -76,7 +85,28 @@ impl ClickTarget {
}
pub fn bounding_box_with_transform(&self, transform: DAffine2) -> Option<[DVec2; 2]> {
- self.bounding_box.map(|[a, b]| [transform.transform_point2(a), transform.transform_point2(b)])
+ match self.target_type {
+ ClickTargetType::Subpath(ref subpath) =>
+ {
+ let re... | node-graph/gcore/src/vector/click_target.rs | 26 | Rust | 0.571 | performance | 141 | 51 | 51 | false | Cache calculation of bounding boxes with transforms | 3,287 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/gcore/src/vector/click_target.rs
PR Title: Cache calculation of bounding boxes with transforms
BEFORE CODE: }
pub fn target_type(&self) -> &ClickTargetType {
&self.target_type
}
pub fn bounding_box(&self) -> Option<[DVec2; 2]> {
self.boundin... | Do we really want to clear the cache completely here?
Did you do performance tests on the number of max cache entries, could be interesting. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// Node gragging is in progress (having already moved at least one pixel from the mouse down position)
let dragging_nodes = self.drag_start.as_ref().is_some_and(|(_, dragged)| *dragged);
// A box selection is in progress
let dragging_box_selection = self.box_selection_start.is_some_and(|(_, box_selection_drag... | Not sure if subtracting is the right terminology. |
fn update_node_graph_hints(&self, responses: &mut VecDeque<Message>) {
// A wire is in progress and its start and end connectors are set
let wiring = self.wire_in_progress_from_connector.is_some();
// Node gragging is in progress (having already moved at least one pixel from the mouse down position)
let drag... | @@ -2734,7 +2739,11 @@ impl NodeGraphMessageHandler {
let mut hint_data = HintData(vec![
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, "Add Node")]),
HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Select Node"), HintInfo::keys([Key::Shift], "Extend").prepend_plus()]),
- HintGroup(vec![HintInfo::mouse... | editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs | 26 | Rust | 0.071 | suggestion | 49 | 51 | 51 | false | Add selection subtracting to the node graph view | 3,290 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | wade-cheng | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs
PR Title: Add selection subtracting to the node graph view
BEFORE CODE:
// Node gragging is in progress (having already moved at least one pixel from the mouse down position)
le... | Not sure if subtracting is the right terminology. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
(start as usize).min(total_chars)
};
let end = if end <= 0. {
total_chars.saturating_sub(end.abs() as usize)
} else {
(end as usize).min(total_chars)
};
if start >= end {
return String::new();
}
string.chars().skip(start).take(end - start).collect()
}
// TODO: Return u32, u64, or usize instead of f64 ... | I'm wondering if this node name should include split since we split by the substring and don't index by it. @Keavon opinions? | (start as usize).min(total_chars)
};
let end = if end <= 0. {
total_chars.saturating_sub(end.abs() as usize)
} else {
(end as usize).min(total_chars)
};
if start >= end {
return String::new();
}
string.chars().skip(start).take(end - start).collect()
}
// TODO: Return u32, u64, or usize instead of f64 ... | @@ -69,6 +69,20 @@ fn string_length(_: impl Ctx, string: String) -> f64 {
string.chars().count() as f64
}
+// Get an indexed part of string whitch separated a specified delimeter ("1;2;3" e.t.c.)
+#[node_macro::node(category("Text"))]
+fn substring_by_index(_: impl Ctx, string: String, #[default("\\n")] delimeter:... | node-graph/gcore/src/logic.rs | 26 | Rust | 0.429 | question | 125 | 51 | 51 | false | New node: String Split | 3,304 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | daniil-loban | Review this pull request change.
Language: Rust
File: node-graph/gcore/src/logic.rs
PR Title: New node: String Split
BEFORE CODE: (start as usize).min(total_chars)
};
let end = if end <= 0. {
total_chars.saturating_sub(end.abs() as usize)
} else {
(end as usize).min(total_chars)
};
if start >= end {
r... | I'm wondering if this node name should include split since we split by the substring and don't index by it. @Keavon opinions? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return bezpath.clone();
}
let mut bezpaths = bezpath
.segments()
.map(|bezier| bezier.to_cubic())
.filter_map(|cubic_bez| {
let start = cubic_bez.p0;
let is_degenerate =
(cubic_bez.p1 - start).hypot() < MAX_ABSOLUTE_DIFFERENCE && (cubic_bez.p2 - start).hypot() < MAX_ABSOLUTE_DIFFERENCE && (cubic_be... | This can be simplified by just returning `fitted.get_seg(1)` | // An offset of a single point is not defined.
if distance == 0. || bezpath.get_seg(1).is_none() {
return bezpath.clone();
}
let mut bezpaths = bezpath
.segments()
.map(|bezier| bezier.to_cubic())
.filter_map(|cubic_bez| {
// Skip degenerate curves where all control points are at the same location.
/... | @@ -19,15 +20,30 @@ pub fn offset_bezpath(bezpath: &BezPath, distance: f64, join: Join, miter_limit:
}
let mut bezpaths = bezpath
- .segments()
- .map(|bezier| bezier.to_cubic())
- .map(|cubic_bez| {
- let cubic_offset = kurbo::offset::CubicOffset::new_regularized(cubic_bez, distance, CUBIC_REGULARIZATIO... | node-graph/gcore/src/vector/algorithms/offset_subpath.rs | 26 | Rust | 0.357 | suggestion | 60 | 51 | 51 | false | Fix capacity overflow in offset path node | 3,308 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | ashishmohapatra240 | Review this pull request change.
Language: Rust
File: node-graph/gcore/src/vector/algorithms/offset_subpath.rs
PR Title: Fix capacity overflow in offset path node
BEFORE CODE: return bezpath.clone();
}
let mut bezpaths = bezpath
.segments()
.map(|bezier| bezier.to_cubic())
.filter_map(|cubic_bez| {
le... | This can be simplified by just returning `fitted.get_seg(1)` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
use kurbo::{BezPath, Join, ParamCurve, PathEl, PathSeg};
/// Value to control smoothness and mathematical accuracy to offset a cubic Bezier.
const CUBIC_REGULARIZATION_ACCURACY: f64 = 0.5;
/// Accuracy of fitting offset curve to Bezier paths.
const CUBIC_TO_BEZPATH_ACCURACY: f64 = 1e-3;
/// Constant used to determine ... | Could you add a quick comment about when this is true and why we return None in those cases? Also could you use `start.distance(cubic_bez.p1)` instead to make this more readable? If we introduced a squared constant, we could also use `start.distance_squared(cubic_bez.p1)` which would avoid the cost of computing the squ... | use kurbo::{BezPath, Join, ParamCurve, PathEl, PathSeg};
/// Value to control smoothness and mathematical accuracy to offset a cubic Bezier.
const CUBIC_REGULARIZATION_ACCURACY: f64 = 0.5;
/// Accuracy of fitting offset curve to Bezier paths.
const CUBIC_TO_BEZPATH_ACCURACY: f64 = 1e-3;
/// Constant used to determine ... | @@ -19,15 +20,28 @@ pub fn offset_bezpath(bezpath: &BezPath, distance: f64, join: Join, miter_limit:
}
let mut bezpaths = bezpath
- .segments()
- .map(|bezier| bezier.to_cubic())
- .map(|cubic_bez| {
- let cubic_offset = kurbo::offset::CubicOffset::new_regularized(cubic_bez, distance, CUBIC_REGULARIZATIO... | node-graph/gcore/src/vector/algorithms/offset_subpath.rs | 26 | Rust | 0.643 | question | 328 | 51 | 51 | false | Fix capacity overflow in offset path node | 3,308 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | ashishmohapatra240 | Review this pull request change.
Language: Rust
File: node-graph/gcore/src/vector/algorithms/offset_subpath.rs
PR Title: Fix capacity overflow in offset path node
BEFORE CODE: use kurbo::{BezPath, Join, ParamCurve, PathEl, PathSeg};
/// Value to control smoothness and mathematical accuracy to offset a cubic Bezier... | Could you add a quick comment about when this is true and why we return None in those cases? Also could you use `start.distance(cubic_bez.p1)` instead to make this more readable? If we introduced a squared constant, we could also use `start.distance_squared(cubic_bez.p1)` which would avoid the cost of computing the squ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
use cef::sys::{cef_event_flags_t, cef_key_event_type_t, cef_mouse_button_type_t};
use cef::{Browser, ImplBrowser, ImplBrowserHost, KeyEvent, KeyEventType, MouseEvent};
use std::time::Instant;
use winit::dpi::LogicalPosition;
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, WindowEvent};
mo... | Why is this `to_logical(2.0)` should it also be `to_logical(scale)` like to other? | use cef::sys::{cef_event_flags_t, cef_key_event_type_t, cef_mouse_button_type_t};
use cef::{Browser, ImplBrowser, ImplBrowserHost, KeyEvent, KeyEventType, MouseEvent};
use std::time::Instant;
use winit::dpi::PhysicalPosition;
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, WindowEvent};
m... | @@ -1,25 +1,25 @@
use cef::sys::{cef_event_flags_t, cef_key_event_type_t, cef_mouse_button_type_t};
use cef::{Browser, ImplBrowser, ImplBrowserHost, KeyEvent, KeyEventType, MouseEvent};
use std::time::Instant;
-use winit::dpi::PhysicalPosition;
+use winit::dpi::LogicalPosition;
use winit::event::{ButtonSource, Elem... | desktop/src/cef/input.rs | 15 | Rust | 0.429 | question | 82 | 40 | 40 | false | Desktop: Add support for UI scaling | 3,310 | GraphiteEditor/Graphite | 17,935 | Rust | nupsi | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/cef/input.rs
PR Title: Desktop: Add support for UI scaling
BEFORE CODE: use cef::sys::{cef_event_flags_t, cef_key_event_type_t, cef_mouse_button_type_t};
use cef::{Browser, ImplBrowser, ImplBrowserHost, KeyEvent, KeyEventType, MouseEvent};
use std::t... | Why is this `to_logical(2.0)` should it also be `to_logical(scale)` like to other? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let vector = document.network_interface.compute_modified_vector(layer);
let existing_point_ids: Vec<PointId> = vector.as_ref().map(|v| v.point_domain.ids().to_vec()).unwrap_or_default();
let existing_segment_ids: Vec<SegmentId> = vector.as_ref().map(|v| v.segment_domain.ids().to_vec()).unwrap_or_default();
fo... | Note that this inserts the point in layer space. You said above that you `Build arrow in viewport space`.
To convert between the viewport and the layer space, you can do something like:
```rs
document.metadata().transform_to_viewport(layer).inverse().transform_point2(pos)
```
Alternatively you can set the tran... |
// Calculate proportional dimensions based on arrow length
let shaft_width = length_document * 0.1;
let head_width = length_document * 0.3;
let head_length = length_document * 0.2;
// Update Arrow node parameters with document space coordinates (like Line tool)
responses.add(NodeGraphMessage::SetInput {
... | @@ -0,0 +1,102 @@
+use super::shape_utility::ShapeToolModifierKey;
+use super::*;
+use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_document_node_type;
+use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
+use crate::messages::portfolio::document::... | editor/src/messages/tool/common_functionality/shapes/arrow_shape.rs | 26 | Rust | 1 | bug | 698 | 46 | 34 | false | Add an arrow to the Shape tool | 3,343 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | krVatsal | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/common_functionality/shapes/arrow_shape.rs
PR Title: Add an arrow to the Shape tool
BEFORE CODE:
let vector = document.network_interface.compute_modified_vector(layer);
let existing_point_ids: Vec<PointId> = vector.as_ref().map(|v| ... | Note that this inserts the point in layer space. You said above that you `Build arrow in viewport space`.
To convert between the viewport and the layer space, you can do something like:
```rs
document.metadata().transform_to_viewport(layer).inverse().transform_point2(pos)
```
Alternatively you can set the tran... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
match (resize, rotate, skew) {
(true, false, false) => {
tool_data.get_snap_candidates(document, input, viewport);
update_cursor_and_pointer(tool_data, responses);
return ShapeToolFsmState::ResizingBounds;
}
(false, true, false) => {
tool_data.data.drag_start = mouse_... | ```suggestion
tool_data.data.start(document, input, viewport);
``` | match (resize, rotate, skew) {
(true, false, false) => {
tool_data.get_snap_candidates(document, input, viewport);
update_cursor_and_pointer(tool_data, responses);
return ShapeToolFsmState::ResizingBounds;
}
(false, true, false) => {
tool_data.data.drag_start = mouse_... | @@ -805,9 +830,9 @@ impl Fsm for ShapeToolFsmState {
match tool_data.current_shape {
ShapeType::Polygon | ShapeType::Star | ShapeType::Circle | ShapeType::Arc | ShapeType::Spiral | ShapeType::Grid | ShapeType::Rectangle | ShapeType::Ellipse => {
- tool_data.data.start(document, input, viewport);
+ ... | editor/src/messages/tool/tool_messages/shape_tool.rs | 26 | Rust | 0.571 | suggestion | 72 | 51 | 51 | false | Add an arrow to the Shape tool | 3,343 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | krVatsal | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/shape_tool.rs
PR Title: Add an arrow to the Shape tool
BEFORE CODE: match (resize, rotate, skew) {
(true, false, false) => {
tool_data.get_snap_candidates(document, input, viewport);
update_cursor_a... | ```suggestion
tool_data.data.start(document, input, viewport);
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
NavigationMessage::CanvasZoomMouseWheel => {
let scroll = ipp.mouse.scroll_delta.scroll_delta();
let mut zoom_factor = 1. + scroll.abs() * preferences.viewport_zoom_wheel_rate;
if ipp.mouse.scroll_delta.y > 0. {
zoom_factor = 1. / zoom_factor
}
let document_bounds = if !graph_view_overlay_op... | Is this todo comment resolved now, warranting its removal? | NavigationMessage::CanvasZoomMouseWheel => {
let scroll = ipp.mouse.scroll_delta.scroll_delta();
let mut zoom_factor = 1. + scroll.abs() * preferences.viewport_zoom_wheel_rate;
if ipp.mouse.scroll_delta.y > 0. {
zoom_factor = 1. / zoom_factor
}
let document_bounds = if !graph_view_overlay_op... | @@ -256,8 +256,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
}
NavigationMessage::CanvasZoomSet { zoom_factor } => {
let document_bounds = if !graph_view_overlay_open {
- // TODO: Cache this in node graph coordinates and apply the transform to the rectangle to ge... | editor/src/messages/portfolio/document/navigation/navigation_message_handler.rs | 26 | Rust | 0.214 | question | 58 | 51 | 51 | false | Respect artboard clipping when computing canvas scrollbars | 3,387 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | ashishmohapatra240 | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/navigation/navigation_message_handler.rs
PR Title: Respect artboard clipping when computing canvas scrollbars
BEFORE CODE: NavigationMessage::CanvasZoomMouseWheel => {
let scroll = ipp.mouse.scroll_delta.scroll_delta... | Is this todo comment resolved now, warranting its removal? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
#[derive(Debug, Subcommand)]
enum Command {
/// Help message for compile.
Compile {
/// Print proto network
#[clap(long, short = 'p')]
print_proto: bool,
/// Path to the .graphite document
document: PathBuf,
},
/// Help message for run.
Run {
/// Path to the .graphite document
document: PathBuf,
... | I suggest calling this "List" not "Print". | }
#[derive(Debug, Subcommand)]
enum Command {
/// Help message for compile.
Compile {
/// Print proto network
#[clap(long, short = 'p')]
print_proto: bool,
/// Path to the .graphite document
document: PathBuf,
},
/// Help message for run.
Run {
/// Path to the .graphite document
document: PathBuf,
... | @@ -56,6 +56,7 @@ enum Command {
#[clap(long, short = 'l')]
run_loop: bool,
},
+ PrintNodeIdentifiers, | node-graph/graphene-cli/src/main.rs | 26 | Rust | 0.071 | suggestion | 42 | 51 | 51 | false | Add a command to Graphene CLI for listing protonode identifiers | 3,399 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/graphene-cli/src/main.rs
PR Title: Add a command to Graphene CLI for listing protonode identifiers
BEFORE CODE: }
#[derive(Debug, Subcommand)]
enum Command {
/// Help message for compile.
Compile {
/// Print proto network
#[clap(long, short = '... | I suggest calling this "List" not "Print". | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
match app.command {
Command::Compile { print_proto, .. } => {
if print_proto {
println!("{proto_graph}");
}
}
Command::Run { run_loop, .. } => {
std::thread::spawn(move || {
loop {
std::thread::sleep(std::time::Duration::from_nanos(10));
device.poll(wgpu::PollType::Poll).unwrap();
... | - `all` -> `All`
- `hadled` -> handled? | match app.command {
Command::Compile { print_proto, .. } => {
if print_proto {
println!("{proto_graph}");
}
}
Command::Run { run_loop, .. } => {
std::thread::spawn(move || {
loop {
std::thread::sleep(std::time::Duration::from_nanos(10));
device.poll(wgpu::PollType::Poll).unwrap();
... | @@ -123,6 +132,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
tokio::time::sleep(std::time::Duration::from_millis(16)).await;
}
}
+ _ => unreachable!("all other commands should be hadled before this match statement is run") | node-graph/graphene-cli/src/main.rs | 26 | Rust | 0.357 | question | 39 | 51 | 51 | false | Add a command to Graphene CLI for listing protonode identifiers | 3,399 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/graphene-cli/src/main.rs
PR Title: Add a command to Graphene CLI for listing protonode identifiers
BEFORE CODE: match app.command {
Command::Compile { print_proto, .. } => {
if print_proto {
println!("{proto_graph}");
}
}
Command::Run... | - `all` -> `All`
- `hadled` -> handled? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
node_graph_message_sender: Box::new(UpdateLogger {}),
editor_preferences: Box::new(preferences),
});
let proto_graph = compile_graph(document_string, editor_api)?;
match app.command {
Command::Compile { print_proto, .. } => {
if print_proto {
println!("{proto_graph}");
}
}
Command::Run { run_lo... | WasmEditorApi seems to be the wrong name now. | }
return Ok(());
}
};
let document_string = std::fs::read_to_string(document_path).expect("Failed to read document");
log::info!("creating gpu context",);
let mut application_io = block_on(WasmApplicationIo::new_offscreen());
if let Command::Export { image: Some(ref image_path), .. } = app.command {
a... | @@ -92,15 +111,24 @@ async fn main() -> Result<(), Box<dyn Error>> {
log::info!("creating gpu context",);
let mut application_io = block_on(WasmApplicationIo::new_offscreen());
- if let Command::Run { image: Some(ref image_path), .. } = app.command {
+ if let Command::Export { image: Some(ref image_path), .. } = ... | node-graph/graphene-cli/src/main.rs | 26 | Rust | 0.071 | bug | 45 | 51 | 51 | false | Add export command to Graphene CLI | 3,400 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/graphene-cli/src/main.rs
PR Title: Add export command to Graphene CLI
BEFORE CODE: node_graph_message_sender: Box::new(UpdateLogger {}),
editor_preferences: Box::new(preferences),
});
let proto_graph = compile_graph(document_string, editor_api)... | WasmEditorApi seems to be the wrong name now. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
async fn main() -> Result<(), Box<dyn Error>> {
let app = App::parse();
let log_level = app.global_opts.verbose;
init_logging(log_level);
let document_path = match app.command {
Command::Compile { ref document, .. } => document,
Command::Run { ref document, .. } => document,
Command::ListNodeIdentifiers =>... | If run is not an option for now we should remove the window handling code.
That is not working at the moment AFAIK | /// Output height in pixels
#[clap(long)]
height: Option<u32>,
/// Transparent background for PNG exports
#[clap(long)]
transparent: bool,
},
ListNodeIdentifiers,
}
#[derive(Debug, Args)]
struct GlobalOpts {
/// Verbosity level (can be specified multiple times)
#[clap(long, short, global = true, actio... | @@ -92,15 +111,24 @@ async fn main() -> Result<(), Box<dyn Error>> {
log::info!("creating gpu context",);
let mut application_io = block_on(WasmApplicationIo::new_offscreen());
- if let Command::Run { image: Some(ref image_path), .. } = app.command { | node-graph/graphene-cli/src/main.rs | 26 | Rust | 0.429 | suggestion | 114 | 51 | 51 | false | Add export command to Graphene CLI | 3,400 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/graphene-cli/src/main.rs
PR Title: Add export command to Graphene CLI
BEFORE CODE: async fn main() -> Result<(), Box<dyn Error>> {
let app = App::parse();
let log_level = app.global_opts.verbose;
init_logging(log_level);
let document_path = mat... | If run is not an option for now we should remove the window handling code.
That is not working at the moment AFAIK | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
node.map_ids(|id| NodeId(*new_positions.get(&id).expect("node not found in lookup table") as u64));
new_nodes.push((NodeId(index as u64), node));
}
// Update node references to reflect the new order
// new_nodes.iter_mut().for_each(|(_, node)| {
// node.map_ids(|id| *new_positions.get(&id).expect("node ... | ```suggestion
/// The `inputs` represents a formatted list of input indices corresponding to their types.
/// Each element in `error_inputs` represents a valid `NodeIOTypes` implementation.
/// The inner Vec stores the inputs which need to be changed and what type each needs to be changed to.
``` | node.map_ids(|id| NodeId(*new_positions.get(&id).expect("node not found in lookup table") as u64));
new_nodes.push((NodeId(index as u64), node));
}
// Update node references to reflect the new order
// new_nodes.iter_mut().for_each(|(_, node)| {
// node.map_ids(|id| *new_positions.get(&id).expect("node ... | @@ -542,6 +542,8 @@ pub enum GraphErrorType {
UnexpectedGenerics { index: usize, inputs: Vec<Type> },
NoImplementations,
NoConstructor,
+ // The first vec represents a list of correct NodeIOTypes
+ // The second vec represents what the input index and what it expects | node-graph/graph-craft/src/proto.rs | 26 | Rust | 1 | suggestion | 300 | 51 | 51 | false | Use more specific node input indexing when displaying invalid input errors | 3,415 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | adamgerhant | Review this pull request change.
Language: Rust
File: node-graph/graph-craft/src/proto.rs
PR Title: Use more specific node input indexing when displaying invalid input errors
BEFORE CODE: node.map_ids(|id| NodeId(*new_positions.get(&id).expect("node not found in lookup table") as u64));
new_nodes.push((NodeId... | ```suggestion
/// The `inputs` represents a formatted list of input indices corresponding to their types.
/// Each element in `error_inputs` represents a valid `NodeIOTypes` implementation.
/// The inner Vec stores the inputs which need to be changed and what type each needs to be changed to.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
pub context_features: ContextDependencies,
/// The path to this node and its inputs and outputs as of when [`NodeNetwork::generate_node_paths`] was called.
#[serde(skip)]
pub original_location: OriginalLocation,
}
/// Represents the original location of a node input/output when [`NodeNetwork::generate_node_paths`]... | ```suggestion
/// For automatically inserted Convert and Into nodes, if there is an error, display it on the node it is connect to.
``` | pub context_features: ContextDependencies,
/// The path to this node and its inputs and outputs as of when [`NodeNetwork::generate_node_paths`] was called.
#[serde(skip)]
pub original_location: OriginalLocation,
}
/// Represents the original location of a node input/output when [`NodeNetwork::generate_node_paths`]... | @@ -84,6 +84,8 @@ pub struct OriginalLocation {
pub dependants: Vec<Vec<NodeId>>,
/// A list of flags indicating whether the input is exposed in the UI
pub inputs_exposed: Vec<bool>,
+ // For automatically inserted convert and into nodes, if there is an error display it on the node it is connect to | node-graph/graph-craft/src/document.rs | 26 | Rust | 0.857 | suggestion | 136 | 51 | 51 | false | Use more specific node input indexing when displaying invalid input errors | 3,415 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | adamgerhant | Review this pull request change.
Language: Rust
File: node-graph/graph-craft/src/document.rs
PR Title: Use more specific node input indexing when displaying invalid input errors
BEFORE CODE: pub context_features: ContextDependencies,
/// The path to this node and its inputs and outputs as of when [`NodeNetwork::g... | ```suggestion
/// For automatically inserted Convert and Into nodes, if there is an error, display it on the node it is connect to.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
.iter()
.map(|node_io| {
let generics_lookup: Result<HashMap<_, _>, _> = collect_generics(node_io)
.iter()
.map(|generic| check_generic(node_io, call_argument, &inputs, generic).map(|x| (generic.to_string(), x)))
.collect();
generics_lookup.map(|generics_lookup| {
let orig_node_io = (... | ```suggestion
// For errors on Convert nodes, offset the input index so it correctly corresponds to the node it is connected to.
``` | }
// List of all implementations that match the input types
let valid_output_types = impls
.keys()
.filter(|node_io| valid_type(&node_io.call_argument, call_argument) && inputs.iter().zip(node_io.inputs.iter()).all(|(p1, p2)| valid_type(p1, p2)))
.collect::<Vec<_>>();
// Attempt to substitute generic... | @@ -756,20 +758,19 @@ impl TypingContext {
match valid_impls.as_slice() {
[] => {
+ let convert_node_index_offset = node.original_location.auto_convert_index.unwrap_or(0);
let mut best_errors = usize::MAX;
let mut error_inputs = Vec::new();
for node_io in impls.keys() {
+ // For errors on... | node-graph/graph-craft/src/proto.rs | 26 | Rust | 0.857 | suggestion | 137 | 51 | 51 | false | Use more specific node input indexing when displaying invalid input errors | 3,415 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | adamgerhant | Review this pull request change.
Language: Rust
File: node-graph/graph-craft/src/proto.rs
PR Title: Use more specific node input indexing when displaying invalid input errors
BEFORE CODE: .iter()
.map(|node_io| {
let generics_lookup: Result<HashMap<_, _>, _> = collect_generics(node_io)
.iter()
.... | ```suggestion
// For errors on Convert nodes, offset the input index so it correctly corresponds to the node it is connected to.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Converts text into editable vector shapes with customizable styling.
/// Parameters control font, size, spacing, alignment, and layout.
#[node_macro::node(category(""))]
fn text<'i: 'n>(
_: impl Ctx,
editor: &'i WasmEditorApi,
text: String,
font_name: Font,
#[unit(" px")]
#[default(24.)]
font_size: f64,
#[... | "one Vector" -> "one vector element"
Add "by subsequent operations" to the end of the last sentence. | #[node_macro::node(category(""))]
fn text<'i: 'n>(
_: impl Ctx,
editor: &'i WasmEditorApi,
text: String,
font: Font,
#[unit(" px")]
#[default(24.)]
font_size: f64,
#[unit("x")]
#[default(1.2)]
line_height_ratio: f64,
#[unit(" px")]
#[default(0.)]
character_spacing: f64,
#[unit(" px")] max_width: Option<f6... | @@ -25,7 +28,8 @@ fn text<'i: 'n>(
#[default(0.)]
tilt: f64,
align: TextAlign,
- /// Splits each text glyph into its own row in the table of vector geometry.
+ /// When enabled, outputs a table with one Vector per character, allowing individual character manipulation. | node-graph/nodes/gstd/src/text.rs | 26 | Rust | 0.357 | suggestion | 101 | 43 | 39 | false | Add tooltip documentation to web request and brush related nodes | 3,427 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | PolyglotOpenstreetmap | Review this pull request change.
Language: Rust
File: node-graph/nodes/gstd/src/text.rs
PR Title: Add tooltip documentation to web request and brush related nodes
BEFORE CODE: /// Converts text into editable vector shapes with customizable styling.
/// Parameters control font, size, spacing, alignment, and layout.
... | "one Vector" -> "one vector element"
Add "by subsequent operations" to the end of the last sentence. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
#[cfg(not(feature = "tokio"))]
if discard_result {
return String::new();
}
}
let Ok(response) = reqwest::Client::new().post(url).body(body).header("Content-Type", "application/octet-stream").send().await else {
return String::new();
};
response.text().await.ok().unwrap_or_default()
}
/// Prepare te... | You can re add the new line you removed | {
if discard_result {
wasm_bindgen_futures::spawn_local(async move {
let _ = reqwest::Client::new().post(url).body(body).header("Content-Type", "application/octet-stream").send().await;
});
return String::new();
}
}
#[cfg(not(target_family = "wasm"))]
{
#[cfg(feature = "tokio")]
if discard_resu... | @@ -97,17 +100,19 @@ async fn post_request(_: impl Ctx, _primary: (), #[name("URL")] url: String, bod
response.text().await.ok().unwrap_or_default()
}
+/// Prepare text for transmission over HTTP or storage in binary file formats.
#[node_macro::node(category("Web Request"), name("String to Bytes"))]
fn string_to... | node-graph/nodes/gstd/src/wasm_application_io.rs | 26 | Rust | 0.143 | suggestion | 39 | 51 | 51 | false | Add tooltip documentation to web request and brush related nodes | 3,427 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | PolyglotOpenstreetmap | Review this pull request change.
Language: Rust
File: node-graph/nodes/gstd/src/wasm_application_io.rs
PR Title: Add tooltip documentation to web request and brush related nodes
BEFORE CODE: }
#[cfg(not(feature = "tokio"))]
if discard_result {
return String::new();
}
}
let Ok(response) = reqwest::Clie... | You can re add the new line you removed | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Parameters control font, size, spacing, alignment, and layout.
#[node_macro::node(category(""))]
fn text<'i: 'n>(
_: impl Ctx,
editor: &'i WasmEditorApi,
text: String,
font_name: Font,
#[unit(" px")]
#[default(24.)]
font_size: f64,
#[unit("x")]
#[default(1.2)]
line_height_ratio: f64,
#[unit(" px")]
#[d... | "Vector" -> "vector element"
Remove sentence about default, that will be shown automatically as part of future documentation generation infrastructure. | fn text<'i: 'n>(
_: impl Ctx,
editor: &'i WasmEditorApi,
text: String,
font: Font,
#[unit(" px")]
#[default(24.)]
font_size: f64,
#[unit("x")]
#[default(1.2)]
line_height_ratio: f64,
#[unit(" px")]
#[default(0.)]
character_spacing: f64,
#[unit(" px")] max_width: Option<f64>,
#[unit(" px")] max_height: Op... | @@ -25,7 +28,8 @@ fn text<'i: 'n>(
#[default(0.)]
tilt: f64,
align: TextAlign,
- /// Splits each text glyph into its own row in the table of vector geometry.
+ /// When enabled, outputs a table with one Vector per character, allowing individual character manipulation.
+ /// When disabled, outputs a single Vect... | node-graph/nodes/gstd/src/text.rs | 26 | Rust | 0.429 | suggestion | 152 | 42 | 38 | false | Add tooltip documentation to web request and brush related nodes | 3,427 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | PolyglotOpenstreetmap | Review this pull request change.
Language: Rust
File: node-graph/nodes/gstd/src/text.rs
PR Title: Add tooltip documentation to web request and brush related nodes
BEFORE CODE: /// Parameters control font, size, spacing, alignment, and layout.
#[node_macro::node(category(""))]
fn text<'i: 'n>(
_: impl Ctx,
editor... | "Vector" -> "vector element"
Remove sentence about default, that will be shown automatically as part of future documentation generation infrastructure. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
pub use graph_craft::wasm_application_io::*;
use graphene_application_io::ApplicationIo;
#[cfg(target_family = "wasm")]
use graphic_types::Graphic;
#[cfg(target_family = "wasm")]
use graphic_types::Vector;
use graphic_types::raster_types::Image;
use graphic_types::raster_types::{CPU, Raster};
#[cfg(target_family = "was... | This should describe the parameter, not the whole node. | pub use graph_craft::wasm_application_io::*;
use graphene_application_io::ApplicationIo;
#[cfg(target_family = "wasm")]
use graphic_types::Graphic;
#[cfg(target_family = "wasm")]
use graphic_types::Vector;
use graphic_types::raster_types::Image;
use graphic_types::raster_types::{CPU, Raster};
#[cfg(target_family = "was... | @@ -27,12 +27,14 @@ use wasm_bindgen::JsCast;
#[cfg(target_family = "wasm")]
use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement};
+/// Allocates GPU memory and rendering context for vector-to-raster conversion. Must be paired with the Rasterize node.
#[cfg(feature = "wgpu")]
#[node_macro::node(category("De... | node-graph/nodes/gstd/src/wasm_application_io.rs | 26 | Rust | 0.286 | suggestion | 55 | 51 | 51 | false | Add tooltip documentation to web request and brush related nodes | 3,427 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | PolyglotOpenstreetmap | Review this pull request change.
Language: Rust
File: node-graph/nodes/gstd/src/wasm_application_io.rs
PR Title: Add tooltip documentation to web request and brush related nodes
BEFORE CODE: pub use graph_craft::wasm_application_io::*;
use graphene_application_io::ApplicationIo;
#[cfg(target_family = "wasm")]
use g... | This should describe the parameter, not the whole node. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
pub const SNAP_POINT_TOLERANCE: f64 = 5.;
/// These are layers whose bounding boxes are used for alignment.
pub const MAX_ALIGNMENT_CANDIDATES: usize = 100;
/// These are layers that are used for the layer snapper.
pub const MAX_SNAP_CANDIDATES: usize = 10;
/// These are points (anchors and bounding box corners etc.) i... | ```suggestion
pub const BLUE_LAYER_ORIGIN_CROSS_DIAMETER: f64 = 10.;
pub const BLUE_LAYER_ORIGIN_CROSS_THICKNESS: f64 = 1.;
``` | pub const SNAP_POINT_TOLERANCE: f64 = 5.;
/// These are layers whose bounding boxes are used for alignment.
pub const MAX_ALIGNMENT_CANDIDATES: usize = 100;
/// These are layers that are used for the layer snapper.
pub const MAX_SNAP_CANDIDATES: usize = 10;
/// These are points (anchors and bounding box corners etc.) i... | @@ -56,6 +56,8 @@ pub const DEFAULT_STROKE_WIDTH: f64 = 2.;
pub const SELECTION_TOLERANCE: f64 = 5.;
pub const DRAG_DIRECTION_MODE_DETERMINATION_THRESHOLD: f64 = 15.;
pub const SELECTION_DRAG_ANGLE: f64 = 90.;
+pub const BLUE_LAYER_ORIGIN_CROSS_DIAMETER: f64 = 20.;
+pub const BLUE_LAYER_ORIGIN_CROSS_THICKNESS: f64 =... | editor/src/consts.rs | 26 | Rust | 0.714 | suggestion | 127 | 51 | 51 | false | Add a Select tool overlay for the layer origin | 3,471 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | 0HyperCube | Review this pull request change.
Language: Rust
File: editor/src/consts.rs
PR Title: Add a Select tool overlay for the layer origin
BEFORE CODE: pub const SNAP_POINT_TOLERANCE: f64 = 5.;
/// These are layers whose bounding boxes are used for alignment.
pub const MAX_ALIGNMENT_CANDIDATES: usize = 100;
/// These are ... | ```suggestion
pub const BLUE_LAYER_ORIGIN_CROSS_DIAMETER: f64 = 10.;
pub const BLUE_LAYER_ORIGIN_CROSS_THICKNESS: f64 = 1.;
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
fn tangent_at_end(&self) -> DVec2 {
self.tangent_at(1.0)
}
}
impl Tangent for kurbo::Line {
fn tangent_at(&self, _t: f64) -> DVec2 {
self.tangent_at_start()
}
fn tangent_at_start(&self) -> DVec2 {
let delta = self.p1 - self.p0;
DVec2 { x: delta.x, y: delta.y }
}
fn tangent_at_end(&self) -> DVec2 {
... | If the handle is placed on top of the anchor then this will be zero.
For reference, here is my impl of the tangent at start which attempts to avoid reporting zero length tangents:
https://github.com/GraphiteEditor/Graphite/blob/06749ecea52f3085903bca5a0b242f3a83f9538c/node-graph/libraries/vector-types/src/vector/algor... |
fn tangent_at_end(&self) -> DVec2 {
self.tangent_at(1.0)
}
}
trait ControlPoints {
type Points: AsRef<[Point]>;
fn control_points(&self) -> Self::Points;
}
impl ControlPoints for kurbo::Line {
type Points = [Point; 2];
fn control_points(&self) -> Self::Points {
[self.p0, self.p1]
}
}
impl ControlPoints f... | @@ -246,6 +246,74 @@ pub fn pathseg_abs_diff_eq(seg1: PathSeg, seg2: PathSeg, max_abs_diff: f64) -> b
seg1_points.len() == seg2_points.len() && seg1_points.into_iter().zip(seg2_points).all(|(a, b)| cmp(a.x, b.x) && cmp(a.y, b.y))
}
+pub trait Tangent {
+ fn tangent_at(&self, t: f64) -> DVec2;
+
+ fn tangent_at_sta... | node-graph/libraries/vector-types/src/vector/misc.rs | 26 | Rust | 0.643 | suggestion | 357 | 51 | 51 | false | Implement proper fill rendering for vector meshes | 3,474 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | liunicholas6 | Review this pull request change.
Language: Rust
File: node-graph/libraries/vector-types/src/vector/misc.rs
PR Title: Implement proper fill rendering for vector meshes
BEFORE CODE:
fn tangent_at_end(&self) -> DVec2 {
self.tangent_at(1.0)
}
}
impl Tangent for kurbo::Line {
fn tangent_at(&self, _t: f64) -> DVec... | If the handle is placed on top of the anchor then this will be zero.
For reference, here is my impl of the tangent at start which attempts to avoid reporting zero length tangents:
https://github.com/GraphiteEditor/Graphite/blob/06749ecea52f3085903bca5a0b242f3a83f9538c/node-graph/libraries/vector-types/src/vector/algor... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
tool_options: &Self::ToolOptions,
responses: &mut VecDeque<Message>,
) -> Self {
let ToolActionMessageContext {
document,
input,
viewport,
shape_editor,
..
} = tool_action_data;
update_dynamic_hints(self, responses, shape_editor, document, tool_data, tool_options, input.mouse.position);
le... | In both of these calls, `MenuBarMessage::SendLayout` is expensive. Can you find a way to check if a re-send is necessary before making the call, so it's conditional instead of always? | tool_options: &Self::ToolOptions,
responses: &mut VecDeque<Message>,
) -> Self {
let ToolActionMessageContext {
document,
input,
viewport,
shape_editor,
..
} = tool_action_data;
update_dynamic_hints(self, responses, shape_editor, document, tool_data, tool_options, input.mouse.position);
le... | @@ -1575,6 +1575,7 @@ impl Fsm for PathToolFsmState {
shape_editor.set_selected_layers(target_layers);
+ responses.add(MenuBarMessage::SendLayout); | editor/src/messages/tool/tool_messages/path_tool.rs | 26 | Rust | 0.571 | performance | 183 | 51 | 51 | false | Fix disabled state of Layer > Make Path Editable menu action getting out of sync | 3,497 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Annonnymmousss | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/path_tool.rs
PR Title: Fix disabled state of Layer > Make Path Editable menu action getting out of sync
BEFORE CODE: tool_options: &Self::ToolOptions,
responses: &mut VecDeque<Message>,
) -> Self {
let ToolActionMess... | In both of these calls, `MenuBarMessage::SendLayout` is expensive. Can you find a way to check if a re-send is necessary before making the call, so it's conditional instead of always? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
shape_editor.deselect_all_segments();
responses.add(OverlaysMessage::Draw);
PathToolFsmState::Ready
}
(_, PathToolMessage::SelectedPointXChanged { new_x }) => {
if let Some(&SingleSelectedPoint { coordinates, id, layer, .. }) = tool_data.selection_status.as_one() {
shape_editor.reposition_c... | This looks redundant with the line that's two lines below. | shape_editor.deselect_all_segments();
responses.add(OverlaysMessage::Draw);
PathToolFsmState::Ready
}
(_, PathToolMessage::SelectedPointXChanged { new_x }) => {
if let Some(&SingleSelectedPoint { coordinates, id, layer, .. }) = tool_data.selection_status.as_one() {
shape_editor.reposition_c... | @@ -3125,8 +3129,15 @@ impl Fsm for PathToolFsmState {
colinear,
};
+ let new_state = make_path_editable_is_allowed(&mut document.network_interface).is_some(); | editor/src/messages/tool/tool_messages/path_tool.rs | 26 | Rust | 0.214 | suggestion | 58 | 51 | 51 | false | Fix disabled state of Layer > Make Path Editable menu action getting out of sync | 3,497 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Annonnymmousss | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/path_tool.rs
PR Title: Fix disabled state of Layer > Make Path Editable menu action getting out of sync
BEFORE CODE: shape_editor.deselect_all_segments();
responses.add(OverlaysMessage::Draw);
PathToolFsmState... | This looks redundant with the line that's two lines below. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let mut gradient = gradient.clone();
std::mem::swap(&mut gradient.start, &mut gradient.end);
TaggedValue::Fill(Fill::Gradient(gradient))
}
},
node_id,
FillInput::<Color>::INDEX,
))
.widget_instance();
row.push(Separator::new(SeparatorStyle::Unrelated).widge... | This makes an un-idiomatic change where the call to the `on_update` function (which receives back a `Message`) is now inlined for the message creation, for the sake of creating two batched messages. You can and should still call `on_update` and use its return value as one of the two messages that are given to the array... | let mut gradient = gradient.clone();
std::mem::swap(&mut gradient.start, &mut gradient.end);
TaggedValue::Fill(Fill::Gradient(gradient))
}
},
node_id,
FillInput::<Color>::INDEX,
))
.widget_instance();
row.push(Separator::new(SeparatorStyle::Unrelated).widge... | @@ -1951,35 +1951,35 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
}
}
- let new_gradient1 = gradient.clone();
- let new_gradient2 = gradient.clone();
+ let gradient_for_closure = gradient.clone();
- let entries = vec![
- RadioEntryData::new("Linear")
- .label("... | editor/src/messages/portfolio/document/node_graph/node_properties.rs | 26 | Rust | 0.643 | performance | 358 | 51 | 51 | false | Fix the Gradient tool's linear/radial type toggle resetting the gradient color stops | 3,499 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Annonnymmousss | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/node_graph/node_properties.rs
PR Title: Fix the Gradient tool's linear/radial type toggle resetting the gradient color stops
BEFORE CODE: let mut gradient = gradient.clone();
std::mem::swap(&mut gradient.sta... | This makes an un-idiomatic change where the call to the `on_update` function (which receives back a `Message`) is now inlined for the message creation, for the sake of creating two batched messages. You can and should still call `on_update` and use its return value as one of the two messages that are given to the array... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
(_, PathToolMessage::ClosePath) => {
responses.add(DocumentMessage::AddTransaction);
shape_editor.close_selected_path(document, responses);
responses.add(DocumentMessage::EndTransaction);
responses.add(OverlaysMessage::Draw);
self
}
(_, PathToolMessage::ConnectPointsByPosition { laye... | I don't think this for loop is an overhead here, realistically there would'nt be more than 100-200 points max here . Thats just my guess , can definitely have a hashmap here as well | }
(_, PathToolMessage::ClosePath) => {
responses.add(DocumentMessage::AddTransaction);
shape_editor.close_selected_path(document, responses);
responses.add(DocumentMessage::EndTransaction);
responses.add(OverlaysMessage::Draw);
self
}
(_, PathToolMessage::ConnectPointsByPosition { laye... | @@ -2669,6 +2674,46 @@ impl Fsm for PathToolFsmState {
self
}
+ (_, PathToolMessage::ConnectPointsByPosition { layer, start_position, end_position }) => {
+ // Get the merged vector
+ let Some(vector) = document.network_interface.compute_modified_vector(layer) else {
+ return self;
+ };
+
+ ... | editor/src/messages/tool/tool_messages/path_tool.rs | 26 | Rust | 0.357 | suggestion | 182 | 51 | 51 | false | Fix joining paths from different layers with Ctrl+J fails | 3,534 | GraphiteEditor/Graphite | 17,935 | Rust | Ayush2k02 | Ayush2k02 | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/path_tool.rs
PR Title: Fix joining paths from different layers with Ctrl+J fails
BEFORE CODE: }
(_, PathToolMessage::ClosePath) => {
responses.add(DocumentMessage::AddTransaction);
shape_editor.close_selected_... | I don't think this for loop is an overhead here, realistically there would'nt be more than 100-200 points max here . Thats just my guess , can definitely have a hashmap here as well | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
(point.as_handle().is_some() && self.ignore_handles) || (point.as_anchor().is_some() && self.ignore_anchors)
}
/// Creates a dummy modification to trigger graph reorganization.
fn add_dummy_modification_to_trigger_graph_reorganization(layer: LayerNodeIdentifier, start_point: PointId, _end_point: PointId, response... | You might want to print a warning to help debugging edge cases.
```suggestion
let (Some(start_local), Some(end_local)) = (start_local_pos, end_local_pos) else {
warn!("Unable to resolve point ids for joining");
return;
};
``` | (point.as_handle().is_some() && self.ignore_handles) || (point.as_anchor().is_some() && self.ignore_anchors)
}
/// Applies a dummy vector modification to the layer. In the case where a group containing some vector data is selected, this triggers the creation of a «Flatten Path» node.
fn add_dummy_modification_to_... | @@ -421,6 +421,52 @@ impl ShapeState {
(point.as_handle().is_some() && self.ignore_handles) || (point.as_anchor().is_some() && self.ignore_anchors)
}
+ /// Creates a dummy modification to trigger graph reorganization.
+ fn add_dummy_modification_to_trigger_graph_reorganization(layer: LayerNodeIdentifier, start_p... | editor/src/messages/tool/common_functionality/shape_editor.rs | 26 | Rust | 0.929 | bug | 235 | 51 | 51 | false | Fix joining paths from different layers with Ctrl+J fails | 3,534 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Ayush2k02 | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/common_functionality/shape_editor.rs
PR Title: Fix joining paths from different layers with Ctrl+J fails
BEFORE CODE: (point.as_handle().is_some() && self.ignore_handles) || (point.as_anchor().is_some() && self.ignore_anchors)
}
///... | You might want to print a warning to help debugging edge cases.
```suggestion
let (Some(start_local), Some(end_local)) = (start_local_pos, end_local_pos) else {
warn!("Unable to resolve point ids for joining");
return;
};
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
adjust_handle_colinearity(handle2, end, nc2, &vector, layer, responses);
if let Some(adjacent_handles) = temporary_adjacent_handles_while_molding {
if let Some(other_handle1) = adjacent_handles[0] {
restore_g1_continuity(handle1, other_handle1, nc1, start, &vector, layer, responses);
}
if let So... | Perhaps the specific "graph reorganization" could be explained:
```suggestion
/// Applies a dummy vector modification to the layer. In the case where a group containing some vector data is selected, this triggers the creation of a «Flatten Path» node.
``` | adjust_handle_colinearity(handle2, end, nc2, &vector, layer, responses);
if let Some(adjacent_handles) = temporary_adjacent_handles_while_molding {
if let Some(other_handle1) = adjacent_handles[0] {
restore_g1_continuity(handle1, other_handle1, nc1, start, &vector, layer, responses);
}
if let So... | @@ -421,6 +421,52 @@ impl ShapeState {
(point.as_handle().is_some() && self.ignore_handles) || (point.as_anchor().is_some() && self.ignore_anchors)
}
+ /// Creates a dummy modification to trigger graph reorganization. | editor/src/messages/tool/common_functionality/shape_editor.rs | 26 | Rust | 0.857 | suggestion | 256 | 51 | 51 | false | Fix joining paths from different layers with Ctrl+J fails | 3,534 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Ayush2k02 | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/common_functionality/shape_editor.rs
PR Title: Fix joining paths from different layers with Ctrl+J fails
BEFORE CODE: adjust_handle_colinearity(handle2, end, nc2, &vector, layer, responses);
if let Some(adjacent_handles) = tempora... | Perhaps the specific "graph reorganization" could be explained:
```suggestion
/// Applies a dummy vector modification to the layer. In the case where a group containing some vector data is selected, this triggers the creation of a «Flatten Path» node.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// Get the local positions of the selected points
let start_local_pos = document.network_interface.compute_modified_vector(layer1).and_then(|v| v.point_domain.position_from_id(start_point));
let end_local_pos = document.network_interface.compute_modified_vector(layer2).and_then(|v| v.point_domain.position_f... | This is basically duplicated from the `handle_grouped_transform_close_path` function. | if is_grouped {
// Grouped/merged layer: use helper function to handle reorganization
Self::handle_grouped_transform_close_path(document, layer1, start_point, end_point, responses);
} else {
// Single segment: PointIDs are stable, use immediate insertion
let segment_id = SegmentId::generate(... | @@ -447,28 +493,56 @@ impl ShapeState {
let (layer2, end_point) = all_selected_points[1];
if layer1 == layer2 {
+ // Same layer case
if start_point == end_point {
return;
}
- let segment_id = SegmentId::generate();
- let modification_type = VectorModificationType::InsertSegment {
- ... | editor/src/messages/tool/common_functionality/shape_editor.rs | 26 | Rust | 0.5 | refactor | 85 | 51 | 51 | false | Fix joining paths from different layers with Ctrl+J fails | 3,534 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Ayush2k02 | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/common_functionality/shape_editor.rs
PR Title: Fix joining paths from different layers with Ctrl+J fails
BEFORE CODE: // Get the local positions of the selected points
let start_local_pos = document.network_interface.compute_modi... | This is basically duplicated from the `handle_grouped_transform_close_path` function. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
(_, PathToolMessage::BreakPath) => {
shape_editor.break_path_at_selected_point(document, responses);
PathToolFsmState::Ready
}
(_, PathToolMessage::DeleteAndBreakPath) => {
shape_editor.delete_point_and_break_path(document, responses);
PathToolFsmState::Ready
}
(_, PathToolMessage::C... | This could be quite a big tolerance compared to some of the other values:
https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/editor/src/messages/tool/tool_messages/pen_tool.rs#L741
Is there a reason this was chosen? | }
(_, PathToolMessage::BreakPath) => {
shape_editor.break_path_at_selected_point(document, responses);
PathToolFsmState::Ready
}
(_, PathToolMessage::DeleteAndBreakPath) => {
shape_editor.delete_point_and_break_path(document, responses);
PathToolFsmState::Ready
}
(_, PathToolMessage::C... | @@ -2669,6 +2674,60 @@ impl Fsm for PathToolFsmState {
self
}
+ (_, PathToolMessage::ConnectPointsByPosition { layer, start_position, end_position }) => {
+ // Get the merged vector
+ let Some(vector) = document.network_interface.compute_modified_vector(layer) else {
+ return self;
+ };
+
+ ... | editor/src/messages/tool/tool_messages/path_tool.rs | 26 | Rust | 0.5 | question | 254 | 51 | 51 | false | Fix joining paths from different layers with Ctrl+J fails | 3,534 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Ayush2k02 | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/path_tool.rs
PR Title: Fix joining paths from different layers with Ctrl+J fails
BEFORE CODE: }
(_, PathToolMessage::BreakPath) => {
shape_editor.break_path_at_selected_point(document, responses);
PathToolFsmS... | This could be quite a big tolerance compared to some of the other values:
https://github.com/GraphiteEditor/Graphite/blob/42440c0d0bcf5735b05d8a9e5bd27187f74b1589/editor/src/messages/tool/tool_messages/pen_tool.rs#L741
Is there a reason this was chosen? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
impl MaskType {
fn to_attribute(self) -> String {
match self {
Self::Mask => "mask".to_string(),
Self::Clip => "clip-path".to_string(),
}
}
fn write_to_defs(self, svg_defs: &mut String, uuid: u64, svg_string: String) {
let id = format!("mask-{uuid}");
match self {
Self::Clip => write!(svg_defs, r##... | This ends up storing the image data twice? I don't think that this is desirable since images can have large memory requirements. | impl MaskType {
fn to_attribute(self) -> String {
match self {
Self::Mask => "mask".to_string(),
Self::Clip => "clip-path".to_string(),
}
}
fn write_to_defs(self, svg_defs: &mut String, uuid: u64, svg_string: String) {
let id = format!("mask-{uuid}");
match self {
Self::Clip => write!(svg_defs, r##... | @@ -60,6 +60,9 @@ pub struct SvgRender {
pub svg_defs: String,
pub transform: DAffine2,
pub image_data: Vec<(u64, Image<Color>)>,
+ /// HashMap for O(1) lookup: content_hash -> (id, full_image_for_collision_check)
+ /// Used in deduplicating images efficiently
+ image_lookup: HashMap<u64, Vec<(u64, Image<Color>)>... | node-graph/libraries/rendering/src/renderer.rs | 26 | Rust | 0.5 | suggestion | 128 | 51 | 51 | false | Fix rasterize node document leakage with hashmap and eq check | 3,550 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Ayush2k02 | Review this pull request change.
Language: Rust
File: node-graph/libraries/rendering/src/renderer.rs
PR Title: Fix rasterize node document leakage with hashmap and eq check
BEFORE CODE: impl MaskType {
fn to_attribute(self) -> String {
match self {
Self::Mask => "mask".to_string(),
Self::Clip => "clip-path... | This ends up storing the image data twice? I don't think that this is desirable since images can have large memory requirements. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
fn new_ids_from_hash(&mut self, reference: Option<NodeId>) {
for row in self.iter_mut() {
row.element.vector_new_ids_from_hash(reference.map(|id| id.0).unwrap_or_default());
}
}
}
impl Render for Table<Raster<CPU>> {
fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams) {
for row in s... | This is just [`or_insert_with`](https://doc.rust-lang.org/std/collections/hash_map/enum.Entry.html#method.or_insert_with) I guess. |
fn new_ids_from_hash(&mut self, reference: Option<NodeId>) {
for row in self.iter_mut() {
row.element.vector_new_ids_from_hash(reference.map(|id| id.0).unwrap_or_default());
}
}
}
impl Render for Table<Raster<CPU>> {
fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams) {
for row in s... | @@ -1239,23 +1239,21 @@ impl Render for Table<Raster<CPU>> {
fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams) {
for row in self.iter() {
let image = row.element;
+
let transform = *row.transform;
if image.data.is_empty() {
continue;
}
if render_params.to_canva... | node-graph/libraries/rendering/src/renderer.rs | 26 | Rust | 0.5 | suggestion | 130 | 51 | 51 | false | Fix rasterize node document leakage with hashmap and eq check | 3,550 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Ayush2k02 | Review this pull request change.
Language: Rust
File: node-graph/libraries/rendering/src/renderer.rs
PR Title: Fix rasterize node document leakage with hashmap and eq check
BEFORE CODE:
fn new_ids_from_hash(&mut self, reference: Option<NodeId>) {
for row in self.iter_mut() {
row.element.vector_new_ids_from_h... | This is just [`or_insert_with`](https://doc.rust-lang.org/std/collections/hash_map/enum.Entry.html#method.or_insert_with) I guess. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
use core_types::WasmNotSend;
use core_types::memo::*;
use std::hash::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::sync::Arc;
use std::sync::Mutex;
/// Caches the output of a given node called with a specific input.
///
/// A cache miss occurs when the Option is None. In this case, the node evaluates the inne... | ```suggestion
#[node_macro::node(category(""), path(graphene_core::memo), skip_impl)]
``` | use core_types::WasmNotSend;
use core_types::memo::*;
use std::hash::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::sync::Arc;
use std::sync::Mutex;
/// Caches the output of a given node called with a specific input.
///
/// A cache miss occurs when the Option is None. In this case, the node evaluates the inne... | @@ -14,94 +12,38 @@ use std::sync::Mutex;
/// A cache hit occurs when the Option is Some and has a stored hash matching the hash of the call argument. In this case, the node returns the cached value without re-evaluating the inner node.
///
/// Currently, only one input-output pair is cached. Subsequent calls with d... | node-graph/nodes/gcore/src/memo.rs | 15 | Rust | 0.571 | suggestion | 89 | 40 | 40 | false | Migrate memo nodes to node macro and make implementing other persistent nodes easier | 3,552 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/nodes/gcore/src/memo.rs
PR Title: Migrate memo nodes to node macro and make implementing other persistent nodes easier
BEFORE CODE: use core_types::WasmNotSend;
use core_types::memo::*;
use std::hash::DefaultHasher;
use std::hash::{Hash, Hasher};
use ... | ```suggestion
#[node_macro::node(category(""), path(graphene_core::memo), skip_impl)]
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Caches the output of a given node called with a specific input.
///
/// A cache miss occurs when the Option is None. In this case, the node evaluates the inner node and memoizes (stores) the result.
///
/// A cache hit occurs when the Option is Some and has a stored hash matching the hash of the call argument. In t... | ```suggestion
#[node_macro::node(category(""), path(graphene_core::memo), serialize(serialize_monitor), skip_impl)]
``` | /// Caches the output of a given node called with a specific input.
///
/// A cache miss occurs when the Option is None. In this case, the node evaluates the inner node and memoizes (stores) the result.
///
/// A cache hit occurs when the Option is Some and has a stored hash matching the hash of the call argument. In t... | @@ -14,94 +12,38 @@ use std::sync::Mutex;
/// A cache hit occurs when the Option is Some and has a stored hash matching the hash of the call argument. In this case, the node returns the cached value without re-evaluating the inner node.
///
/// Currently, only one input-output pair is cached. Subsequent calls with d... | node-graph/nodes/gcore/src/memo.rs | 26 | Rust | 0.714 | suggestion | 119 | 43 | 43 | false | Migrate memo nodes to node macro and make implementing other persistent nodes easier | 3,552 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | TrueDoctor | Review this pull request change.
Language: Rust
File: node-graph/nodes/gcore/src/memo.rs
PR Title: Migrate memo nodes to node macro and make implementing other persistent nodes easier
BEFORE CODE: /// Caches the output of a given node called with a specific input.
///
/// A cache miss occurs when the Option is None... | ```suggestion
#[node_macro::node(category(""), path(graphene_core::memo), serialize(serialize_monitor), skip_impl)]
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Generates an n-pointed star shape with inner and outer points at chosen radii from the center.
#[node_macro::node(category("Vector: Shape"))]
fn star<T: AsU64>(
_: impl Ctx,
_primary: (),
#[default(5)]
#[hard_min(2.)]
#[implementations(u32, u64, f64)]
sides: T,
#[unit(" px")]
#[default(50)]
radius_1: f64,... | ```suggestion
#[node_macro::node(category("Vector: Shape"), name("QR Code"))]
``` |
/// Generates an n-pointed star shape with inner and outer points at chosen radii from the center.
#[node_macro::node(category("Vector: Shape"))]
fn star<T: AsU64>(
_: impl Ctx,
_primary: (),
#[default(5)]
#[hard_min(2.)]
#[implementations(u32, u64, f64)]
sides: T,
#[unit(" px")]
#[default(50)]
radius_1: f64,... | @@ -186,6 +186,117 @@ fn star<T: AsU64>(
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_diameter)))
}
+/// Generates a QR code from the input text.
+#[node_macro::node(category("Vector: Shape"))] | node-graph/nodes/vector/src/generator_nodes.rs | 26 | Rust | 0.571 | suggestion | 81 | 51 | 51 | false | Introduce QR Code node | 3,565 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Sahil-Gupta584 | Review this pull request change.
Language: Rust
File: node-graph/nodes/vector/src/generator_nodes.rs
PR Title: Introduce QR Code node
BEFORE CODE:
/// Generates an n-pointed star shape with inner and outer points at chosen radii from the center.
#[node_macro::node(category("Vector: Shape"))]
fn star<T: AsU64>(
_:... | ```suggestion
#[node_macro::node(category("Vector: Shape"), name("QR Code"))]
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#[hard_min(2.)]
#[implementations(u32, u64, f64)]
sides: T,
#[unit(" px")]
#[default(50)]
radius_1: f64,
#[unit(" px")]
#[default(25)]
radius_2: f64,
) -> Table<Vector> {
let points = sides.as_u64();
let diameter: f64 = radius_1 * 2.;
let inner_diameter = radius_2 * 2.;
Table::new_from_element(Vector::fro... | Don't use `#[name(...)]` here, it should be used only to fix capitalization issues which isn't needed in this case.
Let's call this `individual_squares` which is the inverse of the current `merge`. It should be `false` by default, meaning the `#[default(true)]` line should be removed, since we normally want the square... | #[hard_min(2.)]
#[implementations(u32, u64, f64)]
sides: T,
#[unit(" px")]
#[default(50)]
radius_1: f64,
#[unit(" px")]
#[default(25)]
radius_2: f64,
) -> Table<Vector> {
let points = sides.as_u64();
let diameter: f64 = radius_1 * 2.;
let inner_diameter = radius_2 * 2.;
Table::new_from_element(Vector::fro... | @@ -186,6 +186,117 @@ fn star<T: AsU64>(
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_diameter)))
}
+/// Generates a QR code from the input text.
+#[node_macro::node(category("Vector: Shape"))]
+fn qr_code(
+ _: impl Ctx,
+ _primar... | node-graph/nodes/vector/src/generator_nodes.rs | 26 | Rust | 0.643 | suggestion | 397 | 51 | 51 | false | Introduce QR Code node | 3,565 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Sahil-Gupta584 | Review this pull request change.
Language: Rust
File: node-graph/nodes/vector/src/generator_nodes.rs
PR Title: Introduce QR Code node
BEFORE CODE: #[hard_min(2.)]
#[implementations(u32, u64, f64)]
sides: T,
#[unit(" px")]
#[default(50)]
radius_1: f64,
#[unit(" px")]
#[default(25)]
radius_2: f64,
) -> Table... | Don't use `#[name(...)]` here, it should be used only to fix capitalization issues which isn't needed in this case.
Let's call this `individual_squares` which is the inverse of the current `merge`. It should be `false` by default, meaning the `#[default(true)]` line should be removed, since we normally want the square... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let inner_diameter = radius_2 * 2.;
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_diameter)))
}
/// Generates a QR code from the input text.
#[node_macro::node(category("Vector: Shape"))]
fn qr_code(
_: impl Ctx,
_primary: (),
#[d... | Please move this algorithm into a helper function outside the node. | let inner_diameter = radius_2 * 2.;
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_diameter)))
}
/// Generates a QR code from the input text.
#[node_macro::node(category("Vector: Shape"), name("QR Code"))]
fn qr_code(
_: impl Ctx,
_... | @@ -186,6 +186,117 @@ fn star<T: AsU64>(
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_diameter)))
}
+/// Generates a QR code from the input text.
+#[node_macro::node(category("Vector: Shape"))]
+fn qr_code(
+ _: impl Ctx,
+ _primar... | node-graph/nodes/vector/src/generator_nodes.rs | 26 | Rust | 0.286 | refactor | 67 | 51 | 51 | false | Introduce QR Code node | 3,565 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Sahil-Gupta584 | Review this pull request change.
Language: Rust
File: node-graph/nodes/vector/src/generator_nodes.rs
PR Title: Introduce QR Code node
BEFORE CODE: let inner_diameter = radius_2 * 2.;
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_d... | Please move this algorithm into a helper function outside the node. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#[unit(" px")]
#[default(50)]
radius_1: f64,
#[unit(" px")]
#[default(25)]
radius_2: f64,
) -> Table<Vector> {
let points = sides.as_u64();
let diameter: f64 = radius_1 * 2.;
let inner_diameter = radius_2 * 2.;
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diam... | This should be
`let ecc = match error_correction.min(3)`
@TrueDoctor @timon-schelling @Keavon , let me know if I am wrong here , but since the intent here seems to be clamp the input to a valid range of 0 - 3 ,
by using max here , wouldn't it give wrong outputs
User Input: 0 (wants Low)
→ 0.max(3) = 3
... | #[unit(" px")]
#[default(50)]
radius_1: f64,
#[unit(" px")]
#[default(25)]
radius_2: f64,
) -> Table<Vector> {
let points = sides.as_u64();
let diameter: f64 = radius_1 * 2.;
let inner_diameter = radius_2 * 2.;
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diam... | @@ -186,6 +186,51 @@ fn star<T: AsU64>(
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_diameter)))
}
+/// Generates a QR code from the input text.
+#[node_macro::node(category("Vector: Shape"), name("QR Code"))]
+fn qr_code(
+ _: imp... | node-graph/nodes/vector/src/generator_nodes.rs | 26 | Rust | 0.786 | bug | 547 | 51 | 51 | false | Introduce QR Code node | 3,565 | GraphiteEditor/Graphite | 17,935 | Rust | Ayush2k02 | Sahil-Gupta584 | Review this pull request change.
Language: Rust
File: node-graph/nodes/vector/src/generator_nodes.rs
PR Title: Introduce QR Code node
BEFORE CODE: #[unit(" px")]
#[default(50)]
radius_1: f64,
#[unit(" px")]
#[default(25)]
radius_2: f64,
) -> Table<Vector> {
let points = sides.as_u64();
let diameter: f64 = r... | This should be
`let ecc = match error_correction.min(3)`
@TrueDoctor @timon-schelling @Keavon , let me know if I am wrong here , but since the intent here seems to be clamp the input to a valid range of 0 - 3 ,
by using max here , wouldn't it give wrong outputs
User Input: 0 (wants Low)
→ 0.max(3) = 3
... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
document_id,
};
self.futures.push_back((execution_id, execution_context));
Ok(())
}
fn export(&self, node_graph_output: TaggedValue, export_config: ExportConfig, responses: &mut VecDeque<Message>) -> Result<(), String> {
let ExportConfig {
file_type,
name,
size,
scale_factor,
#[cfg(feature... | can have a switch statement here as well , something like
```
let base_name = match (artboard_name, artboard_count) {
(Some(artboard_name), count) if count > 1 => format!("{name} - {artboard_name}"),
_ => name,
``` | document_id,
};
self.futures.push_back((execution_id, execution_context));
Ok(())
}
fn export(&self, node_graph_output: TaggedValue, export_config: ExportConfig, responses: &mut VecDeque<Message>) -> Result<(), String> {
let ExportConfig {
file_type,
name,
size,
scale_factor,
#[cfg(feature... | @@ -250,7 +252,12 @@ impl NodeGraphExecutor {
FileType::Png => "png",
FileType::Jpg => "jpg",
};
- let name = format!("{name}.{file_extension}");
+ let base_name = if let Some(artboard_name) = artboard_name { | editor/src/node_graph_executor.rs | 26 | Rust | 0.786 | style | 228 | 51 | 51 | false | Add artboard name to the export when exporting a single artboard | 3,613 | GraphiteEditor/Graphite | 17,935 | Rust | Ayush2k02 | Ayush2k02 | Review this pull request change.
Language: Rust
File: editor/src/node_graph_executor.rs
PR Title: Add artboard name to the export when exporting a single artboard
BEFORE CODE: document_id,
};
self.futures.push_back((execution_id, execution_context));
Ok(())
}
fn export(&self, node_graph_output: TaggedV... | can have a switch statement here as well , something like
```
let base_name = match (artboard_name, artboard_count) {
(Some(artboard_name), count) if count > 1 => format!("{name} - {artboard_name}"),
_ => name,
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
pub(crate) fn set_viewport_offset(&mut self, offset: [f32; 2]) {
self.viewport_offset = offset;
}
pub(crate) fn set_overlays_scene(&mut self, scene: vello::Scene) {
self.overlays_scene = Some(scene);
}
fn render_overlays(&mut self, scene: vello::Scene) {
let Some(viewport_texture) = self.viewport_textu... | I think it is possible to remove `self.overlays_texture` entirely.
You should be able to just use `overlay_target_texture.view()` in update bind groups directly. | self.overlays_scene = Some(scene);
}
fn render_overlays(&mut self, scene: vello::Scene) {
let Some(viewport_texture) = self.viewport_texture.as_ref() else {
tracing::warn!("No viewport texture bound, cannot render overlays");
return;
};
let size = glam::UVec2::new(viewport_texture.width(), viewport_tex... | @@ -236,12 +239,18 @@ impl RenderState {
return;
};
let size = glam::UVec2::new(viewport_texture.width(), viewport_texture.height());
- let texture = futures::executor::block_on(self.executor.render_vello_scene_to_texture(&scene, size, &Default::default(), Color::TRANSPARENT));
- let Ok(texture) = texture e... | desktop/src/render/state.rs | 26 | Rust | 0.571 | suggestion | 161 | 51 | 51 | false | Fix GPU out-of-memory crash by reusing overlay textures | 3,614 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | afrdbaig7 | Review this pull request change.
Language: Rust
File: desktop/src/render/state.rs
PR Title: Fix GPU out-of-memory crash by reusing overlay textures
BEFORE CODE: }
pub(crate) fn set_viewport_offset(&mut self, offset: [f32; 2]) {
self.viewport_offset = offset;
}
pub(crate) fn set_overlays_scene(&mut self, sce... | I think it is possible to remove `self.overlays_texture` entirely.
You should be able to just use `overlay_target_texture.view()` in update bind groups directly. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#[cfg(target_family = "wasm")]
pub type Window = web_sys::HtmlCanvasElement;
#[cfg(not(target_family = "wasm"))]
pub type Window = Arc<dyn winit::window::Window>;
unsafe impl StaticType for Surface {
type Static = Surface;
}
const VELLO_SURFACE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8Unorm;
impl Wg... | keep using if let syntax, then you also don't need the unwrap. | /// Returns a reference to the underlying texture.
pub fn texture(&self) -> &wgpu::Texture {
&self.texture
}
}
#[cfg(target_family = "wasm")]
pub type Window = web_sys::HtmlCanvasElement;
#[cfg(not(target_family = "wasm"))]
pub type Window = Arc<dyn winit::window::Window>;
unsafe impl StaticType for Surface {
t... | @@ -71,19 +112,14 @@ impl WgpuExecutor {
self.render_vello_scene_to_target_texture(scene, size, context, background, &mut output).await?;
Ok(output.unwrap().texture)
}
-
- async fn render_vello_scene_to_target_texture(&self, scene: &Scene, size: UVec2, context: &RenderContext, background: Color, output: &mut Op... | node-graph/libraries/wgpu-executor/src/lib.rs | 26 | Rust | 0.214 | suggestion | 62 | 51 | 51 | false | Fix GPU out-of-memory crash by reusing overlay textures | 3,614 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | afrdbaig7 | Review this pull request change.
Language: Rust
File: node-graph/libraries/wgpu-executor/src/lib.rs
PR Title: Fix GPU out-of-memory crash by reusing overlay textures
BEFORE CODE:
#[cfg(target_family = "wasm")]
pub type Window = web_sys::HtmlCanvasElement;
#[cfg(not(target_family = "wasm"))]
pub type Window = Arc<d... | keep using if let syntax, then you also don't need the unwrap. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
function rebuildLayerHierarchy(updateDocumentLayerStructure: DocumentLayerStructure) {
const layerWithNameBeingEdited = layers.find((layer: LayerListingInfo) => layer.editingName);
const layerIdWithNameBeingEdited = layerWithNameBeingEdited?.entry.id;
// Clear the layer hierarchy before rebuilding it
layers =... | consolidated these handlers into one , have verified and all are working | {#if listing.entry.clipped}
<IconLabel
icon="Clipped"
class="clipped-arrow"
tooltipLabel="Layer Clipped"
tooltipDescription="Clipping mask is active. To release it, target the bottom border of the layer and perform the shortcut shown."
tooltipShortcut={$tooltip.altClickShor... | @@ -655,8 +709,22 @@
placeholder={listing.entry.reference.data}
disabled={!listing.editingName}
on:blur={() => onEditLayerNameDeselect(listing)}
- on:keydown={(e) => e.key === "Escape" && onEditLayerNameDeselect(listing)}
- on:keydown={(e) => e.key === "Enter" && onEditLayerNameChang... | frontend/src/components/panels/Layers.svelte | 26 | Svelte | 0.357 | suggestion | 72 | 51 | 51 | false | Add F2 shortcut for renaming the selected layer | 3,641 | GraphiteEditor/Graphite | 17,935 | Rust | Ayush2k02 | Ayush2k02 | Review this pull request change.
Language: Svelte
File: frontend/src/components/panels/Layers.svelte
PR Title: Add F2 shortcut for renaming the selected layer
BEFORE CODE: function rebuildLayerHierarchy(updateDocumentLayerStructure: DocumentLayerStructure) {
const layerWithNameBeingEdited = layers.find((layer: L... | consolidated these handlers into one , have verified and all are working | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
function draggingKeyDown(e: KeyboardEvent) {
if (e.key === "Escape" && internalDragState?.active) {
justFinishedDrag = true;
abortDrag();
}
}
function handleLayerPanelKeyDown(e: KeyboardEvent) {
// Only handle F2 if not currently editing a layer name
if (e.key === "F2" && !isAnyLayerBeingEdited())... | I don't think there's any reason to have four instead of two directions, when each pair are just synonyms of each other. Just name them "Up" and "Down", with the first letter capitalized because these are the JS equivalent of Rust's enum variants which are also PascalCase. | if (list) draggingData = calculateDragIndex(list, e.clientY);
}
function fileDrop(e: DragEvent) {
if (!draggingData || !e.dataTransfer || !e.dataTransfer.types.includes("Files")) return;
const { insertParentId, insertIndex } = draggingData;
e.preventDefault();
Array.from(e.dataTransfer.items).forEach(as... | @@ -491,6 +492,58 @@
}
}
+ function handleLayerPanelKeyDown(e: KeyboardEvent) {
+ // Only handle F2 if not currently editing a layer name
+ if (e.key === "F2" && !isAnyLayerBeingEdited()) {
+ // Find the first selected layer
+ const selectedLayer = layers.find((layer) => layer.entry.selected);
+ if (sele... | frontend/src/components/panels/Layers.svelte | 26 | Svelte | 0.5 | suggestion | 273 | 51 | 51 | false | Add F2 shortcut for renaming the selected layer | 3,641 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Ayush2k02 | Review this pull request change.
Language: Svelte
File: frontend/src/components/panels/Layers.svelte
PR Title: Add F2 shortcut for renaming the selected layer
BEFORE CODE: }
function draggingKeyDown(e: KeyboardEvent) {
if (e.key === "Escape" && internalDragState?.active) {
justFinishedDrag = true;
abortD... | I don't think there's any reason to have four instead of two directions, when each pair are just synonyms of each other. Just name them "Up" and "Down", with the first letter capitalized because these are the JS equivalent of Rust's enum variants which are also PascalCase. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
abortDrag();
}
}
function draggingKeyDown(e: KeyboardEvent) {
if (e.key === "Escape" && internalDragState?.active) {
justFinishedDrag = true;
abortDrag();
}
}
function handleLayerPanelKeyDown(e: KeyboardEvent) {
// Only handle F2 if not currently editing a layer name
if (e.key === "F2" && !isAn... | A one-liner function that's only used once is rather unnecessary compared to just calling that logic inline and describing what's going on in the comment above it. | dragInPanel = true;
if (list) draggingData = calculateDragIndex(list, e.clientY);
}
function fileDrop(e: DragEvent) {
if (!draggingData || !e.dataTransfer || !e.dataTransfer.types.includes("Files")) return;
const { insertParentId, insertIndex } = draggingData;
e.preventDefault();
Array.from(e.dataTra... | @@ -491,6 +492,58 @@
}
}
+ function handleLayerPanelKeyDown(e: KeyboardEvent) {
+ // Only handle F2 if not currently editing a layer name
+ if (e.key === "F2" && !isAnyLayerBeingEdited()) {
+ // Find the first selected layer
+ const selectedLayer = layers.find((layer) => layer.entry.selected);
+ if (sele... | frontend/src/components/panels/Layers.svelte | 26 | Svelte | 0.429 | suggestion | 163 | 51 | 51 | false | Add F2 shortcut for renaming the selected layer | 3,641 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Ayush2k02 | Review this pull request change.
Language: Svelte
File: frontend/src/components/panels/Layers.svelte
PR Title: Add F2 shortcut for renaming the selected layer
BEFORE CODE: abortDrag();
}
}
function draggingKeyDown(e: KeyboardEvent) {
if (e.key === "Escape" && internalDragState?.active) {
justFinishedDr... | A one-liner function that's only used once is rather unnecessary compared to just calling that logic inline and describing what's going on in the comment above it. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return layers.some((layer) => layer.editingName);
}
async function navigateToLayer(currentListing: LayerListingInfo, direction: "next" | "previous" | "up" | "down") {
// Save the current layer name
const inputElement = document.activeElement;
if (inputElement instanceof HTMLInputElement) {
const name = in... | Move `targetIndex` declaration to a ternary statement and perform both returns, checking both conditions with a logical OR, on the following line. Full if/else blocks are too verbose here when this could all be made into two lines. | layers = [];
// Build the new layer hierarchy
const recurse = (children: LayerStructureEntry[]) => {
children.forEach((item, index) => {
const mapping = layerCache.get(String(item.layerId));
if (mapping) {
mapping.id = item.layerId;
layers.push({
folderIndex: index,
bottomLayer: ... | @@ -491,6 +492,58 @@
}
}
+ function handleLayerPanelKeyDown(e: KeyboardEvent) {
+ // Only handle F2 if not currently editing a layer name
+ if (e.key === "F2" && !isAnyLayerBeingEdited()) {
+ // Find the first selected layer
+ const selectedLayer = layers.find((layer) => layer.entry.selected);
+ if (sele... | frontend/src/components/panels/Layers.svelte | 26 | Svelte | 0.643 | suggestion | 231 | 51 | 51 | false | Add F2 shortcut for renaming the selected layer | 3,641 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Ayush2k02 | Review this pull request change.
Language: Svelte
File: frontend/src/components/panels/Layers.svelte
PR Title: Add F2 shortcut for renaming the selected layer
BEFORE CODE: return layers.some((layer) => layer.editingName);
}
async function navigateToLayer(currentListing: LayerListingInfo, direction: "next" | "p... | Move `targetIndex` declaration to a ternary statement and perform both returns, checking both conditions with a logical OR, on the following line. Full if/else blocks are too verbose here when this could all be made into two lines. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
messages: defered_responses.drain(..).collect(),
});
responses.add(NodeGraphMessage::RunDocumentGraph);
ShapeToolFsmState::Drawing(tool_data.current_shape)
}
(ShapeToolFsmState::Drawing(shape), ShapeToolMessage::PointerMove { modifier }) => {
let Some(layer) = tool_data.data.layer else {
... | This isn't how we pass the tool options to the other shapes. Too many arguments to this function, which the others don't suffer from. | tool_options.stroke.apply_stroke(tool_options.line_weight, layer, defered_responses);
tool_options.stroke.apply_stroke(tool_options.line_weight, layer, defered_responses);
tool_data.data.layer = Some(layer);
responses.add(DeferMessage::AfterGraphRun {
messages: defered_responses.drain(..).collect... | @@ -906,7 +978,18 @@ impl Fsm for ShapeToolFsmState {
ShapeType::Star => Star::update_shape(document, input, viewport, layer, tool_data, modifier, responses),
ShapeType::Circle => Circle::update_shape(document, input, viewport, layer, tool_data, modifier, responses),
ShapeType::Arc => Arc::update_shap... | editor/src/messages/tool/tool_messages/shape_tool.rs | 26 | Rust | 0.357 | suggestion | 133 | 51 | 51 | false | Improve the Shape tool's arrow drawing controls | 3,650 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | krVatsal | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/shape_tool.rs
PR Title: Improve the Shape tool's arrow drawing controls
BEFORE CODE: messages: defered_responses.drain(..).collect(),
});
responses.add(NodeGraphMessage::RunDocumentGraph);
ShapeToolFsmStat... | This isn't how we pass the tool options to the other shapes. Too many arguments to this function, which the others don't suffer from. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
vertices: u32,
shape_type: ShapeType,
arc_type: ArcType,
grid_type: GridType,
spiral_type: SpiralType,
turns: f64,
arrow_shaft_width: f64,
arrow_head_width: f64,
arrow_head_length: f64,
}
impl Default for ShapeToolOptions {
fn default() -> Self {
Self {
line_weight: DEFAULT_STROKE_WIDTH,
fill: ToolCo... | ```suggestion
arrow_shaft_width: 14.,
arrow_head_width: 32.,
arrow_head_length: 28.,
``` | vertices: u32,
shape_type: ShapeType,
arc_type: ArcType,
grid_type: GridType,
spiral_type: SpiralType,
turns: f64,
arrow_shaft_width: f64,
arrow_head_width: f64,
arrow_head_length: f64,
}
impl Default for ShapeToolOptions {
fn default() -> Self {
Self {
line_weight: DEFAULT_STROKE_WIDTH,
fill: ToolCo... | @@ -58,6 +61,9 @@ impl Default for ShapeToolOptions {
spiral_type: SpiralType::Archimedean,
turns: 5.,
grid_type: GridType::Rectangular,
+ arrow_shaft_width: 14.0,
+ arrow_head_width: 32.0,
+ arrow_head_length: 28.0, | editor/src/messages/tool/tool_messages/shape_tool.rs | 26 | Rust | 0.571 | suggestion | 97 | 51 | 51 | false | Improve the Shape tool's arrow drawing controls | 3,650 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | krVatsal | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/shape_tool.rs
PR Title: Improve the Shape tool's arrow drawing controls
BEFORE CODE: vertices: u32,
shape_type: ShapeType,
arc_type: ArcType,
grid_type: GridType,
spiral_type: SpiralType,
turns: f64,
arrow_shaft_widt... | ```suggestion
arrow_shaft_width: 14.,
arrow_head_width: 32.,
arrow_head_length: 28.,
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
/// Constructs a line from `p1` to `p2`
pub fn new_line(p1: DVec2, p2: DVec2) -> Self {
Self::from_anchors([p1, p2], false)
}
/// Constructs an arrow shape from start and end points with parametric control over dimensions
pub fn new_arrow(start: DVec2, end: DVec2, shaft_width: f64, head_width: f64, head_len... | ```suggestion
// Arrow path starts at the tail, traces around the shape, and returns to the tail
``` | }
/// Constructs a line from `p1` to `p2`
pub fn new_line(p1: DVec2, p2: DVec2) -> Self {
Self::from_anchors([p1, p2], false)
}
/// Constructs an arrow shape from start and end points with parametric control over dimensions
pub fn new_arrow(start: DVec2, end: DVec2, shaft_width: f64, head_width: f64, head_len... | @@ -330,14 +330,16 @@ impl<PointId: Identifier> Subpath<PointId> {
let head_base_distance = (length - head_length).max(0.);
let head_base = start + direction * head_base_distance;
+ // Arrow path starts at the tail (origin), traces around the shape, and returns to tail | node-graph/libraries/vector-types/src/subpath/core.rs | 26 | Rust | 0.714 | suggestion | 102 | 51 | 51 | false | Improve the Shape tool's arrow drawing controls | 3,650 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | krVatsal | Review this pull request change.
Language: Rust
File: node-graph/libraries/vector-types/src/subpath/core.rs
PR Title: Improve the Shape tool's arrow drawing controls
BEFORE CODE: }
/// Constructs a line from `p1` to `p2`
pub fn new_line(p1: DVec2, p2: DVec2) -> Self {
Self::from_anchors([p1, p2], false)
}
... | ```suggestion
// Arrow path starts at the tail, traces around the shape, and returns to the tail
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
window_maximized: bool,
window_fullscreen: bool,
pointer_position: PhysicalPosition<f64>,
pointer_lock_position: Option<PhysicalPosition<f64>>,
ui_scale: f64,
app_event_receiver: Receiver<AppEvent>,
app_event_scheduler: AppEventScheduler,
desktop_wrapper: DesktopWrapper,
cef_context: Box<dyn cef::CefContext>,
... | What was the reason for the rename of this function? If it is to indicate that it has side effects, I'm not sure if that is aided by the new name and wouldn't be better expressed as a doc comment. | window_maximized: bool,
window_fullscreen: bool,
pointer_position: PhysicalPosition<f64>,
pointer_lock_position: Option<PhysicalPosition<f64>>,
ui_scale: f64,
app_event_receiver: Receiver<AppEvent>,
app_event_scheduler: AppEventScheduler,
desktop_wrapper: DesktopWrapper,
cef_context: Box<dyn cef::CefContext>,
... | @@ -50,7 +51,7 @@ impl App {
Window::init();
}
- pub(crate) fn new(
+ pub(crate) fn create( | desktop/src/app.rs | 26 | Rust | 0.429 | question | 197 | 51 | 51 | false | Replace globals with editor environment | 3,656 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: desktop/src/app.rs
PR Title: Replace globals with editor environment
BEFORE CODE: window_maximized: bool,
window_fullscreen: bool,
pointer_position: PhysicalPosition<f64>,
pointer_lock_position: Option<PhysicalPosition<f64>>,
ui_scale: f64,
app_event_recei... | What was the reason for the rename of this function? If it is to indicate that it has side effects, I'm not sure if that is aided by the new name and wouldn't be better expressed as a doc comment. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
record.position = position;
match state {
ElementState::Pressed if record.down_count == ClickCount::Triple => {
*record = ClickRecord {
down_count: ClickCount::Single,
..*record
};
return ClickCount::Single;
}
ElementState::Released if record.up_count == ClickCount::Triple => {
*... | Nit, this could look cleaner as a match. Logic seems fine. | record.position = position;
match state {
ElementState::Pressed if record.down_count == ClickCount::Triple => {
*record = ClickRecord {
down_count: ClickCount::Double,
..*record
};
return ClickCount::Double;
}
ElementState::Released if record.up_count == ClickCount::Triple => {
*... | @@ -167,7 +168,13 @@ impl ClickTracker {
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
let within_time = now.saturating_duration_since(prev_time) <= MULTICLICK_TIMEOUT;
- let count = if within_time && within_dist { ClickCount::Double } else { ClickCount::Single };
+ let... | desktop/src/cef/input/state.rs | 26 | Rust | 0.286 | suggestion | 58 | 51 | 51 | false | Desktop: Support triple-click inputs | 3,671 | GraphiteEditor/Graphite | 17,935 | Rust | timon-schelling | he1senbrg | Review this pull request change.
Language: Rust
File: desktop/src/cef/input/state.rs
PR Title: Desktop: Support triple-click inputs
BEFORE CODE: record.position = position;
match state {
ElementState::Pressed if record.down_count == ClickCount::Triple => {
*record = ClickRecord {
down_count: ClickC... | Nit, this could look cleaner as a match. Logic seems fine. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
entry!(KeyDown(MouseMiddle); modifiers=[Control], action_dispatch=NavigationMessage::BeginCanvasZoom),
entry!(KeyDown(MouseLeft); modifiers=[Control, Space], action_dispatch=NavigationMessage::BeginCanvasZoom),
entry!(KeyDown(MouseMiddle); action_dispatch=NavigationMessage::BeginCanvasPan),
entry!(KeyDown(Mouse... | Key repeat is expected to work when changing tabs. | entry!(KeyDown(MouseLeft); modifiers=[Alt, Space], action_dispatch=NavigationMessage::BeginCanvasTilt { was_dispatched_from_menu: false }),
entry!(KeyDown(MouseMiddle); modifiers=[Control], action_dispatch=NavigationMessage::BeginCanvasZoom),
entry!(KeyDown(MouseLeft); modifiers=[Control, Space], action_dispatch=... | @@ -438,8 +438,8 @@ pub fn input_mappings(zoom_with_scroll: bool) -> Mapping {
entry!(KeyDown(Period); action_dispatch=NavigationMessage::FitViewportToSelection),
//
// PortfolioMessage
- entry!(KeyDown(Tab); modifiers=[Control], action_dispatch=PortfolioMessage::NextDocument),
- entry!(KeyDown(Tab); modifie... | editor/src/messages/input_mapper/input_mappings.rs | 26 | Rust | 0.214 | suggestion | 50 | 51 | 51 | false | Add focus document toggle | 3,672 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | timon-schelling | Review this pull request change.
Language: Rust
File: editor/src/messages/input_mapper/input_mappings.rs
PR Title: Add focus document toggle
BEFORE CODE: entry!(KeyDown(MouseMiddle); modifiers=[Control], action_dispatch=NavigationMessage::BeginCanvasZoom),
entry!(KeyDown(MouseLeft); modifiers=[Control, Space], ... | Key repeat is expected to work when changing tabs. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
pub network_interface: &'a mut NodeNetworkInterface,
pub selection_network_path: &'a [NodeId],
pub document_name: &'a str,
pub executor: &'a mut NodeGraphExecutor,
pub persistent_data: &'a PersistentData,
pub properties_panel_open: bool,
}
#[derive(Debug, Clone, Default, ExtractField)]
pub struct PropertiesPanel... | This shouldn't be NOT'd, right? | pub network_interface: &'a mut NodeNetworkInterface,
pub selection_network_path: &'a [NodeId],
pub document_name: &'a str,
pub executor: &'a mut NodeGraphExecutor,
pub persistent_data: &'a PersistentData,
pub properties_panel_open: bool,
}
#[derive(Debug, Clone, Default, ExtractField)]
pub struct PropertiesPanel... | @@ -34,10 +34,12 @@ impl MessageHandler<PropertiesPanelMessage, PropertiesPanelMessageContext<'_>> f
match message {
PropertiesPanelMessage::Clear => {
- responses.add(LayoutMessage::SendLayout {
- layout: Layout::default(),
- layout_target: LayoutTarget::PropertiesPanel,
- });
+ if !propertie... | editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs | 26 | Rust | 0.143 | question | 31 | 51 | 51 | false | Add focus document toggle | 3,672 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | timon-schelling | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs
PR Title: Add focus document toggle
BEFORE CODE: pub network_interface: &'a mut NodeNetworkInterface,
pub selection_network_path: &'a [NodeId],
pub document_name: &'a ... | This shouldn't be NOT'd, right? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let size = size.max(UVec2::ONE);
let target_texture = if let Some(target_texture) = output
&& target_texture.size == size
{
target_texture
} else {
let texture = self.context.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {
width: size.x,
height: si... | Does this change anything regarding the functionality or is this an unrelated api restructure | let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
Self { texture, view, size }
}
/// Ensures the texture has the specified size, creating a new one if needed.
/// This allows reusing the same texture across frames when the size hasn't changed.
pub fn ensure_size(&mut self, device: &wgpu... | @@ -98,7 +98,7 @@ impl WgpuExecutor {
output.as_mut().unwrap()
};
- let [r, g, b, a] = background.to_rgba8_srgb(); | node-graph/libraries/wgpu-executor/src/lib.rs | 26 | Rust | 0.286 | suggestion | 93 | 51 | 51 | false | Desktop: Fix bitmap file export not preserving alpha | 3,673 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: node-graph/libraries/wgpu-executor/src/lib.rs
PR Title: Desktop: Fix bitmap file export not preserving alpha
BEFORE CODE: let size = size.max(UVec2::ONE);
let target_texture = if let Some(target_texture) = output
&& target_texture.size == size
{
targ... | Does this change anything regarding the functionality or is this an unrelated api restructure | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Self::Fn(_, _) => None,
Self::Future(_) => None,
}
}
pub fn nested_type(&self) -> &Type {
match self {
Self::Generic(_) => self,
Self::Concrete(_) => self,
Self::Fn(_, output) => output.nested_type(),
Self::Future(output) => output.nested_type(),
}
}
pub fn replace_nested(&mut self, f: imp... | What is the reason for the changed return type here? | Self::Future(_) => None,
}
}
pub fn nested_type(&self) -> &Type {
match self {
Self::Generic(_) => self,
Self::Concrete(_) => self,
Self::Fn(_, output) => output.nested_type(),
Self::Future(output) => output.nested_type(),
}
}
pub fn replace_nested(&mut self, f: impl Fn(&Type) -> Option<Type>... | @@ -337,15 +336,17 @@ impl Type {
}
}
- pub fn to_cow_string(&self) -> Cow<'static, str> {
+ pub fn identifier_name(&self) -> String { | node-graph/libraries/core-types/src/types.rs | 26 | Rust | 0.429 | question | 52 | 51 | 51 | false | Fix regression breaking Into/Convert node type coercion | 3,681 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | Keavon | Review this pull request change.
Language: Rust
File: node-graph/libraries/core-types/src/types.rs
PR Title: Fix regression breaking Into/Convert node type coercion
BEFORE CODE: Self::Fn(_, _) => None,
Self::Future(_) => None,
}
}
pub fn nested_type(&self) -> &Type {
match self {
Self::Generic(_) =>... | What is the reason for the changed return type here? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
};
let cap = match stroke.cap {
StrokeCap::Butt => kurbo::Cap::Butt,
StrokeCap::Round => kurbo::Cap::Round,
StrokeCap::Square => kurbo::Cap::Square,
};
let dash_offset = stroke.dash_offset;
let dash_pattern = stroke.dash_lengths;
let miter_limit = stroke.join_miter_limit;
let stroke_st... | The inverse transform is applied without checking if the transform is invertible. If stroke.transform has a zero determinant (e.g., zero scale on one axis), the inverse will produce invalid results. Following the pattern used elsewhere in this file (lines 1699 and 2131), you should check if the transform is invertible ... | };
let cap = match stroke.cap {
StrokeCap::Butt => kurbo::Cap::Butt,
StrokeCap::Round => kurbo::Cap::Round,
StrokeCap::Square => kurbo::Cap::Square,
};
let dash_offset = stroke.dash_offset;
let dash_pattern = stroke.dash_lengths;
let miter_limit = stroke.join_miter_limit;
let stroke_st... | @@ -1154,8 +1154,12 @@ async fn solidify_stroke(_: impl Ctx, content: Table<Vector>) -> Table<Vector> {
// 0.25 is balanced between performace and accuracy of the curve.
const STROKE_TOLERANCE: f64 = 0.25;
- for path in bezpaths {
- let solidified = kurbo::stroke(path, &stroke_style, &stroke_options, STR... | node-graph/nodes/vector/src/vector_nodes.rs | 26 | Rust | 0.857 | suggestion | 593 | 51 | 51 | false | Fix solidify stroke node ignoring transforms applied before stroke node | 3,683 | GraphiteEditor/Graphite | 17,935 | Rust | Copilot | motherboardMage | Review this pull request change.
Language: Rust
File: node-graph/nodes/vector/src/vector_nodes.rs
PR Title: Fix solidify stroke node ignoring transforms applied before stroke node
BEFORE CODE: };
let cap = match stroke.cap {
StrokeCap::Butt => kurbo::Cap::Butt,
StrokeCap::Round => kurbo::Cap::Round,
... | The inverse transform is applied without checking if the transform is invertible. If stroke.transform has a zero determinant (e.g., zero scale on one axis), the inverse will produce invalid results. Following the pattern used elsewhere in this file (lines 1699 and 2131), you should check if the transform is invertible ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
}
/// Evaluates a node graph, computing the entire graph
#[allow(clippy::too_many_arguments)]
pub fn submit_node_graph_evaluation(
&mut self,
document: &mut DocumentMessageHandler,
document_id: DocumentId,
viewport_resolution: UVec2,
vi... | Couldn't we set the resolution to 1x1 here? |
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
}
/// Evaluates a node graph, computing the entire graph
#[allow(clippy::too_many_arguments)]
pub fn submit_node_graph_evaluation(
&mut self,
document: &mut DocumentMessageHandler,
document_id: DocumentId,
viewport_resolution: UVec2,
vi... | @@ -184,6 +193,41 @@ impl NodeGraphExecutor {
self.submit_current_node_graph_evaluation(document, document_id, viewport_resolution, viewport_scale, time, pointer)
}
+ #[cfg(not(target_family = "wasm"))]
+ pub(crate) fn submit_eyedropper_preview(&mut self, document_id: DocumentId, resolution: UVec2, time: TimingI... | editor/src/node_graph_executor.rs | 26 | Rust | 0.143 | question | 43 | 51 | 51 | false | Desktop: Add Eyedropper tool support with native Vello | 3,684 | GraphiteEditor/Graphite | 17,935 | Rust | TrueDoctor | timon-schelling | Review this pull request change.
Language: Rust
File: editor/src/node_graph_executor.rs
PR Title: Desktop: Add Eyedropper tool support with native Vello
BEFORE CODE:
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
}
/// Evaluates a node graph, computing the entire graph
#[allow(clippy::too_... | Couldn't we set the resolution to 1x1 here? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let color_fill = if selected { COLOR_OVERLAY_BLUE } else { COLOR_OVERLAY_WHITE };
self.scene.fill(peniko::Fill::NonZero, transform, Self::parse_color(color_fill), None, &circle);
self.scene.stroke(&kurbo::Stroke::new(1.), transform, Self::parse_color(COLOR_OVERLAY_BLUE), None, &inner_circle);
}
fn manipulator... | Is this `COLOR_OVERLAY_BLUE` case ever displayed? | let inner_circle = kurbo::Circle::new((position.x, position.y), MANIPULATOR_GROUP_MARKER_SIZE / 2.);
let color_fill = if selected { COLOR_OVERLAY_BLUE } else { COLOR_OVERLAY_WHITE };
self.scene.fill(peniko::Fill::NonZero, transform, Self::parse_color(color_fill), None, &circle);
self.scene.stroke(&kurbo::Strok... | @@ -582,6 +586,23 @@ impl OverlayContextInternal {
self.square(position, None, Some(color_fill), Some(COLOR_OVERLAY_BLUE));
}
+ fn gradient_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
+ let transform = self.get_transform();
+ let position = position.round() - DVec2::splat(0.5);
+
... | editor/src/messages/portfolio/document/overlays/utility_types_native.rs | 26 | Rust | 0.214 | question | 49 | 51 | 51 | false | Improve the Gradient tool by visualizing color stops | 3,698 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/overlays/utility_types_native.rs
PR Title: Improve the Gradient tool by visualizing color stops
BEFORE CODE:
let color_fill = if selected { COLOR_OVERLAY_BLUE } else { COLOR_OVERLAY_WHITE };
self.scene.fill(peniko::Fil... | Is this `COLOR_OVERLAY_BLUE` case ever displayed? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
self.render_context
.arc(position.x, position.y, MANIPULATOR_GROUP_MARKER_SIZE / 2., 0., TAU)
.expect("Failed to draw the circle");
let fill = if selected { COLOR_OVERLAY_BLUE } else { COLOR_OVERLAY_WHITE };
self.render_context.set_fill_style_str(fill);
self.render_context.set_stroke_style_str(color.unwr... | This `+ 1. +` part is not included in the `_native.rs` version of this file. | self.render_context
.arc(position.x, position.y, MANIPULATOR_GROUP_MARKER_SIZE / 2., 0., TAU)
.expect("Failed to draw the circle");
let fill = if selected { COLOR_OVERLAY_BLUE } else { COLOR_OVERLAY_WHITE };
self.render_context.set_fill_style_str(fill);
self.render_context.set_stroke_style_str(color.unwr... | @@ -468,6 +468,37 @@ impl OverlayContext {
self.square(position, None, Some(color_fill), Some(color_stroke));
}
+ pub fn gradient_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
+ self.start_dpi_aware_transform();
+
+ let position = position.round() - DVec2::splat(0.5);
+
+ let (radi... | editor/src/messages/portfolio/document/overlays/utility_types_web.rs | 26 | Rust | 0.357 | suggestion | 76 | 51 | 51 | false | Improve the Gradient tool by visualizing color stops | 3,698 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/overlays/utility_types_web.rs
PR Title: Improve the Gradient tool by visualizing color stops
BEFORE CODE: self.render_context
.arc(position.x, position.y, MANIPULATOR_GROUP_MARKER_SIZE / 2., 0., TAU)
.expect("Failed... | This `+ 1. +` part is not included in the `_native.rs` version of this file. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let color_fill = if selected { color_stroke } else { COLOR_OVERLAY_WHITE };
self.square(position, None, Some(color_fill), Some(color_stroke));
}
pub fn gradient_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
self.start_dpi_aware_transform();
let position = position.round() - DVec2... | Please integrate this into the closure above, so it uses conditionals to support both the fill and stroke cases, to avoid the code duplication and confusion resulting from it being duplicated. | let color_fill = if selected { color_stroke } else { COLOR_OVERLAY_WHITE };
self.square(position, None, Some(color_fill), Some(color_stroke));
}
pub fn gradient_color_stop(&mut self, position: DVec2, selected: bool, color: &str) {
self.start_dpi_aware_transform();
let position = position.round() - DVec2::sp... | @@ -468,6 +468,37 @@ impl OverlayContext {
self.square(position, None, Some(color_fill), Some(color_stroke));
}
+ pub fn gradient_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
+ self.start_dpi_aware_transform();
+
+ let position = position.round() - DVec2::splat(0.5);
+
+ let (radi... | editor/src/messages/portfolio/document/overlays/utility_types_web.rs | 26 | Rust | 0.429 | refactor | 192 | 51 | 51 | false | Improve the Gradient tool by visualizing color stops | 3,698 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/overlays/utility_types_web.rs
PR Title: Improve the Gradient tool by visualizing color stops
BEFORE CODE: let color_fill = if selected { color_stroke } else { COLOR_OVERLAY_WHITE };
self.square(position, None, Some(colo... | Please integrate this into the closure above, so it uses conditionals to support both the fill and stroke cases, to avoid the code duplication and confusion resulting from it being duplicated. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
self.start_dpi_aware_transform();
let position = position.round() - DVec2::splat(0.5);
self.render_context.begin_path();
self.render_context
.arc(position.x, position.y, MANIPULATOR_GROUP_MARKER_SIZE / 2., 0., TAU... | Is there ever a reason for `color` to be `None`? If not, it shouldn't take an `Option`, and the unwrapping (hopefully in a non-crashing manner, or `.expect()` at least being preferable to `.unwrap()`) happening in the caller. | pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
self.start_dpi_aware_transform();
let position = position.round() - DVec2::splat(0.5);
self.render_context.begin_path();
self.render_context
.arc(position.x, position.y, MANIPULATOR_GROUP_MARKER_SIZE / 2., 0., TAU... | @@ -468,6 +468,37 @@ impl OverlayContext {
self.square(position, None, Some(color_fill), Some(color_stroke));
}
+ pub fn gradient_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) { | editor/src/messages/portfolio/document/overlays/utility_types_web.rs | 26 | Rust | 0.643 | bug | 225 | 51 | 51 | false | Improve the Gradient tool by visualizing color stops | 3,698 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/overlays/utility_types_web.rs
PR Title: Improve the Gradient tool by visualizing color stops
BEFORE CODE: pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
self.start_dpi_aware_... | Is there ever a reason for `color` to be `None`? If not, it shouldn't take an `Option`, and the unwrapping (hopefully in a non-crashing manner, or `.expect()` at least being preferable to `.unwrap()`) happening in the caller. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
(_state, GradientToolMessage::Overlays { context: mut overlay_context }) => {
let selected = tool_data.selected_gradient.as_ref();
let mouse = input.mouse.position;
for layer in document.network_interface.selected_nodes().selected_visible_layers(&document.network_interface) {
let Some(gradient) = g... | You can just clone the color and mutate its alpha to 100%, then use the existing function instead of creating your own function. | #[derive(Clone, Debug, Default)]
struct GradientToolData {
selected_gradient: Option<SelectedGradient>,
snap_manager: SnapManager,
drag_start: DVec2,
auto_panning: AutoPanning,
}
impl Fsm for GradientToolFsmState {
type ToolData = GradientToolData;
type ToolOptions = GradientOptions;
fn transition(
self,
e... | @@ -274,25 +312,53 @@ impl Fsm for GradientToolFsmState {
.filter(|selected| selected.layer.is_some_and(|selected_layer| selected_layer == layer))
.map(|selected| selected.dragging);
+ let gradient = if let Some(selected_gradient) = selected.filter(|s| s.layer == Some(layer)) {
+ &selected_grad... | editor/src/messages/tool/tool_messages/gradient_tool.rs | 26 | Rust | 0.429 | suggestion | 128 | 51 | 51 | false | Improve the Gradient tool by visualizing color stops | 3,698 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/gradient_tool.rs
PR Title: Improve the Gradient tool by visualizing color stops
BEFORE CODE: (_state, GradientToolMessage::Overlays { context: mut overlay_context }) => {
let selected = tool_data.selected_gradient.as... | You can just clone the color and mutate its alpha to 100%, then use the existing function instead of creating your own function. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
}
pub fn format_transform_matrix(transform: DAffine2) -> String {
if transform == DAffine2::IDENTITY {
return String::new();
}
transform.to_cols_array().iter().enumerate().fold("matrix(".to_string(), |val, (i, num)| {
let num = if num.abs() < 1_000_000_000. { (num * 1_000_000_000.).round() / 1_000_000_000. ... | Replace `if let` with `let else`. | }
}
pub fn format_transform_matrix(transform: DAffine2) -> String {
if transform == DAffine2::IDENTITY {
return String::new();
}
transform.to_cols_array().iter().enumerate().fold("matrix(".to_string(), |val, (i, num)| {
let num = if num.abs() < 1_000_000_000. { (num * 1_000_000_000.).round() / 1_000_000_000. ... | @@ -235,6 +237,45 @@ fn max_scale(transform: DAffine2) -> f64 {
(sx + sy).sqrt()
}
+pub fn contrasting_outline_color(background: Option<Color>) -> Color {
+ use core_types::consts::LAYER_OUTLINE_STROKE_COLOR;
+
+ if let Some(bg) = background { | node-graph/libraries/rendering/src/renderer.rs | 26 | Rust | 0.286 | suggestion | 33 | 51 | 51 | false | Fix outline rendering mode to draw shapes as black or white based on contrast with their artboard's color | 3,724 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: node-graph/libraries/rendering/src/renderer.rs
PR Title: Fix outline rendering mode to draw shapes as black or white based on contrast with their artboard's color
BEFORE CODE: }
}
pub fn format_transform_matrix(transform: DAffine2) -> String {
if transform ==... | Replace `if let` with `let else`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
pub fn to_canvas(&self) -> bool {
!self.for_export && !self.thumbnail && !self.for_mask
}
}
pub fn format_transform_matrix(transform: DAffine2) -> String {
if transform == DAffine2::IDENTITY {
return String::new();
}
transform.to_cols_array().iter().enumerate().fold("matrix(".to_string(), |val, (i, num)| {
... | A better name would be something like `black_or_white_for_best_contrast`. |
pub fn to_canvas(&self) -> bool {
!self.for_export && !self.thumbnail && !self.for_mask
}
}
pub fn format_transform_matrix(transform: DAffine2) -> String {
if transform == DAffine2::IDENTITY {
return String::new();
}
transform.to_cols_array().iter().enumerate().fold("matrix(".to_string(), |val, (i, num)| {
... | @@ -235,6 +237,45 @@ fn max_scale(transform: DAffine2) -> f64 {
(sx + sy).sqrt()
}
+pub fn contrasting_outline_color(background: Option<Color>) -> Color { | node-graph/libraries/rendering/src/renderer.rs | 26 | Rust | 0.429 | suggestion | 73 | 51 | 51 | false | Fix outline rendering mode to draw shapes as black or white based on contrast with their artboard's color | 3,724 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: node-graph/libraries/rendering/src/renderer.rs
PR Title: Fix outline rendering mode to draw shapes as black or white based on contrast with their artboard's color
BEFORE CODE:
pub fn to_canvas(&self) -> bool {
!self.for_export && !self.thumbnail && !self.for... | A better name would be something like `black_or_white_for_best_contrast`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
transform.to_cols_array().iter().enumerate().fold("matrix(".to_string(), |val, (i, num)| {
let num = if num.abs() < 1_000_000_000. { (num * 1_000_000_000.).round() / 1_000_000_000. } else { *num };
let num = if num.is_zero() { "0".to_string() } else { num.to_string() };
let comma = if i == 5 { "" } else { "," }... | Search the code base for `0.04045` or `12.92` and see if you can find any reusable Rust functions that are already able to do this logic for you without having to duplicate it, as well as the logic above and below this. |
transform.to_cols_array().iter().enumerate().fold("matrix(".to_string(), |val, (i, num)| {
let num = if num.abs() < 1_000_000_000. { (num * 1_000_000_000.).round() / 1_000_000_000. } else { *num };
let num = if num.is_zero() { "0".to_string() } else { num.to_string() };
let comma = if i == 5 { "" } else { "," }... | @@ -235,6 +237,45 @@ fn max_scale(transform: DAffine2) -> f64 {
(sx + sy).sqrt()
}
+pub fn contrasting_outline_color(background: Option<Color>) -> Color {
+ use core_types::consts::LAYER_OUTLINE_STROKE_COLOR;
+
+ if let Some(bg) = background {
+ let alpha = bg.a();
+
+ // Convert Linear Float to sRGB Float
+ le... | node-graph/libraries/rendering/src/renderer.rs | 26 | Rust | 0.571 | refactor | 219 | 51 | 51 | false | Fix outline rendering mode to draw shapes as black or white based on contrast with their artboard's color | 3,724 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: node-graph/libraries/rendering/src/renderer.rs
PR Title: Fix outline rendering mode to draw shapes as black or white based on contrast with their artboard's color
BEFORE CODE:
transform.to_cols_array().iter().enumerate().fold("matrix(".to_string(), |val, (i, n... | Search the code base for `0.04045` or `12.92` and see if you can find any reusable Rust functions that are already able to do this logic for you without having to duplicate it, as well as the logic above and below this. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
}
// Check dragging start or end handle
for (pos, dragging_target) in [(gradient.start, GradientDragTarget::Start), (gradient.end, GradientDragTarget::End)] {
let pos = transform.transform_point2(pos);
if pos.distance_squared(mouse) < tolerance {
dragging = true;
tool_d... | `gradient.clone()` is called twice and `insert_stop` is called twice. This can be simplified:
```
let mut new_gradient = gradient.clone();
if let Some(index) = new_gradient.insert_stop(mouse, transform) {
responses.add(DocumentMessage::StartTransaction);
transaction_started = true;
let mut selected_gradi... | let transform = selected_gradient.transform;
let (start, end) = (transform.transform_point2(selected_gradient.gradient.start), transform.transform_point2(selected_gradient.gradient.end));
let (new_start, new_end) = (start.lerp(end, min_position), start.lerp(end, max_position));
selected_gradient.gradien... | @@ -416,9 +493,33 @@ impl Fsm for GradientToolFsmState {
transform,
gradient: gradient.clone(),
dragging: dragging_target,
+ initial_gradient: gradient.clone(),
})
}
}
+
+ // Insert stop if clicking on line
+ if !dragging {
+ let (start, end) = (transf... | editor/src/messages/tool/tool_messages/gradient_tool.rs | 26 | Rust | 0.857 | suggestion | 663 | 51 | 51 | false | Add snapping to endpoints and stops in the Gradient tool | 3,732 | GraphiteEditor/Graphite | 17,935 | Rust | Ayush2k02 | jsjgdh | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/gradient_tool.rs
PR Title: Add snapping to endpoints and stops in the Gradient tool
BEFORE CODE: }
}
// Check dragging start or end handle
for (pos, dragging_target) in [(gradient.start, GradientDragTa... | `gradient.clone()` is called twice and `insert_stop` is called twice. This can be simplified:
```
let mut new_gradient = gradient.clone();
if let Some(index) = new_gradient.insert_stop(mouse, transform) {
responses.add(DocumentMessage::StartTransaction);
transaction_started = true;
let mut selected_gradi... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// ===============
// NORMAL PRIORITY
// ===============
//
// Hack to prevent Left Click + Accel + Z combo (this effectively blocks you from making a double undo with AbortTransaction)
entry!(KeyDown(KeyZ); modifiers=[Accel, MouseLeft], action_dispatch=DocumentMessage::Noop),
//
// AppWindowMessage
e... | ```suggestion
entry!(PointerMove; refresh_keys=[Control, Alt, Shift], action_dispatch=NodeGraphMessage::PointerMove { shift: Shift }),
``` | // ===============
// NORMAL PRIORITY
// ===============
//
// Hack to prevent Left Click + Accel + Z combo (this effectively blocks you from making a double undo with AbortTransaction)
entry!(KeyDown(KeyZ); modifiers=[Accel, MouseLeft], action_dispatch=DocumentMessage::Noop),
//
// AppWindowMessage
e... | @@ -74,7 +74,7 @@ pub fn input_mappings(zoom_with_scroll: bool) -> Mapping {
entry!(KeyDown(MouseLeft); modifiers=[Alt], action_dispatch=NodeGraphMessage::PointerDown { shift_click: false, control_click: false, alt_click: true, right_click: false }),
entry!(KeyDown(MouseRight); action_dispatch=NodeGraphMessage::P... | editor/src/messages/input_mapper/input_mappings.rs | 26 | Rust | 0.786 | suggestion | 140 | 51 | 51 | false | Fix holding Ctrl in the graph not allowing for selecting nodes unless some are in a layer | 3,778 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | jsjgdh | Review this pull request change.
Language: Rust
File: editor/src/messages/input_mapper/input_mappings.rs
PR Title: Fix holding Ctrl in the graph not allowing for selecting nodes unless some are in a layer
BEFORE CODE: // ===============
// NORMAL PRIORITY
// ===============
//
// Hack to prevent Left Cli... | ```suggestion
entry!(PointerMove; refresh_keys=[Control, Alt, Shift], action_dispatch=NodeGraphMessage::PointerMove { shift: Shift }),
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
],
[
{ label: "Screen", value: BlendMode.Screen },
{ label: "Lighten", value: BlendMode.Lighten },
{ label: "Color Dodge", value: BlendMode.ColorDodge },
// { label: "Linear Dodge (Add)", value: "" }, // Not supported by SVG
// { label: "Lighter Color", value: "" }, // Not supported by SVG
],
[
{ label:... | No issues found. | ],
[
{ label: "Screen", value: BlendMode.Screen },
{ label: "Lighten", value: BlendMode.Lighten },
{ label: "Color Dodge", value: BlendMode.ColorDodge },
// { label: "Linear Dodge (Add)", value: "" }, // Not supported by SVG
// { label: "Lighter Color", value: "" }, // Not supported by SVG
],
[
{ label:... | @@ -1,7 +1,7 @@
<template>
<LayoutCol :class="'layer-tree-panel'">
<LayoutRow :class="'options-bar'">
- <DropdownInput :menuEntries="blendModeMenuEntries" :default="blendModeMenuEntries[0][0]" />
+ <DropdownInput :menuEntries="blendModeEntries" v-model:selectedIndex="blendModeSelectedIndex" @update:selectedIn... | client/web/src/components/panels/LayerTree.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | Blend modes | 252 | GraphiteEditor/Graphite | 17,935 | Rust | geom3trik | Review this pull request change.
Language: Vue
File: client/web/src/components/panels/LayerTree.vue
PR Title: Blend modes
BEFORE CODE: ],
[
{ label: "Screen", value: BlendMode.Screen },
{ label: "Lighten", value: BlendMode.Lighten },
{ label: "Color Dodge", value: BlendMode.ColorDodge },
// { label: "Line... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
.viewport {
flex: 1 1 100%;
.canvas-area {
flex: 1 1 100%;
}
.bar-area {
flex: 0 0 auto;
}
.top-ruler {
padding-left: 16px;
margin-right: 16px;
}
.right-scrollbar {
margin-top: -16px;
}
.bottom-scrollbar {
margin-right: 16px;
}
.canvas {
backgroun... | No issues found. |
.viewport {
flex: 1 1 100%;
.canvas-area {
flex: 1 1 100%;
}
.bar-area {
flex: 0 0 auto;
}
.top-ruler {
padding-left: 16px;
margin-right: 16px;
}
.right-scrollbar {
margin-top: -16px;
}
.bottom-scrollbar {
margin-right: 16px;
}
.canvas {
backgroun... | @@ -6,7 +6,7 @@
<Separator :type="SeparatorType.Section" />
- <ToolOptions :activeTool="activeTool" />
+ <ToolOptions :activeTool="activeTool" :activeToolOptions="activeToolOptions" />
</div>
<div class="spacer"></div>
<div class="right side">
@@ -330,7 +330,10 @@ export default defineCompone... | frontend/src/components/panels/Document.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | Add two-way tool option messaging system | 361 | GraphiteEditor/Graphite | 17,935 | Rust | henryksloan | Review this pull request change.
Language: Vue
File: frontend/src/components/panels/Document.vue
PR Title: Add two-way tool option messaging system
BEFORE CODE:
.viewport {
flex: 1 1 100%;
.canvas-area {
flex: 1 1 100%;
}
.bar-area {
flex: 0 0 auto;
}
.top-ruler {
padding-left: 1... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// The thread_local macro provides a way to initialize static variables with non-constant functions
thread_local! {
pub static EDITOR_STATE: RefCell<Editor> = RefCell::new(Editor::new());
}
static LOGGER: WasmLog = WasmLog;
static EDITOR_HAS_CRASHED: AtomicBool = AtomicBool::new(false);
#[wasm_bindgen(start)]
pub fn... | No issues found. |
// The thread_local macro provides a way to initialize static variables with non-constant functions
thread_local! {
pub static EDITOR_STATE: RefCell<Editor> = RefCell::new(Editor::new());
}
static LOGGER: WasmLog = WasmLog;
static EDITOR_HAS_CRASHED: AtomicBool = AtomicBool::new(false);
#[wasm_bindgen(start)]
pub fn... | @@ -5,6 +5,7 @@ pub mod wrappers;
use editor::{message_prelude::*, Editor};
use std::cell::RefCell;
+use std::sync::atomic::AtomicBool;
use utils::WasmLog;
use wasm_bindgen::prelude::*;
@@ -13,6 +14,7 @@ thread_local! {
pub static EDITOR_STATE: RefCell<Editor> = RefCell::new(Editor::new());
}
static LOGGER:... | frontend/wasm/src/lib.rs | 0 | Rust | 1 | none | 16 | 51 | 51 | true | Show a crash dialog when the editor panics | 362 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Review this pull request change.
Language: Rust
File: frontend/wasm/src/lib.rs
PR Title: Show a crash dialog when the editor panics
BEFORE CODE:
// The thread_local macro provides a way to initialize static variables with non-constant functions
thread_local! {
pub static EDITOR_STATE: RefCell<Editor> = RefCell::n... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import LayoutRow from "@/components/layout/LayoutRow.vue";
import IconButton from "@/components/widgets/buttons/IconButton.vue";
import PopoverButton from "@/components/widgets/buttons/PopoverButton.vue";
import { SectionsOfMenuListEntries } from "@/components/widgets/floating-menus/MenuList.vue";
import DropdownInput ... | No issues found. | import LayoutRow from "@/components/layout/LayoutRow.vue";
import IconButton from "@/components/widgets/buttons/IconButton.vue";
import PopoverButton from "@/components/widgets/buttons/PopoverButton.vue";
import { SectionsOfMenuListEntries } from "@/components/widgets/floating-menus/MenuList.vue";
import DropdownInput ... | @@ -29,8 +29,8 @@
</PopoverButton>
</LayoutRow>
<LayoutRow :class="'layer-tree scrollable-y'">
- <LayoutCol :class="'list'" ref="layerTreeList" @click="() => deselectAllLayers()" @dragover="updateInsertLine($event)" @dragend="drop()">
- <div class="layer-row" v-for="(layer, index) in layers" :key="String... | frontend/src/components/panels/LayerTree.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | Migrate to using MoveSelectedLayersTo | 469 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Review this pull request change.
Language: Vue
File: frontend/src/components/panels/LayerTree.vue
PR Title: Migrate to using MoveSelectedLayersTo
BEFORE CODE: import LayoutRow from "@/components/layout/LayoutRow.vue";
import IconButton from "@/components/widgets/buttons/IconButton.vue";
import PopoverButton from "@... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
pub mod snapping;
pub mod tool;
pub mod tool_message;
pub mod tool_message_handler;
pub mod tools;
pub mod vector_editor;
#[cfg(test)]
mod tool_crash_on_layer_delete_tests {
use crate::communication::set_uuid_seed;
use crate::misc::test_utils::EditorTestUtils;
use crate::viewport_tools::tool::ToolType;
use crate::... | No issues found. | pub mod snapping;
pub mod tool;
pub mod tool_message;
pub mod tool_message_handler;
pub mod tools;
pub mod vector_editor;
#[cfg(test)]
mod tool_crash_on_layer_delete_tests {
use crate::communication::set_uuid_seed;
use crate::misc::test_utils::EditorTestUtils;
use crate::viewport_tools::tool::ToolType;
use crate::... | @@ -4,3 +4,32 @@ pub mod tool_message;
pub mod tool_message_handler;
pub mod tools;
pub mod vector_editor;
+
+#[cfg(test)]
+mod tool_crash_on_layer_delete_tests {
+ use crate::communication::set_uuid_seed;
+ use crate::misc::test_utils::EditorTestUtils;
+ use crate::viewport_tools::tool::ToolType;
+ use crate::{Docu... | editor/src/viewport_tools/mod.rs | 0 | Rust | 1 | none | 16 | 36 | 36 | true | Fix layer deletion bugs when tools are in use | 684 | GraphiteEditor/Graphite | 17,935 | Rust | ghost | Review this pull request change.
Language: Rust
File: editor/src/viewport_tools/mod.rs
PR Title: Fix layer deletion bugs when tools are in use
BEFORE CODE: pub mod snapping;
pub mod tool;
pub mod tool_message;
pub mod tool_message_handler;
pub mod tools;
pub mod vector_editor;
#[cfg(test)]
mod tool_crash_on_layer_... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
(_, PathToolMessage::DragStart { add_to_selection }) => {
let toggle_add_to_selection = input.keyboard.get(add_to_selection as usize);
// Select the first point within the threshold (in pixels)
if let Some(mut new_selected) = tool_data
.shape_editor
.select_point(&document.graphene_docum... | No issues found. | (_, PathToolMessage::DragStart { add_to_selection }) => {
let toggle_add_to_selection = input.keyboard.get(add_to_selection as usize);
// Select the first point within the threshold (in pixels)
if let Some(mut new_selected) = tool_data
.shape_editor
.select_point(&document.graphene_docum... | @@ -1,4 +1,4 @@
-use crate::consts::SELECTION_THRESHOLD;
+use crate::consts::{SELECTION_THRESHOLD, SELECTION_TOLERANCE};
use crate::messages::frontend::utility_types::MouseCursorIcon;
use crate::messages::input_mapper::utility_types::input_keyboard::{Key, KeysGroup, MouseMotion};
use crate::messages::layout::utility... | editor/src/messages/tool/tool_messages/path_tool.rs | 0 | Rust | 1 | none | 16 | 51 | 51 | true | Add point insertion to the Path tool | 754 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Review this pull request change.
Language: Rust
File: editor/src/messages/tool/tool_messages/path_tool.rs
PR Title: Add point insertion to the Path tool
BEFORE CODE: (_, PathToolMessage::DragStart { add_to_selection }) => {
let toggle_add_to_selection = input.keyboard.get(add_to_selection as usize);
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid white;
box-sizing: border-box;
mix-blend-mode: difference;
}
}
.selection-pincers {
position: absolute;
top: 0%;
width: 100%;
height: 0;
pointer-events: none;
&::before {
content: "";
position: absolute;
top: -... | No issues found. | width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid white;
box-sizing: border-box;
mix-blend-mode: difference;
}
}
.selection-pincers {
position: absolute;
top: 0%;
width: 100%;
height: 0;
pointer-events: none;
&::before {
content: "";
position: absolute;
top: -... | @@ -1,30 +1,29 @@
<template>
- <LayoutRow class="color-picker">
- <LayoutCol class="saturation-picker" ref="saturationPicker" @pointerdown="(e: PointerEvent) => onPointerDown(e)">
- <div ref="saturationCursor" class="selection-circle"></div>
- </LayoutCol>
- <LayoutCol class="hue-picker" ref="huePicker" @pointerd... | frontend/src/components/floating-menus/ColorPicker.vue | 0 | Vue | 1 | none | 16 | 51 | 51 | true | Refactor color picker floating menu | 809 | GraphiteEditor/Graphite | 17,935 | Rust | Keavon | Review this pull request change.
Language: Vue
File: frontend/src/components/floating-menus/ColorPicker.vue
PR Title: Refactor color picker floating menu
BEFORE CODE: width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid white;
box-sizing: border-box;
mix-blend-mode: difference;
}
}
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if let NodeInput::Value { tagged_value, .. } = &node_type.inputs[input_index].default {
*input = NodeInput::Value {
tagged_value: tagged_value.clone(),
exposed: true,
};
}
}
if let DocumentNodeImplementation::Network(network) = &mut node.implementation {
Self::remove_references_f... | No issues found. | if let NodeInput::Value { tagged_value, .. } = &node_type.inputs[input_index].default {
*input = NodeInput::Value {
tagged_value: tagged_value.clone(),
exposed: true,
};
}
}
if let DocumentNodeImplementation::Network(network) = &mut node.implementation {
Self::remove_references_f... | @@ -530,6 +530,53 @@ impl MessageHandler<NodeGraphMessage, (&mut Document, &InputPreprocessorMessageH
}
}
}
+ NodeGraphMessage::ShiftNode { node_id } => {
+ let Some(network) = self.get_active_network_mut(document) else{
+ warn!("No network");
+ return;
+ };
+ let outwards_links = netw... | editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs | 0 | Rust | 1 | none | 16 | 51 | 51 | true | Add drag to connect nodes | 901 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs
PR Title: Add drag to connect nodes
BEFORE CODE: if let NodeInput::Value { tagged_value, .. } = &node_type.inputs[input_index].default {
*input = NodeInput::Value {
ta... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
outputs: vec![DocumentOutputType {
name: "PipelineResult",
data_type: FrontendGraphDataType::General,
}],
..Default::default()
},
#[cfg(feature = "gpu")]
DocumentNodeType {
name: "ReadOutputBuffer",
category: "Gpu",
identifier: NodeImplementation::DocumentNode(NodeNetwork {
inputs: v... | No issues found. | outputs: vec![DocumentOutputType {
name: "PipelineResult",
data_type: FrontendGraphDataType::General,
}],
..Default::default()
},
#[cfg(feature = "gpu")]
DocumentNodeType {
name: "ReadOutputBuffer",
category: "Gpu",
identifier: NodeImplementation::DocumentNode(NodeNetwork {
inputs: v... | @@ -1915,11 +1915,90 @@ fn static_nodes() -> Vec<DocumentNodeType> {
},
(*IMAGINATE_NODE).clone(),
DocumentNodeType {
- name: "Unit Circle Generator",
+ name: "Circle",
category: "Vector",
- identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::UnitCircleGenerator"),
- inpu... | editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs | 0 | Rust | 1 | none | 16 | 51 | 51 | true | New nodes: shape/curve primitives | 1,389 | GraphiteEditor/Graphite | 17,935 | Rust | Ezbaze | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs
PR Title: New nodes: shape/curve primitives
BEFORE CODE: outputs: vec![DocumentOutputType {
name: "PipelineResult",
data_type: FrontendGraphDataType::G... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// Colors choice
let colors_index = 38;
let mut colors = vec![TextLabel::new("Colors").widget_holder(), Separator::new(SeparatorType::Unrelated).widget_holder()];
add_blank_assist(&mut colors);
if let &NodeInput::Value {
tagged_value: TaggedValue::SelectiveColorChoice(choice),
exposed: false,
} = &document_no... | No issues found. | // Colors choice
let colors_index = 38;
let mut colors = vec![TextLabel::new("Colors").widget_holder(), Separator::new(SeparatorType::Unrelated).widget_holder()];
add_blank_assist(&mut colors);
if let &NodeInput::Value {
tagged_value: TaggedValue::SelectiveColorChoice(choice),
exposed: false,
} = &document_no... | @@ -1810,7 +1810,7 @@ pub fn no_properties(_document_node: &DocumentNode, _node_id: NodeId, _context:
string_properties("Node has no properties")
}
-pub fn index_node_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
+pub fn index_properties(docum... | editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs | 0 | Rust | 1 | none | 16 | 51 | 51 | true | New node: Color Overlay | 1,391 | GraphiteEditor/Graphite | 17,935 | Rust | dhruv-ahuja | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/node_properties.rs
PR Title: New node: Color Overlay
BEFORE CODE: // Colors choice
let colors_index = 38;
let mut colors = vec![TextLabel::new("Colors").widget_holder(), Separator::n... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
/// Changes the inputs of a all of the existing instances of a node name
fn modify_all_node_inputs(&mut self, name: &'static str, skip_rerender: bool, mut update_input: impl FnMut(&mut Vec<NodeInput>, NodeId, &DocumentMetadata)) {
let existing_nodes: Vec<_> = self.network.primary_flow_from_opt(self.layer_node).... | No issues found. | }
/// Changes the inputs of a all of the existing instances of a node name
fn modify_all_node_inputs(&mut self, name: &'static str, skip_rerender: bool, mut update_input: impl FnMut(&mut Vec<NodeInput>, NodeId, &DocumentMetadata)) {
let existing_nodes: Vec<_> = self.network.primary_flow_from_opt(self.layer_node).... | @@ -107,7 +107,6 @@ impl<'a> ModifyInputsContext<'a> {
} else {
// The user has connected another node to the output. Insert a layer node between the output and the node.
let mut node = resolve_document_node_type("Layer").expect("Layer node").default_document_node();
- self.add_empty_stack(&mut node);
... | editor/src/messages/portfolio/document/node_graph/graph_operation_message_handler.rs | 0 | Rust | 1 | none | 16 | 51 | 51 | true | Remove explicit empty stack nodes | 1,445 | GraphiteEditor/Graphite | 17,935 | Rust | 0HyperCube | Review this pull request change.
Language: Rust
File: editor/src/messages/portfolio/document/node_graph/graph_operation_message_handler.rs
PR Title: Remove explicit empty stack nodes
BEFORE CODE: }
/// Changes the inputs of a all of the existing instances of a node name
fn modify_all_node_inputs(&mut self, name... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.