Skip to content

Fix Follow link curve controls and inward-bend comment rendering - #317

Merged
TheWitness merged 4 commits into
Cacti:developfrom
alcatron:fix/single-curve-control-20261018
Oct 17, 2026
Merged

TheWitness merged 4 commits into
Cacti:developfrom
alcatron:fix/single-curve-control-20261018

Conversation

@alcatron

@alcatron alcatron commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Map Style renders two Follow link curve checkboxes with the same name and ID, so unchecking one can leave the option enabled. Separately, gentle inward bends can reject curved comments because letter spacing is measured on the arrow spine instead of the offset text baseline. The fallback then draws a straight rotated label that can cross the arrow.

Keep one checkbox and measure curved-comment placement along the offset text path, retaining kerning, endpoint alignment, nudge direction, and fallbacks for tight bends or reversed offset geometry. Reject invalid offset intervals only when the final label placement intersects them, after endpoint alignment and nudging; a remote tight bend or undefined U-turn tangent does not disable an otherwise valid label. Undefined tangents use one-sided normals only to construct locally bounded invalid intervals. Use binary distance lookup to avoid repeatedly scanning the sampled path. Refresh the curve-control gettext entries and the 2.0 issue changelog entry.

Validation:

  • Full PHP suite: 331 tests, 6,425 assertions passed.
  • Checked and unchecked form regressions reproduce the duplicate-control failure before the fix.
  • Regression reproduces the inward-bend failure using the reported link geometry, with both 9pt and 13pt TrueType fonts. A remote tight-bend regression fails before the interval fix and passes afterward, including reverse traversal and atomic fallback when nudged into the invalid tail. An exact remote-U-turn regression also fails before the fix and passes afterward, covering labels on both sides of the turn, reverse traversal and atomic fallback across the turn. Existing kerning, reverse-direction, endpoint, nudge, tight-bend and configuration round-trip checks pass.
  • Visually verified the corrected label on the reporting installation after a backed-up local deployment, without changing its map configuration.
  • PHP syntax, manifest, gettext-template and whitespace checks passed.

Copilot AI balanced review requested due to automatic review settings October 17, 2026 16:23

Copilot AI left a comment

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.

🟢 Approval recommended

The narrowly scoped removal fixes the duplication and includes focused regression coverage, with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes the duplicated “Follow link curve” checkbox in Map Style so users can clear the setting without changing curve rendering or defaults.

Changes:

  • Removes the duplicate checkbox row.
  • Adds regression cases for checked and unchecked states.
  • Documents the fix in the 2.0 changelog.
File Description
tests/​Unit/​MapStyleDefaultsTest.php Checks control uniqueness and submitted values for both states.
lib/​editor.comment-style.php Removes the duplicate curve control.
CHANGELOG.md Records the Map Style fix.

Review effort: Balanced

@alcatron alcatron changed the title Fix duplicated Follow link curve control in Map Style Fix Follow link curve controls and inward-bend comment rendering Oct 17, 2026
@alcatron
alcatron requested a balanced review from Copilot October 17, 2026 17:00

Copilot AI left a comment

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.

🟡 Changes recommended

A distant reversed baseline segment can still force an otherwise valid curved label into straight-text fallback.

1 open issue

Review effort: Balanced

Comment thread lib/WeatherMapLink.class.php Resolved

Copilot AI left a comment

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.

🔵 Needs a closer look

A remote undefined tangent still forces valid labels to fall back to straight rendering.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Handle zero tangents for comments near remote U-turns

lib/​WeatherMapLink.class.php:403

The reversed-offset interval checks do not cover this earlier unconditional return. For an angled route (0,50) → (1000,50) → (800,50), the samples one pixel before and after the U-turn both lie at (999,50), making $norm zero. A short comment at 10% therefore falls back to straight rendering even though its placement is far from the turn. Handle undefined tangents locally while constructing the baseline, mark their affected intervals invalid, and reject only labels intersecting those intervals after alignment and nudging. Add a remote-U-turn regression and retain atomic fallback for labels crossing the turn.

1 resolved since last review

Review effort: Balanced

@alcatron

Copy link
Copy Markdown
Contributor Author

Addressed the previously missed “Handle zero tangents for comments near remote U-turns” finding. The exact (0,50) → (1000,50) → (800,50) route now keeps a short label at 10% curved. Undefined tangent points receive one-sided construction normals, with nearby samples bounding the invalid region; adjacent intervals are marked invalid and checked only after final label alignment and nudging. Labels crossing the turn still fall back before any glyph is drawn.

The new regression failed before the fix and passes afterward. It also covers a label after the turn and reversed traversal. Full suite: 331 tests / 6,425 assertions passed. PHP syntax, manifest, gettext and whitespace checks passed.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

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.

🔵 Needs a closer look

Offset interpolation at sharp angled corners can place accepted comment baselines inside the arrow body.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Corner normals bleed into straight sections, causing label overlap

lib/​WeatherMapLink.class.php:436

On angled routes, calc_straight() supplies only 12 samples per leg. Interpolating these offset vertices spreads a corner's averaged normal over the adjacent straight section; the extra sampling above handles undefined tangents only, not ordinary sharp corners. For a one-way route (0,0) → (1000,0) → (1000,1000), width 20 and COMMENTPOS 48.5, the baseline starts around (980.9,-19.5) instead of (970,-24), inside the arrow body. A short label can pass all fallback guards there. Keep normal transitions local to sharp joins or construct proper offset joins, and add a regression using calc_straight() that checks clearance before the bend.

Review effort: Balanced

@TheWitness
TheWitness merged commit 6e9e3af into Cacti:develop Oct 17, 2026
2 checks passed
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.

3 participants