chore(resizer): cleanup

This commit is contained in:
moklick
2022-12-06 20:00:18 +01:00
parent 2f477f384f
commit 5e916ba2db
4 changed files with 8 additions and 5 deletions

View File

@@ -1,12 +1,17 @@
# @reactflow/node-resizer
## 1.0.3
### Patch Changes
- cleanup
## 1.0.2
### Patch Changes
- fix `minWidth` and `minHeight` so that it can be used dynamically
## 1.0.1
### Patch Changes

View File

@@ -7,4 +7,3 @@ A resizer component for React Flow that can be attached to a node.
```sh
npm install @reactflow/node-resizer
```

View File

@@ -1,6 +1,6 @@
{
"name": "@reactflow/node-resizer",
"version": "1.0.2",
"version": "1.0.3",
"description": "A helper component for resizing nodes.",
"keywords": [
"react",

View File

@@ -87,12 +87,10 @@ function ResizeControl({
} = startValues.current;
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues.current;
const distX = Math.floor(enableX ? xSnapped - startX : 0);
const distY = Math.floor(enableY ? ySnapped - startY : 0);
const width = Math.max(startWidth + (invertX ? -distX : distX), minWidth);
const height = Math.max(startHeight + (invertY ? -distY : distY), minHeight);
const isWidthChange = width !== prevWidth;
const isHeightChange = height !== prevHeight;
@@ -131,6 +129,7 @@ function ResizeControl({
height: height,
},
};
changes.push(dimensionChange);
prevValues.current.width = width;
prevValues.current.height = height;