Skip to content

Commit 417a301

Browse files
committed
refactor(core): add missing viewport helper functions to actions
1 parent 7161e9e commit 417a301

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/core/src/store/actions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,8 @@ export function useActions(
966966
setCenter: (x, y, opts) => viewportHelper.value.setCenter(x, y, opts),
967967
fitBounds: (params, opts) => viewportHelper.value.fitBounds(params, opts),
968968
project: (params) => viewportHelper.value.project(params),
969+
screenToFlowCoordinate: (params) => viewportHelper.value.screenToFlowCoordinate(params),
970+
flowToScreenCoordinate: (params) => viewportHelper.value.flowToScreenCoordinate(params),
969971
toObject,
970972
fromObject,
971973
updateNodeInternals,

packages/core/src/types/store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type {
2525
} from './connection'
2626
import type { DefaultEdgeOptions, Edge, EdgeUpdatable, GraphEdge } from './edge'
2727
import type { CoordinateExtent, CoordinateExtentRange, GraphNode, Node } from './node'
28-
import type { D3Selection, D3Zoom, D3ZoomHandler, PanOnScrollMode, ViewportFunctions, ViewportTransform } from './zoom'
28+
import type { D3Selection, D3Zoom, D3ZoomHandler, PanOnScrollMode, ViewportTransform } from './zoom'
2929
import type { CustomEvent, FlowHooks, FlowHooksEmit, FlowHooksOn } from './hooks'
3030
import type { EdgeChange, NodeChange, NodeDragItem } from './changes'
3131
import type { ConnectingHandle, ValidConnectionFunc } from './handle'
@@ -218,7 +218,7 @@ export type UpdateNodeData = <Data = ElementData, CustomEvents extends Record<st
218218

219219
export type IsNodeIntersecting = (node: (Partial<Node> & { id: Node['id'] }) | Rect, area: Rect, partially?: boolean) => boolean
220220

221-
export interface Actions extends ViewportFunctions {
221+
export interface Actions extends Omit<ViewportHelper, 'viewportInitialized'> {
222222
/** parses elements (nodes + edges) and re-sets the state */
223223
setElements: SetElements
224224
/** parses nodes and re-sets the state */

0 commit comments

Comments
 (0)