feat(node-resizer): add direction, cleanup types
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { memo, FC } from 'react';
|
||||
import { Handle, Position, NodeProps } from 'reactflow';
|
||||
|
||||
import { NodeResizeControl, ResizeDragEvent, ResizeEventParams } from '@reactflow/node-resizer';
|
||||
import { NodeResizeControl, OnResize, OnBeforeResize } from '@reactflow/node-resizer';
|
||||
import '@reactflow/node-resizer/dist/style.css';
|
||||
|
||||
const onBeforeResize = (event: ResizeDragEvent, params: ResizeEventParams) => {
|
||||
const onBeforeResize: OnBeforeResize = (event, params) => {
|
||||
console.log('before resize', params);
|
||||
|
||||
if (params.width > 100) {
|
||||
@@ -12,8 +12,8 @@ const onBeforeResize = (event: ResizeDragEvent, params: ResizeEventParams) => {
|
||||
}
|
||||
};
|
||||
|
||||
const onResize = (event: ResizeDragEvent, params: ResizeEventParams) => {
|
||||
console.log('resize', params);
|
||||
const onResize: OnResize = (event, params) => {
|
||||
console.log('resize', params.direction);
|
||||
};
|
||||
|
||||
const CustomNode: FC<NodeProps> = ({ id, data }) => {
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { memo, FC } from 'react';
|
||||
import { Handle, Position, NodeProps } from 'reactflow';
|
||||
|
||||
import { NodeResizer, ResizeDragEvent, ResizeEventParams } from '@reactflow/node-resizer';
|
||||
import { NodeResizer, OnBeforeResize, OnResize, OnResizeEnd, OnResizeStart } from '@reactflow/node-resizer';
|
||||
import '@reactflow/node-resizer/dist/style.css';
|
||||
|
||||
const onResizeStart = (_: ResizeDragEvent, params: ResizeEventParams) => {
|
||||
const onResizeStart: OnResizeStart = (_, params) => {
|
||||
console.log('resize start', params);
|
||||
};
|
||||
|
||||
const onBeforeResize = (_: ResizeDragEvent, params: ResizeEventParams) => {
|
||||
const onBeforeResize: OnBeforeResize = (_, params) => {
|
||||
console.log('before resize', params);
|
||||
};
|
||||
|
||||
const onResize = (_: ResizeDragEvent, params: ResizeEventParams) => {
|
||||
const onResize: OnResize = (_, params) => {
|
||||
console.log('resize', params);
|
||||
};
|
||||
|
||||
const onResizeEnd = (_: ResizeDragEvent, params: ResizeEventParams) => {
|
||||
const onResizeEnd: OnResizeEnd = (_, params) => {
|
||||
console.log('resize end', params);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user