feat: support separate x and y resizeratio #778
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed solution
If the resizable component is centered, for example you have margin x auto, it resizes twice as fast, so the x ratio should be 2 instead of 1. While y ratio should stay 1. This implements the option to pass an object to resizeRatio of
{x?:number; y?:number}
so x and y axis can have a different resizeRatio.Tradeoffs
Users can keep providing a number to
resizeRatio
if they don't want to use thisTesting Done
Wrap resizable in a container and give it
margin-left: auto
andmargin-right: auto
, see how the handle does not stick to the cursor while resizing. AddresizeRatio={{ x: 2 }}
and see now the handle moves with the cursor.