refactor(core): add missing viewport helper functions to actions

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 7161e9ec90
commit 417a301b42
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -966,6 +966,8 @@ export function useActions(
setCenter: (x, y, opts) => viewportHelper.value.setCenter(x, y, opts),
fitBounds: (params, opts) => viewportHelper.value.fitBounds(params, opts),
project: (params) => viewportHelper.value.project(params),
screenToFlowCoordinate: (params) => viewportHelper.value.screenToFlowCoordinate(params),
flowToScreenCoordinate: (params) => viewportHelper.value.flowToScreenCoordinate(params),
toObject,
fromObject,
updateNodeInternals,
+2 -2
View File
@@ -25,7 +25,7 @@ import type {
} from './connection'
import type { DefaultEdgeOptions, Edge, EdgeUpdatable, GraphEdge } from './edge'
import type { CoordinateExtent, CoordinateExtentRange, GraphNode, Node } from './node'
import type { D3Selection, D3Zoom, D3ZoomHandler, PanOnScrollMode, ViewportFunctions, ViewportTransform } from './zoom'
import type { D3Selection, D3Zoom, D3ZoomHandler, PanOnScrollMode, ViewportTransform } from './zoom'
import type { CustomEvent, FlowHooks, FlowHooksEmit, FlowHooksOn } from './hooks'
import type { EdgeChange, NodeChange, NodeDragItem } from './changes'
import type { ConnectingHandle, ValidConnectionFunc } from './handle'
@@ -218,7 +218,7 @@ export type UpdateNodeData = <Data = ElementData, CustomEvents extends Record<st
export type IsNodeIntersecting = (node: (Partial<Node> & { id: Node['id'] }) | Rect, area: Rect, partially?: boolean) => boolean
export interface Actions extends ViewportFunctions {
export interface Actions extends Omit<ViewportHelper, 'viewportInitialized'> {
/** parses elements (nodes + edges) and re-sets the state */
setElements: SetElements
/** parses nodes and re-sets the state */