Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ web-sys = { version = "=0.3.77", features = [
"HtmlCanvasElement",
"CanvasRenderingContext2d",
"CanvasPattern",
"DomMatrix",
"SvgMatrix",
"OffscreenCanvas",
"OffscreenCanvasRenderingContext2d",
"TextMetrics",
Expand Down
18 changes: 18 additions & 0 deletions editor/src/messages/portfolio/document/document_message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
responses.add(PortfolioMessage::UpdateDocumentWidgets);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Pivot and Origin overlay checkboxes are bound to the wrong visibility fields, so the checked state and toggle action are inverted.

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

<comment>Pivot and Origin overlay checkboxes are bound to the wrong visibility fields, so the checked state and toggle action are inverted.</comment>

<file context>
@@ -2319,7 +2320,7 @@ impl DocumentMessageHandler {
 							let checkbox_id = CheckboxId::new();
 							vec![
-								CheckboxInput::new(self.overlays_visibility_settings.pivot)
+								CheckboxInput::new(self.overlays_visibility_settings.origin)
 									.on_update(|optional_input: &CheckboxInput| {
 										DocumentMessage::SetOverlaysVisibility {
</file context>

}
OverlaysType::Handles => visibility_settings.handles = visible,
OverlaysType::FillableIndicator => visibility_settings.fillable_indicator = visible,
}

responses.add(EventMessage::ToolAbort);
Expand Down Expand Up @@ -2801,6 +2802,23 @@ impl DocumentMessageHandler {
.widget_instance(),
]
}),
LayoutGroup::row(vec![TextLabel::new("Fill Tool").widget_instance()]),
LayoutGroup::row({
let checkbox_id = CheckboxId::new();
vec![
CheckboxInput::new(self.overlays_visibility_settings.fillable_indicator)
.on_update(|optional_input: &CheckboxInput| {
DocumentMessage::SetOverlaysVisibility {
visible: optional_input.checked,
overlays_type: Some(OverlaysType::FillableIndicator),
}
.into()
})
.for_label(checkbox_id)
.widget_instance(),
TextLabel::new("Fillable Indicator".to_string()).for_checkbox(checkbox_id).widget_instance(),
]
}),
]))
.widget_instance(),
Separator::new(SeparatorStyle::Related).widget_instance(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ pub enum GraphOperationMessage {
layer: LayerNodeIdentifier,
stroke: Stroke,
},
StrokeColorSet {
layer: LayerNodeIdentifier,
stroke_color: Color,
},
TransformChange {
layer: LayerNodeIdentifier,
transform: DAffine2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageContext<'_>> for
modify_inputs.stroke_set(stroke);
}
}
GraphOperationMessage::StrokeColorSet { layer, stroke_color } => {
if let Some(mut modify_inputs) = ModifyInputsContext::new_with_layer(layer, network_interface, responses) {
modify_inputs.stroke_color_set(Some(stroke_color));
}
}
GraphOperationMessage::TransformChange {
layer,
transform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,15 @@ impl<'a> ModifyInputsContext<'a> {
self.set_input_with_refresh(input_connector, NodeInput::value(TaggedValue::F64(stroke.dash_offset), false), true);
}

pub fn stroke_color_set(&mut self, color: Option<Color>) {
let Some(stroke_node_id) = self.existing_proto_node_id(graphene_std::vector::stroke::IDENTIFIER, false) else {
return;
};

let input_connector = InputConnector::node(stroke_node_id, graphene_std::vector::stroke::ColorInput::INDEX);
self.set_input_with_refresh(input_connector, NodeInput::value(TaggedValue::Color(color), false), false);
}

/// Update the transform value of the upstream Transform node based a change to its existing value and the given parent transform.
/// A new Transform node is created if one does not exist, unless it would be given the identity transform.
pub fn transform_change_with_parent(&mut self, transform: DAffine2, transform_in: TransformIn, parent_transform: DAffine2, skip_rerender: bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ impl MessageHandler<OverlaysMessage, OverlaysMessageContext<'_>> for OverlaysMes
canvas_context.clear_rect(0., 0., width, height);

if visibility_settings.all() {
responses.add(DocumentMessage::GridOverlays {
context: OverlayContext {
render_context: canvas_context.clone(),
visibility_settings: visibility_settings.clone(),
viewport: *viewport,
},
});
for provider in &self.overlay_providers {
responses.add(provider(OverlayContext {
render_context: canvas_context.clone(),
visibility_settings: visibility_settings.clone(),
viewport: *viewport,
}));
}
responses.add(DocumentMessage::GridOverlays {
context: OverlayContext {
render_context: canvas_context.clone(),
visibility_settings: visibility_settings.clone(),
viewport: *viewport,
},
});
}
}
#[cfg(all(not(target_family = "wasm"), not(test)))]
Expand All @@ -79,11 +79,10 @@ impl MessageHandler<OverlaysMessage, OverlaysMessageContext<'_>> for OverlaysMes
let overlay_context = OverlayContext::new(*viewport, visibility_settings);

if visibility_settings.all() {
responses.add(DocumentMessage::GridOverlays { context: overlay_context.clone() });

for provider in &self.overlay_providers {
responses.add(provider(overlay_context.clone()));
}
responses.add(DocumentMessage::GridOverlays { context: overlay_context.clone() });
}
responses.add(FrontendMessage::RenderOverlays { context: overlay_context });
}
Expand Down
Loading
Loading