Skip to content

Allow link comments to follow link curves - #309

Merged
TheWitness merged 9 commits into
Cacti:developfrom
alcatron:feat/curved-link-comments-20261016
Oct 17, 2026
Merged

TheWitness merged 9 commits into
Cacti:developfrom
alcatron:feat/curved-link-comments-20261016

Conversation

@alcatron

@alcatron alcatron commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add COMMENTCURVE and a Follow link curve option under Map Style → Link Defaults. TrueType comments follow the link spine, retaining existing position, colour and font settings. Unsuitable geometry, unsupported fonts and labels that do not fit fall back to straight text.

Curved comments default on; explicit COMMENTCURVE 0 remains supported.

Related work

Extends the existing link-comment controls; separate from the properties-layout changes.

Validation

PHP 8.3 isolated Cacti-layout fixture: 293 tests / 5,956 assertions, including curved geometry, fallback rendering and config round trips. PHP/JavaScript syntax, whitespace and release manifest checks pass.

Coverage was not measured in this local run; current CI and review results must be checked separately.

Curved glyph origins preserve pair kerning, and offset geometry with reversed signed progress falls back before drawing. The TrueType pair regression fails against the previous renderer; kerning, offset reversal, endpoint alignment, nudge direction and configuration round trips pass.

Curved layout also falls back before inward offsets compress the kerned glyph spacing. Shared quarter-circle setup keeps the normal/reversed, overlap and reverse-progress regressions consistent.

Release notes for this change are consolidated in #314 under Weathermap 2.0 (security fixes, issue fixes, then features).

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

Default-on rendering changes existing comment alignment and reverses along-link nudges on right-to-left links.

2 open findings
What changed in this PR

Adds default-on curved link comments to the map renderer and editor, with straight-text fallbacks.

Changes:

  • Adds COMMENTCURVE parsing, persistence, and rendering.
  • Exposes a “Follow link curve” option in Map Style.
  • Adds tests, documentation, and translation strings.
File Description
tests/​Unit/​CurvedLinkCommentTest.php Tests rendering, fallbacks, and configuration round trips.
locales/​po/​cacti.pot Adds editor translation strings.
lib/​WeatherMapLink.class.php Implements curved rendering and setting persistence.
lib/​WeatherMap.keywords.inc.php Registers COMMENTCURVE.
lib/​WeatherMap.class.php Parses COMMENTCURVE.
lib/​editor.comment-style.php Adds the checkbox and default-setting updates.
lib/​editor.actions.php Saves the curve preference.
docs/​pages/​config-reference.html Documents the option and fallbacks.
CHANGELOG.md Records the feature.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/WeatherMapLink.class.php Outdated
Comment thread lib/WeatherMapLink.class.php Outdated

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

Default-on rendering has unresolved correctness issues and needs human integration validation in a supported Cacti/GD environment.

0 open findings

2 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Fix glyph origins for kerning-aware curved text

lib/​WeatherMapLink.class.php:374

The prefix delta includes kerning between the previous and current glyph, but storing the previous $length as the current glyph's origin applies that adjustment to its advance instead of its position. For a negatively kerned pair such as AV, the second glyph starts too far right; drawing it separately cannot restore the pair's kerning. This changes spacing even on straight links because curved rendering defaults on. Derive each origin from the kerned prefix end minus the glyph's independent advance, and add a kerned-pair regression.

Medium severity Reject reverse glyph progress and fall back before drawing

lib/​WeatherMapLink.class.php:415

The unsigned spacing check accepts offset curves that run backwards. On a sampled 20px-radius inward bend with width 7, comment_nudgeout=40, and three 8px glyph advances, both geometry guards pass, but successive glyph centers move opposite their baseline direction. This can render unreadable text instead of falling back. Reject nonpositive signed progress after applying the normal offset, and add a regression that verifies fallback before any glyph is drawn.

🧠 Review effort: Balanced

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@alcatron

Copy link
Copy Markdown
Contributor Author

Rechecked the current PR and pushed the review repairs. Curved glyph origins preserve pair kerning, and offset geometry with reversed signed progress falls back before drawing. The TrueType pair regression fails against the previous renderer; kerning, offset reversal, endpoint alignment, nudge direction and configuration round trips pass.

Validation: 293 tests / 5,954 assertions, plus the focused checks described above. New regression cases reproduce the relevant defects against the preceding code. These PR changes have not been installed on the live server. CI results are still separate from local validation.

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

Default-on rendering needs correction for confirmed glyph overlap and human visual validation before approval.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Prevent glyph overlap when curved text spacing is compressed

lib/​WeatherMapLink.class.php:419

The 0.65 spacing threshold accepts inward offsets that make glyphs overlap. On a sampled 40px-radius quarter-circle with a 13px inward offset, Vera 13pt MM at COMMENTPOS 20 passes these checks: its roughly 15px advances become 10.07px between baseline centers, above the 9.75px cutoff, but the transformed glyph outlines intersect. Because curved comments default on, existing readable labels can become illegible. Account for glyph extents on the offset curve, or conservatively fall back before drawing when curvature compresses the text too far. Add a regression for overlapping glyphs, not just reversed progress.

