diff --git a/lib/Resizable.js b/lib/Resizable.js index 44f6b8f7..e12a29d3 100644 --- a/lib/Resizable.js +++ b/lib/Resizable.js @@ -127,8 +127,12 @@ export default class Resizable extends React.Component { if (axisV === 'n') deltaY = -deltaY; // Update w/h by the deltas. Also factor in transformScale. - let width = this.props.width + (canDragX ? deltaX / this.props.transformScale : 0); - let height = this.props.height + (canDragY ? deltaY / this.props.transformScale : 0); + // Use lastSize (if available) instead of props to avoid losing deltas + // when React can't re-render between consecutive mouse events. + const baseWidth = this.lastSize?.width ?? this.props.width; + const baseHeight = this.lastSize?.height ?? this.props.height; + let width = baseWidth + (canDragX ? deltaX / this.props.transformScale : 0); + let height = baseHeight + (canDragY ? deltaY / this.props.transformScale : 0); // Run user-provided constraints. [width, height] = this.runConstraints(width, height);