Skip to content

Commit

Permalink
Fix: updated exposed pan functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Apr 3, 2024
1 parent 133a680 commit 6e82a0d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/workspace/zoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,27 @@ const zoomOut = () => {
d3Extended.selectById(ids.workspace).transition().call(zoom.scaleBy, 0.9);
};

export const panLeft = (by = 50) => {
d3Extended.selectById(ids.workspace).transition().call(zoom.translateBy, by, 0);
export const panLeft = (by = 50, duration = 250) => {
d3Extended.selectById(ids.workspace).transition().duration(duration).call(zoom.translateBy, by, 0);
};

export const panRight = (by = 50) => {
export const panRight = (by = 50, duration = 250) => {
d3Extended
.selectById(ids.workspace)
.transition()
.duration(duration)
.call(zoom.translateBy, -1 * by, 0);
};

export const panUp = (by = 50) => {
d3Extended.selectById(ids.workspace).transition().call(zoom.translateBy, 0, by);
export const panUp = (by = 50, duration = 250) => {
d3Extended.selectById(ids.workspace).transition().duration(duration).call(zoom.translateBy, 0, by);
};

export const panDown = (by = 50) => {
export const panDown = (by = 50, duration = 250) => {
d3Extended
.selectById(ids.workspace)
.transition()
.duration(duration)
.call(zoom.translateBy, 0, -1 * by);
};

Expand Down

0 comments on commit 6e82a0d

Please sign in to comment.