Skip to content

Commit 5ed45ea

Browse files
authored
Fix click target not extending to correct limit for aligned strokes (#3065)
Fixes #3047
1 parent 0a53eae commit 5ed45ea

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

node-graph/gcore/src/vector/style.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,16 @@ impl Stroke {
371371
self.weight
372372
}
373373

374+
/// Get the effective stroke weight.
375+
pub fn effective_width(&self) -> f64 {
376+
self.weight
377+
* match self.align {
378+
StrokeAlign::Center => 1.,
379+
StrokeAlign::Inside => 0.,
380+
StrokeAlign::Outside => 2.,
381+
}
382+
}
383+
374384
pub fn dash_lengths(&self) -> String {
375385
if self.dash_lengths.is_empty() {
376386
"none".to_string()

node-graph/gsvg-renderer/src/renderer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ impl Render for Table<Vector> {
988988
let vector = row.element;
989989

990990
if let Some(element_id) = element_id {
991-
let stroke_width = vector.style.stroke().as_ref().map_or(0., Stroke::weight);
991+
let stroke_width = vector.style.stroke().as_ref().map_or(0., Stroke::effective_width);
992992
let filled = vector.style.fill() != &Fill::None;
993993
let fill = |mut subpath: Subpath<_>| {
994994
if filled {

0 commit comments

Comments
 (0)