Skip to content

Commit

Permalink
fix: twice shift [X|Y]
Browse files Browse the repository at this point in the history
  • Loading branch information
jobo322 committed Nov 8, 2023
1 parent 620b6dc commit ae92541
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/component/2d/ft/Contours.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,15 @@ function usePath(
) {
const scaleX = useScale2DX();
const scaleY = useScale2DY();
const shift = getShift(spectrum);

const pathBuilder = new PathBuilder();
for (const element of contours) {
if (element.lines) {
const lines = element.lines;
if (lines.length < 1e6) {
for (let i = 0; i < lines.length; i += 4) {
pathBuilder.moveTo(
scaleX(lines[i] + shift.x),
scaleY(lines[i + 1] + shift.y),
);
pathBuilder.lineTo(
scaleX(lines[i + 2] + shift.x),
scaleY(lines[i + 3] + shift.y),
);
pathBuilder.moveTo(scaleX(lines[i]), scaleY(lines[i + 1]));
pathBuilder.lineTo(scaleX(lines[i + 2]), scaleY(lines[i + 3]));
}
}
}
Expand Down

0 comments on commit ae92541

Please sign in to comment.