Skip to content

Commit 33a3ea1

Browse files
authored
setOffset for tests (#2376)
1 parent 530d063 commit 33a3ea1

6 files changed

Lines changed: 783 additions & 2 deletions

File tree

src/legends/ramp.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {inferFontVariant} from "../axes.js";
33
import {createContext, create} from "../context.js";
44
import {map, maybeNumberChannel} from "../options.js";
55
import {interpolatePiecewise} from "../scales/quantitative.js";
6-
import {applyInlineStyles, impliedString, maybeClassName} from "../style.js";
6+
import {applyInlineStyles, impliedString, maybeClassName, offset} from "../style.js";
77

88
export function legendRamp(color, options) {
99
let {
@@ -164,6 +164,7 @@ export function legendRamp(color, options) {
164164
.tickFormat(typeof tickFormat === "function" ? tickFormat : undefined)
165165
.tickSize(tickSize)
166166
.tickValues(Array.isArray(ticks) ? ticks : null)
167+
.offset(offset)
167168
)
168169
.attr("font-size", null)
169170
.attr("font-family", null)

src/style.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import {isNone, isNoneish, isRound, maybeColorChannel, maybeNumberChannel} from
66
import {keyof, number, string} from "./options.js";
77
import {warn} from "./warnings.js";
88

9-
export const offset = (typeof window !== "undefined" ? window.devicePixelRatio > 1 : typeof it === "undefined") ? 0 : 0.5; // prettier-ignore
9+
export let offset = typeof window === "undefined" || window.devicePixelRatio > 1 ? 0 : 0.5;
10+
11+
export function setOffset(o) {
12+
offset = o;
13+
}
1014

1115
let nextClipId = 0;
1216
let nextPatternId = 0;

0 commit comments

Comments
 (0)