feat: Make edges work

This commit is contained in:
Braks
2021-07-09 13:39:17 +02:00
parent 52e1188d04
commit b2c250ef38
10 changed files with 183 additions and 99 deletions
+3 -4
View File
@@ -1,7 +1,6 @@
import { zoomIdentity } from 'd3-zoom';
import { getRectOfNodes, pointToRendererPoint, getTransformForBounds } from '../utils/graph';
import { FitViewParams, FlowTransform, ZoomPanHelperFunctions, Rect, XYPosition } from '../types';
import { computed } from 'vue';
import store from '../store';
const DEFAULT_PADDING = 0.1;
@@ -20,7 +19,7 @@ const initialZoomPanHelper: ZoomPanHelperFunctions = {
const useZoomPanHelper = (): ZoomPanHelperFunctions => {
const pinia = store();
const zoomPanHelperFunctions = computed<ZoomPanHelperFunctions>(() => {
const zoomPanHelperFunctions = () => {
if (pinia.d3Selection && pinia.d3Zoom) {
return {
zoomIn: () => pinia.d3Zoom?.scaleBy(pinia.d3Selection as any, 1.2),
@@ -77,9 +76,9 @@ const useZoomPanHelper = (): ZoomPanHelperFunctions => {
}
return initialZoomPanHelper;
});
};
return zoomPanHelperFunctions.value;
return zoomPanHelperFunctions();
};
export default useZoomPanHelper;