Skip to content

Commit

Permalink
Revert redundant Graph zoom code, only onUpdate handler is enough
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahidullah-Muffakir committed Feb 7, 2024
1 parent 489cd2c commit 08db332
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/store/useGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,14 @@ const useGraph = create<Graph & GraphActions>((set, get) => ({
setZoomFactor: zoomFactor => {
const viewPort = get().viewPort;
viewPort?.camera?.recenter(viewPort.centerX, viewPort.centerY, zoomFactor);
set({ viewPort });
},
zoomIn: () => {
const viewPort = get().viewPort;
viewPort?.camera?.recenter(viewPort.centerX, viewPort.centerY, viewPort.zoomFactor + 0.1);
set({viewPort})
},
zoomOut: () => {
const viewPort = get().viewPort;
viewPort?.camera?.recenter(viewPort.centerX, viewPort.centerY, viewPort.zoomFactor - 0.1);
set({ viewPort });
},
centerView: () => {
const viewPort = get().viewPort;
Expand All @@ -214,7 +211,6 @@ const useGraph = create<Graph & GraphActions>((set, get) => ({
if (canvas) {
viewPort?.camera?.centerFitElementIntoView(canvas);
}
set({ viewPort });
},
toggleFullscreen: fullscreen => set({ fullscreen }),
setViewPort: viewPort => set({ viewPort }),
Expand Down

0 comments on commit 08db332

Please sign in to comment.