Repository navigation
feat(labels): set a point layer's obstacle weight in the Labeling pane (#3526) - #3609
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| ui.end_row(); | ||
| // The layer's points as obstacles (#3526), for the layers the engine takes it for, whatever | ||
| // the class shown; 0 is none. | ||
| if l.takes_obstacle_weight() { |
There was a problem hiding this comment.
A layer that already holds an obstacle weight and then stops taking one (it becomes a cluster or heat map layer, or a graphics layer) loses its row, so the user can't see or clear the weight from the pane. The weight stays saved, and the project keeps requiring label-obstacles on that account, so the requirement has no visible cause. The PR describes this as a known limit, so this is a follow-up, not a blocker. A small fix is to keep the row while a weight is set, so it can be set to 0 (which labels.placement always accepts):
| if l.takes_obstacle_weight() { | |
| if l.takes_obstacle_weight() || l.labels.obstacle_weight > 0 { |
Category: quality
Code reviewI found no bugs, security issues, or AGENTS.md violations in this PR. One quality follow-up is posted inline. Bugs: none found.
Security: none found. The change adds no input parsing and no new external data. Performance: none found. The row adds one Quality:
Surfaces and twins:
Prior concerns: none. Change sizeCompared with the base branch: the whole PR against
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
| .on_hover_text(tl!( | ||
| "A label whose class's weight isn't above this isn't placed over one of this layer's points, except its own feature's. 0: the points are no obstacle." | ||
| )); | ||
| if drag.settled(ui, &r, &mut v) && label_weight(v) != l.labels.obstacle_weight { |
There was a problem hiding this comment.
Low-confidence nit: label_weight maps a non-finite value to DEFAULT_LABEL_WEIGHT (5), but the obstacle weight's default is 0. The Weight row has the same fallback. A non-finite value is unlikely to reach this drag, but if it did, this row would write 5 to the layer, which turns on an obstacle the user never set. Skipping non-finite values here avoids that.
| if drag.settled(ui, &r, &mut v) && label_weight(v) != l.labels.obstacle_weight { | |
| if drag.settled(ui, &r, &mut v) && v.is_finite() && label_weight(v) != l.labels.obstacle_weight { |
Category: quality
Code reviewI read the four changed files, the diff, and the surrounding code in BugsNone found. The engine's SecurityNone found. PerformanceNone found. Quality
AGENTS.mdNo breaks found. Checks against the rules:
Twins checked
Change sizeCompared with the base branch (merge base 8beac7b to PR head 7bd7110). Sizes are file sizes from
|
Summary
Closes #3526. #3531 made a point layer's points obstacles for labels, with an obstacle weight set by command only. This adds the pane row for it.
Layer::takes_obstacle_weight()(points, not a graphics, cluster or heat map layer) now serveslabels.placement's refusal and the pane's row; the engine's messages are the same.Surfaces: the desktop pane only. The web app shares the pane; the command, CLI, Python, the Assistant and the saved project are unchanged (the weight, its command and its
label-obstaclescapability are #3531's). Undo: one step per change.Not in this PR: a layer that already holds a weight and then becomes a cluster or heat map layer keeps it with the row hidden; it is inert there (such a layer draws no points), but a saved project still requires
label-obstacleswhile it holds one.labels.placementwithobstacleWeight: 0clears it.Testing
an_obstacle_weight_is_set_in_the_pane(new): shows the layer's weight, typing sets it in one undo step, the class's weight is unchanged, no row for lines, polygons, a cluster layer or a graphics layer, and the row comes back for points.checks.shforrustgis-ui-egui: fmt, clippy, doctests, layers and schema green. nextest: 12180 of 12188 pass; the 8 failures (7 inrustgis-geolibre,line_strokes_editor_edits_one_class) fail the same onmainon this machine.rustgis-map,rustgis-engineandrustgis-ui-egui, and the 55 obstacle and pane tests, green.ui_shotreplay of the pane with Cities at weight 4.UI evidence
After (new UI): the new row under Weight, Cities at 4.
Related issue
Closes #3526 (its PR 1 is #3531).
Summary by CodeRabbit