Skip to content

Commit

Permalink
clip: {type: "Sphere"} is equal to clip: "sphere"
Browse files Browse the repository at this point in the history
tested in armadillo, by having two marks with these different clip values sharing the same clip-path
  • Loading branch information
Fil committed Nov 22, 2024
1 parent b263074 commit 63c8b53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ export function maybeNamed(things) {
export function maybeClip(clip) {
if (clip === true) clip = "frame";
else if (clip === false) clip = null;
else if (clip != null && !isGeoJSON(clip)) clip = keyword(clip, "clip", ["frame", "sphere"]);
else if (isGeoJSON(clip)) {
if (clip.type === "Sphere") clip = "sphere";
} else if (clip != null) clip = keyword(clip, "clip", ["frame", "sphere"]);
return clip;
}

Expand Down
6 changes: 5 additions & 1 deletion test/plots/armadillo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export async function armadillo() {
height: 548,
margin: 1,
projection: ({width, height}) => geoArmadillo().precision(0.2).fitSize([width, height], {type: "Sphere"}),
marks: [Plot.geo(land, {clip: "sphere", fill: "currentColor"}), Plot.graticule({clip: "sphere"}), Plot.sphere()]
marks: [
Plot.geo(land, {clip: "sphere", fill: "currentColor"}),
Plot.graticule({clip: {type: "Sphere"}}),
Plot.sphere()
]
});
}

0 comments on commit 63c8b53

Please sign in to comment.