Skip to content

Commit

Permalink
feat: add lockAspectRatio props in GridItem Component
Browse files Browse the repository at this point in the history
  • Loading branch information
Kun8018 committed Sep 20, 2022
1 parent 2e1387b commit e1a5096
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/GridItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type Props = {
isDraggable: boolean,
isResizable: boolean,
isBounded: boolean,
lockAspectRatio?: boolean,
static?: boolean,
useCSSTransforms?: boolean,
usePercentages?: boolean,
Expand Down Expand Up @@ -174,6 +175,7 @@ export default class GridItem extends React.Component<Props, State> {
isDraggable: PropTypes.bool.isRequired,
isResizable: PropTypes.bool.isRequired,
isBounded: PropTypes.bool.isRequired,
lockAspectRatio: PropTypes.bool,
static: PropTypes.bool,

// Use CSS transforms instead of top/left
Expand All @@ -198,6 +200,7 @@ export default class GridItem extends React.Component<Props, State> {
className: "",
cancel: "",
handle: "",
lockAspectRatio: false,
minH: 1,
minW: 1,
maxH: Infinity,
Expand Down Expand Up @@ -370,6 +373,7 @@ export default class GridItem extends React.Component<Props, State> {
const {
cols,
x,
lockAspectRatio,
minW,
minH,
maxW,
Expand Down Expand Up @@ -406,6 +410,7 @@ export default class GridItem extends React.Component<Props, State> {
className={isResizable ? undefined : "react-resizable-hide"}
width={position.width}
height={position.height}
lockAspectRatio={lockAspectRatio}
minConstraints={minConstraints}
maxConstraints={maxConstraints}
onResizeStop={this.onResizeStop}
Expand Down

0 comments on commit e1a5096

Please sign in to comment.