Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
fix: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
haxxmaxx committed Feb 14, 2020
1 parent 969e4ba commit 85933ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ export default function supernova(env) {
useTransitions: expandedState.useTransitions,
});
}
}, [expandedState, objectData, selectionState]);
}, [expandedState, objectData, selectionState, constraints]);

useEffect(() => {
if (objectData && layout.navigationMode === 'free') {
setZooming(objectData, constraints);
setZooming(objectData, !constraints.active);
}
}, [objectData, constraints]);

Expand Down
2 changes: 1 addition & 1 deletion src/tree/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const paintTree = ({
setStateCallback,
selectionState,
selections,
!constraints.active
!constraints.active,
);
// Create the lines (links) between the nodes
const node = svg
Expand Down
4 changes: 2 additions & 2 deletions src/tree/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ export function applyTransform(eventTransform, svg, divBox, width, height) {
);
}

export function setZooming(objectData, constraints) {
export function setZooming(objectData, allowInteractions) {
const { svg, divBox, width, height, element, allNodes } = objectData;
const maxZoom = 6;
const minZoom = 0.2;
const scaleFactor = Math.max(Math.min(maxZoom, allNodes.zoomFactor), minZoom);

const zoomed = () => {
if (constraints.active) {
if (allowInteractions) {
applyTransform(
zoomIdentity.translate(event.transform.x, event.transform.y).scale(event.transform.k / scaleFactor),
svg,
Expand Down

0 comments on commit 85933ea

Please sign in to comment.