Skip to content

N/S Handles not working on Resizable component with locked aspect ratio #105

@simzar

Description

@simzar

Thanks for opening an issue!

Please select the type of issue you're reporting. For questions.

  • Bug
  • Feature Request
  • Question

Problem Report

North and South handles do not work on a resizable container with locked aspect ratio. Other handles work well. It is caused by the height calculation, depending on width change in runConstraints method:

if (this.props.lockAspectRatio) {
      const ratio = this.state.width / this.state.height;
      height = width / ratio;
      width = height * ratio;
    }

Since north/south handles allow only vertical resize, width value does not change, hence the calculated height value that respects aspect ratio is the initial height.

System Info

Node Version: v10.15.3
Browser: Google Chrome Version 76.0.3809.132 (Official Build) (64-bit)
OS: Ubuntu 18.04.3 LTS, but bug is not OS nor browser dependent.

Reproduction

Codesandbox:
https://codesandbox.io/s/react-resizable-playground-if88d?fontsize=14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions