Skip to content

Commit

Permalink
fix test snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Aug 2, 2024
1 parent be09c92 commit efe5913
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 147 deletions.
6 changes: 3 additions & 3 deletions src/marks/waffle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {extent, namespaces} from "d3";
import {hasXY, identity, indexOf} from "../options.js";
import {getClipId} from "../style.js";
import {getPatternId} from "../style.js";
import {maybeIdentityX, maybeIdentityY} from "../transforms/identity.js";
import {maybeIntervalX, maybeIntervalY} from "../transforms/interval.js";
import {maybeStackX, maybeStackY} from "../transforms/stack.js";
Expand Down Expand Up @@ -53,7 +53,7 @@ export class WaffleX extends BarX {
const y0 = +rect.getAttribute("y") + wy;
const fill = rect.getAttribute("fill"); // TODO handle constant fill
const stroke = rect.getAttribute("stroke"); // TODO handle constant fill
const patternId = getClipId(); // TODO lazy
const patternId = getPatternId(); // TODO reused shared patterns
const pattern = g.insertBefore(basePattern.cloneNode(true), rect);
const patternRect = pattern.firstChild;
pattern.setAttribute("id", patternId);
Expand Down Expand Up @@ -137,7 +137,7 @@ export class WaffleY extends BarY {
const x0 = +rect.getAttribute("x") + wx;
const fill = rect.getAttribute("fill"); // TODO handle constant fill
const stroke = rect.getAttribute("stroke"); // TODO handle constant fill
const patternId = getClipId(); // TODO lazy
const patternId = getPatternId(); // TODO reused shared patterns
const pattern = g.insertBefore(basePattern.cloneNode(true), rect);
const patternRect = pattern.firstChild;
pattern.setAttribute("id", patternId);
Expand Down
5 changes: 5 additions & 0 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ import {warn} from "./warnings.js";
export const offset = (typeof window !== "undefined" ? window.devicePixelRatio > 1 : typeof it === "undefined") ? 0 : 0.5; // prettier-ignore

let nextClipId = 0;
let nextPatternId = 0;

export function getClipId() {
return `plot-clip-${++nextClipId}`;
}

export function getPatternId() {
return `plot-pattern-${++nextPatternId}`;
}

export function styles(
mark,
{
Expand Down
24 changes: 12 additions & 12 deletions test/output/waffleShorthand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions test/output/waffleShorthandNegative.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit efe5913

Please sign in to comment.