Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct Editor {

impl Editor {
pub fn new(environment: Environment, uuid_random_seed: u64) -> Self {
ENVIRONMENT.set(environment).expect("Editor shoud only be initialized once");
ENVIRONMENT.set(environment).expect("Editor should only be initialized once");
graphene_std::uuid::set_uuid_seed(uuid_random_seed);

Self { dispatcher: Dispatcher::new() }
Expand Down
2 changes: 1 addition & 1 deletion editor/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub const COMPASS_ROSE_RING_INNER_DIAMETER: f64 = 13.;
pub const COMPASS_ROSE_MAIN_RING_DIAMETER: f64 = 15.;
pub const COMPASS_ROSE_HOVER_RING_DIAMETER: f64 = 23.;
pub const COMPASS_ROSE_ARROW_SIZE: f64 = 5.;
// Angle to either side of the compass arrows where they are targetted by the cursor (in degrees, must be less than 45°)
// Angle to either side of the compass arrows where they are targeted by the cursor (in degrees, must be less than 45°)
pub const COMPASS_ROSE_ARROW_CLICK_TARGET_ANGLE: f64 = 20.;

// TRANSFORM OVERLAY
Expand Down
2 changes: 1 addition & 1 deletion editor/src/messages/layout/utility_types/layout_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub enum LayoutTarget {
MenuBar,
/// Bar at the top of the node graph containing the location and the "Preview" and "Hide" buttons.
NodeGraphControlBar,
/// The body of the Properties panel containing many collapsable sections.
/// The body of the Properties panel containing many collapsible sections.
PropertiesPanel,
/// The contextual input key/mouse combination shortcuts shown in the status bar at the bottom of the window.
StatusBarHints,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3408,20 +3408,20 @@ mod document_message_handler_tests {
editor.handle_message(NodeGraphMessage::SelectedNodesSet { nodes: vec![rect_layer.to_node()] }).await;
editor.handle_message(DocumentMessage::MoveSelectedLayersTo { parent: folder1, insert_index: 0 }).await;

// Verifying rectagle is now in folder1
// Verifying rectangle is now in folder1
let rect_parent = rect_layer.parent(editor.active_document().metadata()).unwrap();
assert_eq!(rect_parent, folder1, "Rectangle should be inside folder1");

// Moving folder1 into folder2
editor.handle_message(NodeGraphMessage::SelectedNodesSet { nodes: vec![folder1.to_node()] }).await;
editor.handle_message(DocumentMessage::MoveSelectedLayersTo { parent: folder2, insert_index: 0 }).await;

// Verifing hirarchy: folder2 > folder1 > rectangle
// Verifying hierarchy: folder2 > folder1 > rectangle
let document = editor.active_document();
let folder1_parent = folder1.parent(document.metadata()).unwrap();
assert_eq!(folder1_parent, folder2, "Folder1 should be inside folder2");

// Verifing rectangle moved with its parent
// Verifying rectangle moved with its parent
let rect_parent = rect_layer.parent(document.metadata()).unwrap();
assert_eq!(rect_parent, folder1, "Rectangle should still be inside folder1");

Expand Down Expand Up @@ -3496,7 +3496,7 @@ mod document_message_handler_tests {
let document = editor.active_document();
let rect_bbox_after = document.metadata().bounding_box_viewport(rect_layer).unwrap();

// Verifing the rectangle maintains approximately the same position in viewport space
// Verifying the rectangle maintains approximately the same position in viewport space
let before_center = (rect_bbox_before[0] + rect_bbox_before[1]) / 2.; // TODO: Should be: DVec2(0., -25.), regression (#2688) causes it to be: DVec2(100., 25.)
let after_center = (rect_bbox_after[0] + rect_bbox_after[1]) / 2.; // TODO: Should be: DVec2(0., -25.), regression (#2688) causes it to be: DVec2(200., 75.)
let distance = before_center.distance(after_center); // TODO: Should be: 0., regression (#2688) causes it to be: 111.80339887498948
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
ptz.set_zoom(ptz.zoom() * new_scale * VIEWPORT_ZOOM_TO_FIT_PADDING_SCALE_FACTOR);

// Keep the canvas filling less than the full available viewport bounds if requested.
// And if the zoom is close to the full viewport bounds, we ignore the padding because 100% is preferrable if it still fits.
// And if the zoom is close to the full viewport bounds, we ignore the padding because 100% is preferable if it still fits.
if prevent_zoom_past_100 && ptz.zoom() > VIEWPORT_ZOOM_TO_FIT_PADDING_SCALE_FACTOR {
ptz.set_zoom(1.);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ impl OverlayContext {

/// Transforms the canvas context to adjust for DPI scaling
///
/// Overwrites all existing tranforms. This operation can be reversed with [`Self::reset_transform`].
/// Overwrites all existing transforms. This operation can be reversed with [`Self::reset_transform`].
fn start_dpi_aware_transform(&self) {
let [a, b, c, d, e, f] = DAffine2::from_scale(DVec2::splat(self.viewport.scale())).to_cols_array();
self.render_context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3744,7 +3744,7 @@ impl NodeNetworkInterface {
Some(old_inputs)
}

/// Used when opening an old document to add the persistent metadata for each input if it doesnt exist, which is where the name/description are saved.
/// Used when opening an old document to add the persistent metadata for each input if it doesn't exist, which is where the name/description are saved.
pub fn validate_input_metadata(&mut self, node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId]) {
let number_of_inputs = node.inputs.len();
let Some(metadata) = self.node_metadata_mut(node_id, network_path) else { return };
Expand Down Expand Up @@ -3877,7 +3877,7 @@ impl NodeNetworkInterface {
return;
}

// It is necessary to ensure the grpah is acyclic before calling `self.position` as it sometimes crashes with cyclic graphs #3227
// It is necessary to ensure the graph is acyclic before calling `self.position` as it sometimes crashes with cyclic graphs #3227
let previous_metadata = match &previous_input {
NodeInput::Node { node_id, .. } => self.position(node_id, network_path).map(|position| (*node_id, position)),
_ => None,
Expand Down Expand Up @@ -6436,7 +6436,7 @@ pub struct NavigationMetadata {
/// The current pan, and zoom state of the viewport's view of the node graph.
/// Ensure `DocumentMessage::UpdateDocumentTransform` is called when the pan, zoom, or transform changes.
pub node_graph_ptz: PTZ,
// TODO: Eventually remove once te click targets are extracted from the native render
// TODO: Eventually remove once the click targets are extracted from the native render
/// Transform from node graph space to viewport space.
pub node_graph_to_viewport: DAffine2,
// TODO: Eventually remove once the import/export positions are extracted from the native render
Expand Down
2 changes: 1 addition & 1 deletion editor/src/messages/portfolio/document_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
// Decide on the placement position of the new Multiply node
let multiply_node_id = NodeId::new();
let Some(transform_position) = document.network_interface.position_from_downstream_node(node_id, network_path) else {
log::error!("Could not get positon for transform node {node_id}");
log::error!("Could not get position for transform node {node_id}");
return None;
};
let multiply_position = transform_position + IVec2::new(-7, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,13 @@ pub fn snap_drag(start: DVec2, current: DVec2, snap_to_axis: bool, axis: Axis, s
/// Contains info on the overlays for the bounding box and transform handles
#[derive(Clone, Debug, Default)]
pub struct BoundingBoxManager {
/// The corners of the box. Transform with original_bound_transform to get viewport co-ordinates.
/// The corners of the box. Transform with original_bound_transform to get viewport coordinates.
pub bounds: [DVec2; 2],
/// The transform to viewport space for the bounds co-ordinates when the bounds were last updated.
/// The transform to viewport space for the bounds coordinates when the bounds were last updated.
pub transform: DAffine2,
/// Whether the transform is actually singular but adjusted to not be so.
pub transform_tampered: bool,
/// The transform to viewport space for the bounds co-ordinates when the transformation was started.
/// The transform to viewport space for the bounds coordinates when the transformation was started.
pub original_bound_transform: DAffine2,
pub selected_edges: Option<SelectedEdges>,
pub original_transforms: OriginalTransforms,
Expand Down
2 changes: 1 addition & 1 deletion editor/src/messages/viewport/viewport_message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ impl Sub<PhysicalPoint> for PhysicalPoint {
}
}
fn assert_scale<T: Scaled>(a: &T, b: &T) {
assert_eq!(a.scale(), b.scale(), "Cannot multiply with diffent scale");
assert_eq!(a.scale(), b.scale(), "Cannot multiply with different scale");
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The error message says "Cannot multiply" but assert_scale is also called from Div, Add, and Sub implementations. Consider a more generic message like "Cannot perform arithmetic with different scale" so the panic message is accurate regardless of which operation triggered it.

(Based on your team's feedback about using consistent, precise terminology in names and docs.)

View Feedback

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At editor/src/messages/viewport/viewport_message_handler.rs, line 526:

<comment>The error message says "Cannot multiply" but `assert_scale` is also called from `Div`, `Add`, and `Sub` implementations. Consider a more generic message like "Cannot perform arithmetic with different scale" so the panic message is accurate regardless of which operation triggered it.

(Based on your team's feedback about using consistent, precise terminology in names and docs.) </comment>

<file context>
@@ -523,7 +523,7 @@ impl Sub<PhysicalPoint> for PhysicalPoint {
 }
 fn assert_scale<T: Scaled>(a: &T, b: &T) {
-	assert_eq!(a.scale(), b.scale(), "Cannot multiply with diffent scale");
+	assert_eq!(a.scale(), b.scale(), "Cannot multiply with different scale");
 }
 
</file context>
Suggested change
assert_eq!(a.scale(), b.scale(), "Cannot multiply with different scale");
assert_eq!(a.scale(), b.scale(), "Cannot perform arithmetic with different scale");
Fix with Cubic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should i commit this suggestion ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luzpaz Yes, I recommend committing it.

While your current change fixes the typo, the message "Cannot multiply" is technically inaccurate when the assertion fails during an addition, subtraction, or division—all of which call assert_scale.

Using "Cannot perform arithmetic" makes the error message precise for every operation that uses this check, which aligns with your team's preference for using consistent and precise terminology.

}

impl From<(f64, f64)> for Point {
Expand Down
6 changes: 3 additions & 3 deletions editor/src/node_graph_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl NodeGraphExecutor {
let Some((fid, execution_context)) = self.futures.pop_front() else {
panic!("InvalidGenerationId")
};
assert_eq!(fid, execution_id, "Missmatch in execution id");
assert_eq!(fid, execution_id, "Mismatch in execution id");

if let Some(export_config) = execution_context.export_config {
// Special handling for exporting the artwork
Expand Down Expand Up @@ -541,9 +541,9 @@ mod test {
}

impl Instrumented {
/// Adds montior nodes to the network
/// Adds monitor nodes to the network
fn add(&mut self, network: &mut NodeNetwork, path: &mut Vec<NodeId>) {
// Required to do seperately to satiate the borrow checker.
// Required to do separately to satiate the borrow checker.
let mut monitor_nodes = Vec::new();
for (id, node) in network.nodes.iter_mut() {
// Recursively instrument
Expand Down
Loading