Review effort: Balanced

@alcatron

alcatron commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the latest summary-only overlap finding in 940c695. Curved layout conservatively falls back before drawing when the offset compresses the existing kerned baseline spacing, preserving the existing reverse-progress guard. The radius-40, inward-offset-13 Vera 13pt MM regression reproduces acceptance before the fix and now falls back atomically. The normal curved, AV kerning, reversed-spine and endpoint/nudge cases still pass. Full PHP suite: 293 tests / 5,956 assertions. Human visual review remains useful for the default-on rendering change.

These repairs update the PR branch only; the live server has not been changed. New GitHub checks are separate from the passing local validation.

Follow-up 29c7bda shares the quarter-circle fixture setup to remove the duplicated test blocks flagged by the quality gate. The rendering regression passes again with all 61 assertions.

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

Default-on rendering changes warrant human visual validation in Cacti and confirmation of current CI results.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Use request helper instead of direct $_POST inspection

lib/​editor.actions.php:616

Please use isset_request_var('mapstyle_commentcurve') instead of inspecting $_POST directly. The other checkbox handlers in this file (lines 1006–1008) use Cacti's request helper, which keeps presence checks and value retrieval within the same request abstraction.

Review effort: Balanced

@alcatron

Copy link
Copy Markdown
Contributor Author

Addressed the latest summary suggestion in 5905a60: the curve checkbox now uses isset_request_var(), matching Cacti’s request abstraction. Full local PHP suite passes: 293 tests / 5,956 assertions. Copilot reports no remaining code issues in #308, but still requests human Safari/dialog confirmation; the default-on renderer likewise merits human visual review.

These changes update the PR branch only; the live server is unchanged. GitHub CI results remain separate from local validation.

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

Default-on glyph rendering needs human visual verification and confirmation of current CI results.

No open issues 🎉

Review effort: Balanced

@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit 0f6d90e into Cacti:develop Oct 17, 2026
2 checks passed
TheWitness pushed a commit that referenced this pull request Oct 17, 2026
* Allow link comments to follow link curves

* Clarify link workflows and add node display-name positioning

* Reference PR #309 in changelog

* Reference PR #311 in changelog

* Preserve translation template project metadata

* Preserve translation template project metadata

* Preserve curved comment alignment and nudge direction

* Preserve configured hover previews when opening properties

* Preserve curved glyph kerning and reject reversed offset text

* Preserve traffic identity and hover settings in link properties

* Parse traffic scaling without ambiguous numeric repetition

* Fall back before inward curvature compresses glyph spacing

* Honor outer source multipliers and label visible graph pickers

* Share quarter-circle geometry in rendering regressions

* Use the Cacti request helper for the curve checkbox

* Resolve Cacti RRA identities and bound editor label presets

* Cover both graph-picker JSON request signatures in the fixture
TheWitness pushed a commit that referenced this pull request Oct 17, 2026
* Allow link comments to follow link curves

* Use 1000M as the inherited link bandwidth default

* Clarify link workflows and add node display-name positioning

* Make hover graphs clickable and sharper on high-density displays

* Bundle additional 96px network-device node icons

* Prepare Weathermap 2.0 identification and release notes

* Reference PR #309 in changelog

* Reference PR #310 in changelog

* Reference PR #311 in changelog

* Reference PR #312 in changelog

* Reference PR #313 in changelog

* Reference PR #314 in changelog

* Preserve translation template project metadata

* Preserve translation template project metadata

* Preserve translation template project metadata

* Preserve translation template project metadata

* Preserve translation template project metadata

* Use established changelog categories throughout 2.0-dev

* Preserve Cacti graph layout after Weathermap navigation

* Fix traffic glow masking around transparent node icons

* Preserve curved comment alignment and nudge direction

* Set plugin working directory in bandwidth regression test

* Preserve configured hover previews when opening properties

* Fix hover density caching and keyboard interaction

* Preserve curved glyph kerning and reject reversed offset text

* Add the required license notice to bandwidth regression

* Preserve traffic identity and hover settings in link properties

* Keep mixed-input previews open and protect sharp note text

* Parse traffic scaling without ambiguous numeric repetition

* Fall back before inward curvature compresses glyph spacing

* Honor outer source multipliers and label visible graph pickers

* Complete tooltip blur dismissal and keyboard re-entry

* Share quarter-circle geometry in rendering regressions

* Use the Cacti request helper for the curve checkbox

* Resolve Cacti RRA identities and bound editor label presets

* Ignore stale tooltip events and quoted zoom text

* Add two-step Undo and Redo to the map editor

* Use PHP-generated sessions in editor history tests

* Isolate duplicated tabs and enforce undo history expiry and quota

* Cancel pending hover opens and recognize RRDtool continuations

* Import the history worker directly in browser regression tests

* Preserve history for unchanged forms and enforce JSON storage quota

* Keep undo history when raw configuration dialogs are unchanged

* Preserve untouched colour history and validate included restore assets

* Gate startup saves and preserve scale order and restored title cache

* Cover both graph-picker JSON request signatures in the fixture
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