Skip to content

Commit 6924323

Browse files
author
Becca Bailey
authored
Merge pull request #2179 from TabithaMaudMM/main
Fix Horizontal charts panning at the incorrect rate
2 parents a889a03 + f705be4 commit 6924323

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/victory-zoom-container/src/zoom-helpers.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,11 @@ const RawZoomHelpers = {
138138
? newDomain.map((val) => new Date(val))
139139
: newDomain;
140140
},
141-
// eslint-disable-next-line max-params
142-
getDomainScale(domain, scale, axis, horizontal) {
141+
142+
getDomainScale(domain, scale, axis) {
143143
const axisDomain = Array.isArray(domain) ? domain : domain[axis];
144144
const [from, to] = axisDomain;
145-
const otherAxis = axis === "x" ? "y" : "x";
146-
const range = horizontal ? scale[otherAxis].range() : scale[axis].range();
145+
const range = scale[axis].range();
147146
const plottableWidth = Math.abs(range[0] - range[1]);
148147
return plottableWidth / (to - from);
149148
},
@@ -260,10 +259,8 @@ const RawZoomHelpers = {
260259
const lastDomain = this.getLastDomain(targetProps, originalDomain);
261260
const deltaX = horizontal ? y - startY : startX - x;
262261
const deltaY = horizontal ? startX - x : y - startY;
263-
const dx =
264-
deltaX / this.getDomainScale(lastDomain, scale, "x", horizontal);
265-
const dy =
266-
deltaY / this.getDomainScale(lastDomain, scale, "y", horizontal);
262+
const dx = deltaX / this.getDomainScale(lastDomain, scale, "x");
263+
const dy = deltaY / this.getDomainScale(lastDomain, scale, "y");
267264
const currentDomain = {
268265
x:
269266
zoomDimension === "y"

0 commit comments

Comments
 (0)