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
+6 -1
View File
@@ -1,12 +1,17 @@
# @reactflow/node-resizer # @reactflow/node-resizer
## 1.0.3
### Patch Changes
- cleanup
## 1.0.2 ## 1.0.2
### Patch Changes ### Patch Changes
- fix `minWidth` and `minHeight` so that it can be used dynamically - fix `minWidth` and `minHeight` so that it can be used dynamically
## 1.0.1 ## 1.0.1
### Patch Changes ### Patch Changes
-1
View File
@@ -7,4 +7,3 @@ A resizer component for React Flow that can be attached to a node.
```sh ```sh
npm install @reactflow/node-resizer npm install @reactflow/node-resizer
``` ```
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@reactflow/node-resizer", "name": "@reactflow/node-resizer",
"version": "1.0.2", "version": "1.0.3",
"description": "A helper component for resizing nodes.", "description": "A helper component for resizing nodes.",
"keywords": [ "keywords": [
"react", "react",
+1 -2
View File
@@ -87,12 +87,10 @@ function ResizeControl({
} = startValues.current; } = startValues.current;
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues.current; const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues.current;
const distX = Math.floor(enableX ? xSnapped - startX : 0); const distX = Math.floor(enableX ? xSnapped - startX : 0);
const distY = Math.floor(enableY ? ySnapped - startY : 0); const distY = Math.floor(enableY ? ySnapped - startY : 0);
const width = Math.max(startWidth + (invertX ? -distX : distX), minWidth); const width = Math.max(startWidth + (invertX ? -distX : distX), minWidth);
const height = Math.max(startHeight + (invertY ? -distY : distY), minHeight); const height = Math.max(startHeight + (invertY ? -distY : distY), minHeight);
const isWidthChange = width !== prevWidth; const isWidthChange = width !== prevWidth;
const isHeightChange = height !== prevHeight; const isHeightChange = height !== prevHeight;
@@ -131,6 +129,7 @@ function ResizeControl({
height: height, height: height,
}, },
}; };
changes.push(dimensionChange); changes.push(dimensionChange);
prevValues.current.width = width; prevValues.current.width = width;
prevValues.current.height = height; prevValues.current.height = height;