Skip to content

Fix strokes with inside/outside alignment not being selectable when above other layers#4207

Open
Keavon wants to merge 1 commit into
masterfrom
fix-nonselectable-aligned-strokes
Open

Fix strokes with inside/outside alignment not being selectable when above other layers#4207
Keavon wants to merge 1 commit into
masterfrom
fix-nonselectable-aligned-strokes

Conversation

@Keavon
Copy link
Copy Markdown
Member

@Keavon Keavon commented Jun 6, 2026

Fixes #4206

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the click target calculation in extend_targets_from_vector to double the stroke width for inside/outside-aligned strokes on closed paths. The reviewer suggested optimizing this logic by combining the subpath collection, closed-path check, and closure modification into a single pass over the iterator to avoid multiple iterations over the allocated vector.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +1496 to +1513
let mut subpaths: Vec<Subpath<_>> = vector.stroke_bezier_paths().collect();
let all_subpaths_closed = subpaths.iter().all(|subpath| subpath.closed());

// Inside/Outside-aligned strokes reach `weight` from the centerline rather than `weight / 2` per side,
// so they need double the click inflation. Alignment is only honored by the renderer for fully-closed paths.
let stroke_width = vector.style.stroke().map_or(0., |stroke| {
if stroke.align.is_not_centered() && all_subpaths_closed {
stroke.weight * 2.
} else {
stroke.weight
}
});

if filled {
for subpath in &mut subpaths {
subpath.set_closed(true);
}
}
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.

medium

We can optimize this by combining the collection, closed-path check, and closure modification into a single pass over the iterator. This avoids iterating over the allocated Vec multiple times.

	let mut all_subpaths_closed = true;
	let mut subpaths: Vec<Subpath<__>> = vector
		.stroke_bezier_paths()
		.map(|mut subpath| {
			if !subpath.closed() {
				all_subpaths_closed = false;
			}
			if filled {
				subpath.set_closed(true);
			}
			subpath
		})
		.collect();

	// Inside/Outside-aligned strokes reach weight from the centerline rather than weight / 2 per side,
	// so they need double the click inflation. Alignment is only honored by the renderer for fully-closed paths.
	let stroke_width = vector.style.stroke().map_or(0., |stroke| {
		if stroke.align.is_not_centered() && all_subpaths_closed {
			stroke.weight * 2.
		} else {
			stroke.weight
		}
	});

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stroke alignment selection bug

1 participant