Skip to content

Commit 2b84d5f

Browse files
authored
symbol ratio to avoid exposing it in the public API (#1163)
1 parent e87ebe5 commit 2b84d5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/projection.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {warn} from "./warnings.js";
2323
const pi = Math.PI;
2424
const tau = 2 * pi;
2525
const golden = 1.618;
26+
const Ratio = Symbol("projection-ratio");
2627

2728
export function Projection(
2829
{
@@ -80,7 +81,7 @@ export function Projection(
8081
let transform;
8182

8283
// If a domain is specified, fit the projection to the frame.
83-
let ratio = projection.ratio;
84+
let ratio = projection[Ratio];
8485
if (domain != null) {
8586
const [[x0, y0], [x1, y1]] = geoPath(projection).bounds(domain);
8687
const k = Math.min(dx / (x1 - x0), dy / (y1 - y0));
@@ -168,7 +169,7 @@ function scaleProjection(createProjection, kx, ky, ratio) {
168169
if (typeof clip === "number") projection.clipAngle?.(clip);
169170
projection.scale(Math.min(width / kx, height / ky));
170171
projection.translate([width / 2, height / 2]);
171-
if (ratio > 0) projection.ratio = ratio;
172+
if (ratio > 0) projection[Ratio] = ratio;
172173
return projection;
173174
};
174175
}

0 commit comments

Comments
 (0)