cleaned up naming
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { useRef, useEffect, memo } from 'react';
|
import { useRef, useEffect, memo } from 'react';
|
||||||
import cc from 'classcat';
|
import cc from 'classcat';
|
||||||
import { XYResizerInstance, XYResizer, XYResizeChange } from '@xyflow/system';
|
import { XYResizer, ResizerControlVariant, type XYResizerInstance, type XYResizerChange } from '@xyflow/system';
|
||||||
import { ResizerControlVariant } from '@xyflow/system';
|
|
||||||
import { useStoreApi } from '../../hooks/useStore';
|
import { useStoreApi } from '../../hooks/useStore';
|
||||||
import { useNodeId } from '../../contexts/NodeIdContext';
|
import { useNodeId } from '../../contexts/NodeIdContext';
|
||||||
import type { NodeChange, NodeDimensionChange, NodePositionChange } from '../../types';
|
import type { NodeChange, NodeDimensionChange, NodePositionChange } from '../../types';
|
||||||
@@ -52,7 +51,7 @@ function ResizeControl({
|
|||||||
snapToGrid,
|
snapToGrid,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onChange: (change: XYResizeChange) => {
|
onChange: (change: XYResizerChange) => {
|
||||||
const { triggerNodeChanges } = store.getState();
|
const { triggerNodeChanges } = store.getState();
|
||||||
|
|
||||||
const changes: NodeChange[] = [];
|
const changes: NodeChange[] = [];
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext, onMount } from 'svelte';
|
import { getContext, onMount } from 'svelte';
|
||||||
import cc from 'classcat';
|
import cc from 'classcat';
|
||||||
import type { ResizeControlProps } from './types';
|
import { useStore } from '$lib/store';
|
||||||
import {
|
import {
|
||||||
|
XYResizer,
|
||||||
ResizerControlVariant,
|
ResizerControlVariant,
|
||||||
type XYResizerControlPosition,
|
type XYResizerControlPosition,
|
||||||
type XYResizerInstance,
|
type XYResizerInstance,
|
||||||
XYResizer,
|
type XYResizerChange
|
||||||
type XYResizeChange
|
|
||||||
} from '@xyflow/system';
|
} from '@xyflow/system';
|
||||||
import { useStore } from '$lib/store';
|
import type { ResizeControlProps } from './types';
|
||||||
|
|
||||||
type $$Props = ResizeControlProps;
|
type $$Props = ResizeControlProps;
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
snapToGrid: !!$snapGrid
|
snapToGrid: !!$snapGrid
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onChange: (change: XYResizeChange) => {
|
onChange: (change: XYResizerChange) => {
|
||||||
const node = $nodeLookup.get(id);
|
const node = $nodeLookup.get(id);
|
||||||
if (node) {
|
if (node) {
|
||||||
node.height = change.isHeightChange ? change.height : node.height;
|
node.height = change.isHeightChange ? change.height : node.height;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const initChange = {
|
|||||||
isHeightChange: false,
|
isHeightChange: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type XYResizeChange = {
|
export type XYResizerChange = {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
width: number;
|
width: number;
|
||||||
@@ -46,7 +46,7 @@ type XYResizerParams = {
|
|||||||
snapGrid?: [number, number];
|
snapGrid?: [number, number];
|
||||||
snapToGrid: boolean;
|
snapToGrid: boolean;
|
||||||
};
|
};
|
||||||
onChange: (changes: XYResizeChange) => void;
|
onChange: (changes: XYResizerChange) => void;
|
||||||
onEnd?: () => void;
|
onEnd?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user