Skip to content

Commit 75c011e

Browse files
committed
Restrict boxes going out of bounds during resize
1 parent 93c36f7 commit 75c011e

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

dist/index.es.js

+66-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.es.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Box.js

+4
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ class Box extends PureComponent {
268268
node: this.box.current
269269
};
270270

271+
// Calculate the restrictions if resize goes out of bounds
272+
const restrictResizeWithinBoundaries = calculateBoundariesForResize(data.left, data.top, currentPosition.width, currentPosition.height, boundingBoxPosition);
273+
data = Object.assign({}, data, restrictResizeWithinBoundaries);
274+
271275
this.props.onResize && this.props.onResize(e, data);
272276
}
273277
};

0 commit comments

Comments
 (0)