chore(resizer): cleanup

This commit is contained in:
moklick
2025-06-11 10:44:59 +02:00
parent ec3ef27c90
commit 120a12baf4
3 changed files with 11 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ function ResizeControl({
maxHeight = Number.MAX_VALUE,
keepAspectRatio = false,
resizeDirection,
scaleControls = false,
autoScale = true,
shouldResize,
onResizeStart,
onResize,
@@ -55,7 +55,10 @@ function ResizeControl({
const store = useStoreApi();
const resizeControlRef = useRef<HTMLDivElement>(null);
const isHandleControl = variant === ResizeControlVariant.Handle;
const scale = useStore(useCallback(scaleSelector(isHandleControl && !scaleControls), [isHandleControl]), shallow);
const scale = useStore(
useCallback(scaleSelector(isHandleControl && autoScale), [isHandleControl, autoScale]),
shallow
);
const resizer = useRef<XYResizerInstance | null>(null);
const controlPosition = position ?? defaultPositions[variant];

View File

@@ -40,7 +40,7 @@ export function NodeResizer({
maxWidth = Number.MAX_VALUE,
maxHeight = Number.MAX_VALUE,
keepAspectRatio = false,
scaleControls = false,
autoScale = true,
shouldResize,
onResizeStart,
onResize,
@@ -67,7 +67,7 @@ export function NodeResizer({
maxHeight={maxHeight}
onResizeStart={onResizeStart}
keepAspectRatio={keepAspectRatio}
scaleControls={scaleControls}
autoScale={autoScale}
shouldResize={shouldResize}
onResize={onResize}
onResizeEnd={onResizeEnd}
@@ -87,7 +87,7 @@ export function NodeResizer({
maxHeight={maxHeight}
onResizeStart={onResizeStart}
keepAspectRatio={keepAspectRatio}
scaleControls={scaleControls}
autoScale={autoScale}
shouldResize={shouldResize}
onResize={onResize}
onResizeEnd={onResizeEnd}

View File

@@ -61,9 +61,9 @@ export type NodeResizerProps = {
keepAspectRatio?: boolean;
/**
* Scale the controls with the zoom level.
* @default false
* @default true
*/
scaleControls?: boolean;
autoScale?: boolean;
/** Callback to determine if node should resize. */
shouldResize?: ShouldResize;
/** Callback called when resizing starts. */
@@ -87,7 +87,7 @@ export type ResizeControlProps = Pick<
| 'maxHeight'
| 'keepAspectRatio'
| 'shouldResize'
| 'scaleControls'
| 'autoScale'
| 'onResizeStart'
| 'onResize'
| 'onResizeEnd'