perf(nad): expose geometryPrecision as a viewer parameter#10
Draft
gautierbureau wants to merge 1 commit into
Draft
Conversation
Forward the SVG-writer geometryPrecision option through the viewer so consumers can set it once via NadViewerParametersOptions instead of constructing the writer themselves. NadViewerParameters.getGeometryPrecision() returns the configured value or undefined, and both new SvgWriter(...) call sites in the viewer (initial empty-SVG build and adaptive-zoom redraw) pass it through. Undefined leaves the writer on its default precision (2), so behaviour is unchanged unless a consumer opts in. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T1fMV9gtgHLBKoSAShYSdA
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.
Context
Follow-up to the geometry-precision PR (#8), and based on its branch (
claude/perf-nad-writer-geometry-precision) — not on the powsybl#423 base — because it consumes thegeometryPrecisionwriter option that #8 introduces. Review/merge #8 first.What
#8 added
geometryPrecisionto the SVG-writer options but left the viewer to pass it. This PR does that end-to-end wiring so a consumer can set it once through the public viewer parameters:geometryPrecision?: numbertoNadViewerParametersOptions(already exported, so it's public).NadViewerParameters.getGeometryPrecision()returns the configured value orundefined.new SvgWriter(...)sites innetwork-area-diagram-viewer.ts— the initial empty-SVG build and the adaptive-zoom redraw — forward it.undefinedleaves the writer on its default precision (2), so behaviour is unchanged unless a consumer opts in. The getter returnsundefinedrather than a hard-coded 2 to avoid duplicating the default (and a circular import withdiagram-utils); the writer owns the default.Measured impact
This PR is pure plumbing — a single optional-field read per writer construction, no runtime cost of its own. Its value is making #8's savings reachable through the public viewer API. The payoff is #8's, measured on
case1354pegase:geometryPrecision(Full raw+gzip table and methodology in #8.)
Tests
getGeometryPrecisionreturnsundefinedwhen unset (bothundefinedand{}options) and the configured value otherwise.Draft; its base is #8's branch. Once #8 merges into
integration/nad_create_svg_adaptive_zoom, retarget this PR's base to that branch.🤖 Generated with Claude Code