Repository navigation
Pick what objects draw; the ribbon's layer list moves the selection - #11
Merged
Merged
Conversation
The ribbon's layer, colour, linetype and lineweight lists act on the selected objects when there are some (as AutoCAD does), and set the current value only when nothing is selected. With a selection they show the value the objects share, or nothing when they differ. Objects on a locked layer are left out, and the command line says how many. Picking now tests what each object draws: - A polyline with width (constant or tapered, a donut) is picked anywhere in its band, and a crossing box inside the band crosses it. - The spatial index finds objects by how far they can draw (`reach`): the drawing's box for words is an estimate a wide last letter outgrows, and a dimension's words outside a circle are past its defining points. Without this, those parts could not be picked. - A linear or aligned dimension's bounds take in both ends of its line; DIMALIGNED keeps the point it was placed through, not one end. A new test picks about 36 kinds of object on what they draw and in the empty space around them, alone and through the spatial index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Ribbon property lists act on the selection. Picking a layer in the ribbon's layer list with objects selected moves them to that layer, as AutoCAD does. Before, it only set the current layer, so the only way was to redraw the object. The colour, linetype and lineweight lists work the same way.
Hitboxes follow what each object draws. A new audit (
crates/engine/tests/it/pick_audit.rs) covers about 36 kinds of object. It picks each one on what it draws, and in the empty space around it. It runs once with the object alone and once among 400 others, so picking goes through the spatial index. The audit found and this PR fixes:The index now stores how far each object can draw (
select::reach), a cheap margin for words and dimensions. The exact test still runs on the few candidates it lets through. Window selection ("fully inside") still uses the drawing's bounds.The cost is small. With 4,000 texts and dimensions, building the index goes from 11 ms to 22 ms. Computing the exact shapes at index time would have taken 290 ms, so the margin is used instead.
Checks
cargo xtask ci: fmt and clippy pass. In the full test run only the three known macOS-only failures remain (usage::non_unicode_output_names,read_file_refuses_a_name_that_is_not_unicode,thai_marks_stack_in_an_installed_font). i18n, assets, layers and wasm pass.🤖 Generated with Claude Code