Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] hasPan, hasZoom, and hasPanAndZoom had no effect #126

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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