Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/Resizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@ export default class Resizable extends React.Component<Props, void> {
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);
Expand Down
Loading