chore(resizer): cleanup
This commit is contained in:
@@ -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];
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user