Skip to content

Commit

Permalink
The order of code prevented hasZoom and hasPan from being respected (#…
Browse files Browse the repository at this point in the history
…126)

Co-authored-by: Justin White <juwhite@pavlovmedia.com>
  • Loading branch information
kyjus25 and Justin White authored Oct 22, 2023
1 parent ec7afe7 commit 3eb6516
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/treeviz/src/initializeSVG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export const initiliazeSVG = (treeConfig: ITreeConfig) => {
.attr("width", areaWidth)
.attr("height", areaHeight);

// Create a G container and move it according to the Zoom Behavior attached to the main <svg> element
const ZoomContainer = svg.append("g");
const zoom = d3.zoom().on("zoom", (e) => {
ZoomContainer.attr("transform", () => e.transform);
});
// @ts-ignore
svg.call(zoom);

const [allowHasPan, allowHasZoom] = getHasPanAndZoom(
hasPanAndZoom,
hasPan,
Expand All @@ -58,14 +66,6 @@ export const initiliazeSVG = (treeConfig: ITreeConfig) => {
.on("dblclick.zoom", null);
}

// Create a G container and move it according to the Zoom Behavior attached to the main <svg> element
const ZoomContainer = svg.append("g");
const zoom = d3.zoom().on("zoom", (e) => {
ZoomContainer.attr("transform", () => e.transform);
});
// @ts-ignore
svg.call(zoom);

const MainG = ZoomContainer.append("g").attr(
"transform",
mainAxisNodeSpacing === "auto"
Expand Down

0 comments on commit 3eb6516

Please sign in to comment.