refactor(resizer): correct typo
This commit is contained in:
@@ -98,7 +98,7 @@ function ResizeControl({
|
||||
|
||||
resizer.current.update({
|
||||
controlPosition,
|
||||
boundries: {
|
||||
boundaries: {
|
||||
minWidth,
|
||||
minHeight,
|
||||
maxWidth,
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
$: {
|
||||
resizer?.update({
|
||||
controlPosition,
|
||||
boundries: {
|
||||
boundaries: {
|
||||
minWidth: _minWidth,
|
||||
minHeight: _minHeight,
|
||||
maxWidth: _maxWidth,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { drag } from 'd3-drag';
|
||||
import { select } from 'd3-selection';
|
||||
|
||||
import { NodeLookup, Transform } from '../types';
|
||||
import { OnResize, OnResizeEnd, OnResizeStart, ResizeDragEvent, ShouldResize, ControlPosition } from './types';
|
||||
import { getControlDirection, getDimensionsAfterResize, getPositionAfterResize, getResizeDirection } from './utils';
|
||||
import { getPointerPosition } from '../utils';
|
||||
import type { NodeLookup, Transform } from '../types';
|
||||
import type { OnResize, OnResizeEnd, OnResizeStart, ResizeDragEvent, ShouldResize, ControlPosition } from './types';
|
||||
|
||||
const initPrevValues = { width: 0, height: 0, x: 0, y: 0 };
|
||||
|
||||
@@ -43,7 +43,7 @@ type XYResizerParams = {
|
||||
|
||||
type XYResizerUpdateParams = {
|
||||
controlPosition: ControlPosition;
|
||||
boundries: {
|
||||
boundaries: {
|
||||
minWidth: number;
|
||||
minHeight: number;
|
||||
maxWidth: number;
|
||||
@@ -66,7 +66,7 @@ export function XYResizer({ domNode, nodeId, getStoreItems, onChange }: XYResize
|
||||
|
||||
function update({
|
||||
controlPosition,
|
||||
boundries,
|
||||
boundaries,
|
||||
keepAspectRatio,
|
||||
onResizeStart,
|
||||
onResize,
|
||||
@@ -114,7 +114,7 @@ export function XYResizer({ domNode, nodeId, getStoreItems, onChange }: XYResize
|
||||
startValues,
|
||||
controlDirection,
|
||||
pointerPosition,
|
||||
boundries,
|
||||
boundaries,
|
||||
keepAspectRatio
|
||||
);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ type StartValues = PrevValues & {
|
||||
* @param startValues - starting values of resize
|
||||
* @param controlDirection - dimensions affected by the resize
|
||||
* @param pointerPosition - the current pointer position corrected for snapping
|
||||
* @param boundries - maximum and minimum dimensions of the node
|
||||
* @param boundaries - minimum and maximum dimensions of the node
|
||||
* @param keepAspectRatio - prevent changes of asprect ratio
|
||||
* @returns width: new width of node, height: new height of node
|
||||
*/
|
||||
@@ -88,12 +88,12 @@ export function getDimensionsAfterResize(
|
||||
startValues: StartValues,
|
||||
controlDirection: ReturnType<typeof getControlDirection>,
|
||||
pointerPosition: ReturnType<typeof getPointerPosition>,
|
||||
boundries: { minWidth: number; maxWidth: number; minHeight: number; maxHeight: number },
|
||||
boundaries: { minWidth: number; maxWidth: number; minHeight: number; maxHeight: number },
|
||||
keepAspectRatio: boolean
|
||||
) {
|
||||
const { isHorizontal, isVertical, affectsX, affectsY } = controlDirection;
|
||||
const { xSnapped, ySnapped } = pointerPosition;
|
||||
const { minWidth, maxWidth, minHeight, maxHeight } = boundries;
|
||||
const { minWidth, maxWidth, minHeight, maxHeight } = boundaries;
|
||||
|
||||
const { pointerX: startX, pointerY: startY, width: startWidth, height: startHeight, aspectRatio } = startValues;
|
||||
const distX = Math.floor(isHorizontal ? xSnapped - startX : 0);
|
||||
@@ -148,7 +148,8 @@ export function getPositionAfterResize(
|
||||
width: number,
|
||||
height: number
|
||||
) {
|
||||
const x = controlDirection.affectsX ? startValues.x - (width - startValues.width) : startValues.x;
|
||||
const y = controlDirection.affectsY ? startValues.y - (height - startValues.height) : startValues.y;
|
||||
return { x, y };
|
||||
return {
|
||||
x: controlDirection.affectsX ? startValues.x - (width - startValues.width) : startValues.x,
|
||||
y: controlDirection.affectsY ? startValues.y - (height - startValues.height) : startValues.y,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user